Documentation
¶
Index ¶
- func CollectEvents(stream iter.Seq2[*session.Event, error]) ([]*session.Event, error)
- func CollectParts(stream iter.Seq2[*session.Event, error]) ([]*genai.Part, error)
- func CollectTextParts(stream iter.Seq2[*session.Event, error]) ([]string, error)
- func NewGeminiTransport(rrfile string) (http.RoundTripper, error)
- type MockModel
- func (m *MockModel) Generate(ctx context.Context, req *model.LLMRequest) (*model.LLMResponse, error)
- func (m *MockModel) GenerateContent(ctx context.Context, req *model.LLMRequest, stream bool) iter.Seq2[*model.LLMResponse, error]
- func (m *MockModel) GenerateStream(ctx context.Context, req *model.LLMRequest) iter.Seq2[*model.LLMResponse, error]
- func (m *MockModel) Name() string
- type TestAgentRunner
- func (r *TestAgentRunner) Run(t *testing.T, sessionID, newMessage string) iter.Seq2[*session.Event, error]
- func (r *TestAgentRunner) RunContent(t *testing.T, sessionID string, content *genai.Content) iter.Seq2[*session.Event, error]
- func (r *TestAgentRunner) RunContentWithConfig(t *testing.T, sessionID string, content *genai.Content, cfg agent.RunConfig) iter.Seq2[*session.Event, error]
- func (r *TestAgentRunner) SetInitSessionState(state map[string]any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectEvents ¶
CollectEvents collects all event from the llm response until encountering an error. It returns all collected events and the last error.
func CollectParts ¶
CollectParts collects all parts from the llm response until encountering an error. It returns all collected parts and the last error.
func CollectTextParts ¶
CollectTextParts collects all text parts from the llm response until encountering an error. It returns all collected text parts and the last error.
func NewGeminiTransport ¶
func NewGeminiTransport(rrfile string) (http.RoundTripper, error)
NewGeminiTransport returns the genai.ClientConfig configured for record and replay.
Types ¶
type MockModel ¶
type MockModel struct {
Requests []*model.LLMRequest
Responses []*genai.Content
StreamResponsesCount int
}
func (*MockModel) Generate ¶
func (m *MockModel) Generate(ctx context.Context, req *model.LLMRequest) (*model.LLMResponse, error)
GenerateContent implements llm.Model.
func (*MockModel) GenerateContent ¶
func (*MockModel) GenerateStream ¶
func (m *MockModel) GenerateStream(ctx context.Context, req *model.LLMRequest) iter.Seq2[*model.LLMResponse, error]
type TestAgentRunner ¶
type TestAgentRunner struct {
// contains filtered or unexported fields
}
func NewTestAgentRunner ¶
func NewTestAgentRunner(t *testing.T, agent agent.Agent) *TestAgentRunner
NewTestAgentRunner creates a new TestAgentRunner for the given agent as root initSessionState will be used to init all sessions created by this runner.
func NewTestAgentRunnerWithPluginManager ¶
func NewTestAgentRunnerWithPluginManager(t *testing.T, agent agent.Agent, pluginConfig runner.PluginConfig) *TestAgentRunner
NewTestAgentRunner creates a new TestAgentRunner for the given agent as root initSessionState will be used to init all sessions created by this runner.
func (*TestAgentRunner) RunContent ¶
func (*TestAgentRunner) RunContentWithConfig ¶
func (*TestAgentRunner) SetInitSessionState ¶
func (r *TestAgentRunner) SetInitSessionState(state map[string]any)