Documentation
¶
Index ¶
- func AssertMapHasKey(t *testing.T, m map[string]interface{}, key string)
- func GetMapValue[T any](t *testing.T, m map[string]interface{}, key string) (T, bool)
- func RequireEnv(t *testing.T, envVar string) string
- func RequireMapValue[T any](t *testing.T, m map[string]interface{}, key string) T
- func SkipIfNoEnv(t *testing.T, envVar string)
- type MockAgent
- func (m *MockAgent) Batch(ctx context.Context, inputs []*core.AgentInput) ([]*core.AgentOutput, error)
- func (m *MockAgent) Capabilities() []string
- func (m *MockAgent) Description() string
- func (m *MockAgent) Invoke(ctx context.Context, input *core.AgentInput) (*core.AgentOutput, error)
- func (m *MockAgent) Name() string
- func (m *MockAgent) Pipe(next core.Runnable[*core.AgentOutput, any]) core.Runnable[*core.AgentInput, any]
- func (m *MockAgent) SetInvokeFn(...)
- func (m *MockAgent) Stream(ctx context.Context, input *core.AgentInput) (<-chan core.StreamChunk[*core.AgentOutput], error)
- func (m *MockAgent) WithCallbacks(callbacks ...core.Callback) core.Runnable[*core.AgentInput, *core.AgentOutput]
- func (m *MockAgent) WithConfig(config core.RunnableConfig) core.Runnable[*core.AgentInput, *core.AgentOutput]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertMapHasKey ¶
AssertMapHasKey checks if a map has a specific key with a descriptive error message
func GetMapValue ¶
GetMapValue gets a map value and returns it if it's of the expected type, otherwise returns false
func RequireEnv ¶
RequireEnv requires the specified environment variable to be set, returns its value
func RequireMapValue ¶
RequireMapValue gets a map value and requires it to be of the expected type
func SkipIfNoEnv ¶
SkipIfNoEnv skips the test if the specified environment variable is not set
Types ¶
type MockAgent ¶
type MockAgent struct {
// contains filtered or unexported fields
}
MockAgent is a simple function-based mock agent for testing examples
func NewMockAgent ¶
NewMockAgent creates a new mock agent with the given name
func (*MockAgent) Batch ¶
func (m *MockAgent) Batch(ctx context.Context, inputs []*core.AgentInput) ([]*core.AgentOutput, error)
Batch is not implemented for examples (not needed)
func (*MockAgent) Capabilities ¶
Capabilities returns the agent capabilities
func (*MockAgent) Description ¶
Description returns the agent description
func (*MockAgent) Invoke ¶
func (m *MockAgent) Invoke(ctx context.Context, input *core.AgentInput) (*core.AgentOutput, error)
Invoke executes the mock agent logic
func (*MockAgent) Pipe ¶
func (m *MockAgent) Pipe(next core.Runnable[*core.AgentOutput, any]) core.Runnable[*core.AgentInput, any]
Pipe is not implemented for examples
func (*MockAgent) SetInvokeFn ¶
func (m *MockAgent) SetInvokeFn(fn func(ctx context.Context, input *core.AgentInput) (*core.AgentOutput, error))
SetInvokeFn sets a custom invoke function for this mock agent
func (*MockAgent) Stream ¶
func (m *MockAgent) Stream(ctx context.Context, input *core.AgentInput) (<-chan core.StreamChunk[*core.AgentOutput], error)
Stream is not implemented for examples (not needed)
func (*MockAgent) WithCallbacks ¶
func (m *MockAgent) WithCallbacks(callbacks ...core.Callback) core.Runnable[*core.AgentInput, *core.AgentOutput]
WithCallbacks returns the agent (no-op for mock)
func (*MockAgent) WithConfig ¶
func (m *MockAgent) WithConfig(config core.RunnableConfig) core.Runnable[*core.AgentInput, *core.AgentOutput]
WithConfig returns the agent (no-op for mock)