Skip to main content

Prerequisites

Install Uno

go get -u github.com/curaious/uno

Setting up the SDK

package main

import (
    "github.com/curaious/uno/pkg/sdk"
    "github.com/curaious/uno/pkg/gateway"
	"github.com/curaious/uno/pkg/llm"
)

func main() {
	client, err := sdk.New(&sdk.ClientOptions{
		LLMConfigs: sdk.NewInMemoryConfigStore([]*gateway.ProviderConfig{
			{
				ProviderName:  llm.ProviderNameOpenAI,
				ApiKeys: []*gateway.APIKeyConfig{
					{
						Name:   "Key 1",
						APIKey: "your-openai-api-key",
					},
				},
			},
		}),
	})
}

Making LLM Calls

Create a model instance by specifying the provider and model name:
model := client.NewLLM(sdk.LLMOptions{
    Provider: llm.ProviderNameOpenAI,
    Model:    "gpt-4.1-mini",
})
Then, make a call to generate a response:
resp, err := model.NewResponses(ctx, &responses.Request{
    Instructions: utils.Ptr("You are a helpful assistant."),
    Input: responses.InputUnion{
        OfString: utils.Ptr("What is the capital of France?"),
    },
})
Finally, extract the generated text from the response:
for _, output := range resp.Output {
    if output.OfOutputMessage != nil {
        for _, content := range output.OfOutputMessage.Content {
            if content.OfOutputText != nil {
                fmt.Println(content.OfOutputText.Text)
            }
        }
    }
}

Responses API

Learn more about making LLM calls with the Responses API.

Creating Agents

Create a simple agent with system instructions and an LLM:
agent := client.NewAgent(&sdk.AgentOptions{
    Name:        "Assistant",
    Instruction: client.Prompt("You are a helpful assistant."),
    LLM: client.NewLLM(sdk.LLMOptions{
        Provider: llm.ProviderNameOpenAI,
        Model:    "gpt-4o-mini",
    }),
})
Execute the agent with user messages:
out, err := agent.Execute(ctx, &agents.AgentInput{
    Messages: []responses.InputMessageUnion{
        responses.UserMessage("Hello!"),
    },
})
Extract the agent’s response:
for _, output := range out.Output {
    if output.OfOutputMessage != nil {
        for _, content := range output.OfOutputMessage.Content {
            if content.OfOutputText != nil {
                fmt.Println(content.OfOutputText.Text)
            }
        }
    }
}

Agents

Learn more about building agents with the Agent SDK.