package agent_test
import (
"context"
"testing"
"github.com/hastekit/agent-sdk-go/pkg/agents"
"github.com/hastekit/agent-sdk-go/pkg/gateway/llm/constants"
"github.com/hastekit/agent-sdk-go/pkg/gateway/llm/responses"
)
type fixedLLM struct{}
func (fixedLLM) NewStreamingResponses(context.Context, *agents.ModelCall,
*responses.Request, func(*responses.ResponseChunk)) (*responses.Response, error) {
return &responses.Response{Output: []responses.OutputMessageUnion{{
OfOutputMessage: &responses.OutputMessage{
ID: "answer", Role: constants.RoleAssistant,
Content: &responses.OutputContent{{
OfOutputText: &responses.OutputTextContent{Text: "Hello"},
}},
},
}}}, nil
}
func TestAnswer(t *testing.T) {
agent := agents.NewAgent(&agents.AgentOptions{Name: "test"}).WithLLM(fixedLLM{})
result, err := agent.Run(t.Context(), &agents.AgentInput{})
if err != nil { t.Fatal(err) }
if result.Text() != "Hello" { t.Fatalf("unexpected answer: %q", result.Text()) }
}