package main
import (
"context"
"fmt"
"log"
"os"
"github.com/curaious/uno/internal/utils"
"github.com/curaious/uno/pkg/agent-framework/agents"
"github.com/curaious/uno/pkg/gateway"
"github.com/curaious/uno/pkg/llm"
"github.com/curaious/uno/pkg/llm/responses"
"github.com/curaious/uno/pkg/sdk"
)
func main() {
// Initialize SDK client
client, err := sdk.New(&sdk.ClientOptions{
LLMConfigs: sdk.NewInMemoryConfigStore([]*gateway.ProviderConfig{
{
ProviderName: llm.ProviderNameOpenAI,
ApiKeys: []*gateway.APIKeyConfig{
{Name: "default", APIKey: os.Getenv("OPENAI_API_KEY")},
},
},
}),
})
if err != nil {
log.Fatal(err)
}
// Create agent
agent := client.NewAgent(&sdk.AgentOptions{
Name: "Hello world agent",
Instruction: client.Prompt("You are helpful assistant. You greet user with a light-joke"),
LLM: client.NewLLM(sdk.LLMOptions{
Provider: llm.ProviderNameOpenAI,
Model: "gpt-4o-mini",
}),
Parameters: responses.Parameters{
Temperature: utils.Ptr(0.2),
},
})
// Execute agent
out, err := agent.Execute(context.Background(), &agents.AgentInput{
Messages: []responses.InputMessageUnion{
responses.UserMessage("Hello!"),
},
})
if err != nil {
log.Fatal(err)
}
// Print response
fmt.Println(out[0].OfOutputMessage.Content[0].OfOutputText.Text)
}