Documentation
¶
Index ¶
- Variables
- func SetupOllamaLocalInstance(ctx context.Context, tag string) (string, testcontainers.Container, func(), error)
- func SetupVLLMLocalInstance(ctx context.Context, model string, tag string, toolParser string) (string, testcontainers.Container, func(), error)
- type CapabilityConfig
- type ChatArgument
- type ChatConfig
- type ChatResult
- type FunctionTool
- type LLMChatClient
- type LLMEmbedClient
- type LLMPromptExecClient
- type LLMStreamClient
- type Message
- type MockChatClient
- type MockEmbedClient
- type MockPromptClient
- type MockProvider
- func (m *MockProvider) CanChat() bool
- func (m *MockProvider) CanEmbed() bool
- func (m *MockProvider) CanPrompt() bool
- func (m *MockProvider) CanStream() bool
- func (m *MockProvider) CanThink() bool
- func (m *MockProvider) GetBackendIDs() []string
- func (m *MockProvider) GetChatConnection(ctx context.Context, backendID string) (LLMChatClient, error)
- func (m *MockProvider) GetContextLength() int
- func (m *MockProvider) GetEmbedConnection(ctx context.Context, backendID string) (LLMEmbedClient, error)
- func (m *MockProvider) GetID() string
- func (m *MockProvider) GetPromptConnection(ctx context.Context, backendID string) (LLMPromptExecClient, error)
- func (m *MockProvider) GetStreamConnection(ctx context.Context, backendID string) (LLMStreamClient, error)
- func (m *MockProvider) GetType() string
- func (m *MockProvider) ModelName() string
- type MockStreamClient
- type Provider
- type StreamParcel
- type Tool
- type ToolCall
Constants ¶
This section is empty.
Variables ¶
var ErrNotSupported = errors.New("operation not supported")
ErrNotSupported is returned when an operation is not supported.
Functions ¶
Types ¶
type CapabilityConfig ¶
type ChatArgument ¶ added in v0.0.66
type ChatArgument interface {
Apply(config *ChatConfig)
}
func WithMaxTokens ¶
func WithMaxTokens(tokens int) ChatArgument
func WithSeed ¶ added in v0.0.66
func WithSeed(seed int) ChatArgument
func WithTemperature ¶
func WithTemperature(temp float64) ChatArgument
func WithTool ¶ added in v0.0.69
func WithTool(tool Tool) ChatArgument
func WithTools ¶ added in v0.0.69
func WithTools(tools ...Tool) ChatArgument
func WithTopP ¶ added in v0.0.66
func WithTopP(p float64) ChatArgument
type ChatConfig ¶ added in v0.0.66
type ChatResult ¶ added in v0.0.69
type FunctionTool ¶ added in v0.0.69
type LLMChatClient ¶
type LLMChatClient interface {
Chat(ctx context.Context, messages []Message, args ...ChatArgument) (ChatResult, error)
}
Client interfaces
type LLMEmbedClient ¶
type LLMPromptExecClient ¶
type LLMStreamClient ¶
type LLMStreamClient interface {
Stream(ctx context.Context, prompt string, args ...ChatArgument) (<-chan *StreamParcel, error)
}
type MockChatClient ¶
type MockChatClient struct{}
MockChatClient is a mock implementation of LLMChatClient for testing.
func (*MockChatClient) Chat ¶
func (m *MockChatClient) Chat(ctx context.Context, messages []Message, opts ...ChatArgument) (ChatResult, error)
Chat returns a mock response.
func (*MockChatClient) Close ¶
func (m *MockChatClient) Close() error
Close is a no-op for the mock client.
type MockEmbedClient ¶
type MockEmbedClient struct{}
MockEmbedClient is a mock implementation of LLMEmbedClient for testing.
func (*MockEmbedClient) Close ¶
func (m *MockEmbedClient) Close() error
Close is a no-op for the mock client.
type MockPromptClient ¶
type MockPromptClient struct{}
MockPromptClient is a mock implementation of LLMPromptExecClient for testing.
func (*MockPromptClient) Close ¶
func (m *MockPromptClient) Close() error
Close is a no-op for the mock client.
type MockProvider ¶
type MockProvider struct {
ID string
Name string
ContextLength int
CanChatFlag bool
CanEmbedFlag bool
CanStreamFlag bool
CanPromptFlag bool
Backends []string
}
MockProvider is a mock implementation of the Provider interface for testing.
func (*MockProvider) CanChat ¶
func (m *MockProvider) CanChat() bool
CanChat returns whether the mock provider can chat.
func (*MockProvider) CanEmbed ¶
func (m *MockProvider) CanEmbed() bool
CanEmbed returns whether the mock provider can embed.
func (*MockProvider) CanPrompt ¶
func (m *MockProvider) CanPrompt() bool
CanPrompt returns whether the mock provider can prompt.
func (*MockProvider) CanStream ¶
func (m *MockProvider) CanStream() bool
CanStream returns whether the mock provider can stream.
func (*MockProvider) CanThink ¶
func (m *MockProvider) CanThink() bool
CanThink returns whether the mock provider can think.
func (*MockProvider) GetBackendIDs ¶
func (m *MockProvider) GetBackendIDs() []string
GetBackendIDs returns the backend IDs for the mock provider.
func (*MockProvider) GetChatConnection ¶
func (m *MockProvider) GetChatConnection(ctx context.Context, backendID string) (LLMChatClient, error)
GetChatConnection returns a mock chat client.
func (*MockProvider) GetContextLength ¶
func (m *MockProvider) GetContextLength() int
GetContextLength returns the context length for the mock provider.
func (*MockProvider) GetEmbedConnection ¶
func (m *MockProvider) GetEmbedConnection(ctx context.Context, backendID string) (LLMEmbedClient, error)
GetEmbedConnection returns a mock embed client.
func (*MockProvider) GetID ¶
func (m *MockProvider) GetID() string
GetID returns the ID for the mock provider.
func (*MockProvider) GetPromptConnection ¶
func (m *MockProvider) GetPromptConnection(ctx context.Context, backendID string) (LLMPromptExecClient, error)
GetPromptConnection returns a mock prompt client.
func (*MockProvider) GetStreamConnection ¶
func (m *MockProvider) GetStreamConnection(ctx context.Context, backendID string) (LLMStreamClient, error)
GetStreamConnection returns a mock stream client.
func (*MockProvider) GetType ¶
func (m *MockProvider) GetType() string
GetType returns the provider type for the mock provider.
func (*MockProvider) ModelName ¶
func (m *MockProvider) ModelName() string
ModelName returns the model name for the mock provider.
type MockStreamClient ¶
type MockStreamClient struct{}
MockStreamClient is a mock implementation of LLMStreamClient for testing.
func (*MockStreamClient) Close ¶
func (m *MockStreamClient) Close() error
Close is a no-op for the mock client.
func (*MockStreamClient) Stream ¶
func (m *MockStreamClient) Stream(ctx context.Context, prompt string, args ...ChatArgument) (<-chan *StreamParcel, error)
Stream returns a channel with mock stream parcels.
type Provider ¶
type Provider interface {
GetBackendIDs() []string
ModelName() string
GetID() string
GetType() string
GetContextLength() int
CanChat() bool
CanEmbed() bool
CanStream() bool
CanPrompt() bool
CanThink() bool
GetChatConnection(ctx context.Context, backendID string) (LLMChatClient, error)
GetPromptConnection(ctx context.Context, backendID string) (LLMPromptExecClient, error)
GetEmbedConnection(ctx context.Context, backendID string) (LLMEmbedClient, error)
GetStreamConnection(ctx context.Context, backendID string) (LLMStreamClient, error)
}
type StreamParcel ¶
type Tool ¶ added in v0.0.69
type Tool struct {
Type string `json:"type"`
Function *FunctionTool `json:"function,omitempty"`
}