Documentation
¶
Overview ¶
Package fakes provides deterministic test doubles for GoLangGraph's external dependencies.
The doubles stand in for a language model only. Everything else in a test using them — the graph engine, the agent loop, tool execution, state handling, the HTTP server — is the real implementation, so the tests exercise the framework rather than a mock of it.
Index ¶
- type Provider
- func (p *Provider) Calls() int
- func (p *Provider) Close() error
- func (p *Provider) Complete(ctx context.Context, req llm.CompletionRequest) (*llm.CompletionResponse, error)
- func (p *Provider) CompleteStream(ctx context.Context, req llm.CompletionRequest, callback llm.StreamCallback) error
- func (p *Provider) CompleteStreamWithMode(ctx context.Context, req llm.CompletionRequest, callback llm.StreamCallback, ...) error
- func (p *Provider) CompleteWithMode(ctx context.Context, req llm.CompletionRequest, mode llm.StreamMode) (*llm.CompletionResponse, error)
- func (p *Provider) FailWith(errs ...error) *Provider
- func (p *Provider) GetConfig() map[string]interface{}
- func (p *Provider) GetModels(ctx context.Context) ([]string, error)
- func (p *Provider) GetName() string
- func (p *Provider) GetStreamingConfig() *llm.StreamingConfig
- func (p *Provider) IsHealthy(ctx context.Context) error
- func (p *Provider) Prompts() []string
- func (p *Provider) Script(replies ...string) *Provider
- func (p *Provider) SetConfig(config map[string]interface{}) error
- func (p *Provider) SetHealthy(healthy bool) *Provider
- func (p *Provider) SetStreamingConfig(c *llm.StreamingConfig) error
- func (p *Provider) SupportsStreaming() bool
- func (p *Provider) WithDelay(d time.Duration) *Provider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is a scriptable llm.Provider.
Replies are returned in order and the last one repeats, so a test can script an agent's reasoning turn by turn without depending on a live model.
func NewProvider ¶
NewProvider creates a provider that always answers with reply.
func (*Provider) Complete ¶
func (p *Provider) Complete(ctx context.Context, req llm.CompletionRequest) (*llm.CompletionResponse, error)
func (*Provider) CompleteStream ¶
func (p *Provider) CompleteStream(ctx context.Context, req llm.CompletionRequest, callback llm.StreamCallback) error
func (*Provider) CompleteStreamWithMode ¶
func (p *Provider) CompleteStreamWithMode(ctx context.Context, req llm.CompletionRequest, callback llm.StreamCallback, mode llm.StreamMode) error
func (*Provider) CompleteWithMode ¶
func (p *Provider) CompleteWithMode(ctx context.Context, req llm.CompletionRequest, mode llm.StreamMode) (*llm.CompletionResponse, error)
func (*Provider) FailWith ¶
FailWith makes the next calls fail with the given errors, in order. A nil entry means that call succeeds.
func (*Provider) GetStreamingConfig ¶
func (p *Provider) GetStreamingConfig() *llm.StreamingConfig
func (*Provider) Prompts ¶
Prompts returns the content of every user message the provider has received, so a test can assert what the agent actually asked.
func (*Provider) Script ¶
Script sets the replies returned by successive calls. The final reply repeats once the script is exhausted.
func (*Provider) SetHealthy ¶
SetHealthy controls what IsHealthy reports.
func (*Provider) SetStreamingConfig ¶
func (p *Provider) SetStreamingConfig(c *llm.StreamingConfig) error