Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/agenthandoff.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ func transferToSpanishAgent(args map[string]interface{}, contextVariables map[st
Value: "Transferring to Spanish Agent.",
}
}
func main() {
func agentHandoffExample() {
dotenv.Load()

client := swarmgo.NewSwarm(os.Getenv("OPENAI_API_KEY"))
fmt.Println("Agent Handoff Example", os.Getenv("OPENAI_API_KEY"), os.Getenv("OPENAI_PROXY"))

englishAgent := &swarmgo.Agent{
Name: "EnglishAgent",
Expand Down
2 changes: 1 addition & 1 deletion examples/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
openai "github.com/sashabaranov/go-openai"
)

func main() {
func basicExample() {
dotenv.Load()

client := swarmgo.NewSwarm(os.Getenv("OPENAI_API_KEY"))
Expand Down
2 changes: 1 addition & 1 deletion examples/contextvariables.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func printAccountDetails(args map[string]interface{}, contextVariables map[strin
Value: fmt.Sprintf("Account Details: %v %v", name, userID),
}
}
func main() {
func contextVariablesExample() {
dotenv.Load()

client := swarmgo.NewSwarm(os.Getenv("OPENAI_API_KEY"))
Expand Down
7 changes: 3 additions & 4 deletions examples/functioncall.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ import (
openai "github.com/sashabaranov/go-openai"
)

func getWeather(args map[string]interface{}, contextVariables map[string]interface{}) swarmgo.Result {
func getWeather1(args map[string]interface{}, contextVariables map[string]interface{}) swarmgo.Result {
location := args["location"].(string)
return swarmgo.Result{
Value: fmt.Sprintf("{'temp':67, 'unit':'F', 'location':'%s'}", location),
}
}
func main() {
func functionCallExample() {
dotenv.Load()

client := swarmgo.NewSwarm(os.Getenv("OPENAI_API_KEY"))

agent := &swarmgo.Agent{
Expand All @@ -38,7 +37,7 @@ func main() {
},
"required": []string{"location"},
},
Function: getWeather,
Function: getWeather1,
},
},
Model: "gpt-4",
Expand Down
15 changes: 15 additions & 0 deletions examples/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package main

func main() {
//basicExample()

//functionCallExample()

//weatherAgentExample()

//triageAgentExample()

//contextVariablesExample()

agentHandoffExample()
}
2 changes: 1 addition & 1 deletion examples/triageagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func initAgents() {
})
}

func main() {
func triageAgentExample() {
dotenv.Load()

client := swarmgo.NewSwarm(os.Getenv("OPENAI_API_KEY"))
Expand Down
2 changes: 1 addition & 1 deletion examples/weatheragent.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func sendEmail(args map[string]interface{}, contextVariables map[string]interfac
}
}

func main() {
func weatherAgentExample() {
dotenv.Load()

client := swarmgo.NewSwarm(os.Getenv("OPENAI_API_KEY"))
Expand Down
Loading