Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.1.0
type Client interface {
// Return the provider name
Name() string
// ListModels returns the list of available models
ListModels(context.Context, ...opt.Opt) ([]schema.Model, error)
// GetModel returns the model with the given name
GetModel(context.Context, string, ...opt.Opt) (*schema.Model, error)
}
Client is the interface that wraps basic LLM client methods
type Connector ¶ added in v0.4.2
type Connector interface {
// Run establishes and drives the connection until ctx is cancelled
// or the remote server closes it.
Run(ctx context.Context) error
// ListTools returns all tools advertised by the connected remote server.
ListTools(ctx context.Context) ([]Tool, error)
// ListPrompts returns all prompts advertised by the connected remote server.
ListPrompts(ctx context.Context) ([]Prompt, error)
// ListResources returns all resources advertised by the connected remote server.
ListResources(ctx context.Context) ([]Resource, error)
}
Connector is the interface a remote tool source must implement. pkg/mcp/client.Client satisfies this interface.
type Downloader ¶ added in v0.1.0
type Downloader interface {
// DownloadModel downloads the specified model, and otherwise loads the model if already present
DownloadModel(context.Context, string, ...opt.Opt) (*schema.Model, error)
// DeleteModel deletes the specified model from local storage
DeleteModel(context.Context, schema.Model) error
}
Downloader is an interface for managing model files
type Embedder ¶ added in v0.1.0
type Embedder interface {
// Embedding generates an embedding vector for a single text
Embedding(context.Context, schema.Model, string, ...opt.Opt) ([]float64, error)
// BatchEmbedding generates embedding vectors for multiple texts
BatchEmbedding(context.Context, schema.Model, []string, ...opt.Opt) ([][]float64, error)
}
Embedder is an interface for generating text embeddings
type Generator ¶ added in v0.1.0
type Generator interface {
// WithoutSession sends a single message and returns the response (stateless)
WithoutSession(context.Context, schema.Model, *schema.Message, ...opt.Opt) (*schema.Message, *schema.Usage, error)
// WithSession sends a message within a session and returns the response (stateful)
WithSession(context.Context, schema.Model, *schema.Conversation, *schema.Message, ...opt.Opt) (*schema.Message, *schema.Usage, error)
}
Generator is an interface for generating response messages and conducting conversations
type Prompt ¶ added in v0.4.2
type Prompt interface {
// Name is the unique identifier of the prompt.
Name() string
// Title is a human-readable display name.
Title() string
// Description is a human-readable description of the prompt.
Description() string
}
Prompt is the interface a prompt template advertised by a remote server must implement.
type Resource ¶ added in v0.4.2
type Resource interface {
// URI returns the unique identifier of the resource. It must be an absolute
// URI with a non-empty scheme (e.g. "file:///path/to/file").
URI() string
// Name returns a human-readable name for the resource.
Name() string
// Description returns an optional description of the resource.
Description() string
// MIMEType returns the MIME type of the resource content, or an empty
// string if unknown.
MIMEType() string
// Read returns the raw bytes of the resource content.
Read(ctx context.Context) ([]byte, error)
}
Resource is the interface a readable resource must implement.
type Tool ¶
type Tool interface {
// Return the name of the tool
Name() string
// Return the description of the tool
Description() string
// Return the JSON schema for the tool input parameters.
InputSchema() (*jsonschema.Schema, error)
// Return the JSON schema for the tool output, or nil if unspecified.
OutputSchema() (*jsonschema.Schema, error)
// Return optional metadata / hints about the tool.
Meta() ToolMeta
// Run the tool with the given input as JSON (may be nil)
Run(ctx context.Context, input json.RawMessage) (any, error)
}
Tool is an interface for a callable tool with a name, description, input schema, optional output schema, and metadata hints.
type ToolMeta ¶ added in v0.4.2
type ToolMeta struct {
// Title is a human-readable display name (takes precedence over Name).
Title string
// ReadOnlyHint indicates the tool does not modify its environment.
ReadOnlyHint bool
// DestructiveHint, when non-nil and true, indicates the tool may perform
// destructive updates. Meaningful only when ReadOnlyHint is false.
DestructiveHint *bool
// IdempotentHint indicates repeated identical calls have no additional effect.
// Meaningful only when ReadOnlyHint is false.
IdempotentHint bool
// OpenWorldHint, when non-nil and true, indicates the tool may interact
// with external entities outside a closed domain (e.g. web search).
OpenWorldHint *bool
}
ToolMeta holds optional metadata about a tool, sourced from the MCP ToolAnnotations and protocol _meta fields. All fields are hints only.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
llm
command
|
|
|
mcpclient
command
|
|
|
etc
|
|
|
_old/deepseek
deepseek implements an API client for Deepseek's LLM https://api-docs.deepseek.com/
|
deepseek implements an API client for Deepseek's LLM https://api-docs.deepseek.com/ |
|
_old/ollama
ollama implements an API client for ollama https://github.com/ollama/ollama/blob/main/docs/api.md
|
ollama implements an API client for ollama https://github.com/ollama/ollama/blob/main/docs/api.md |
|
_old/openai
openai implements an API client for OpenAI https://platform.openai.com/docs/api-reference
|
openai implements an API client for OpenAI https://platform.openai.com/docs/api-reference |
|
pkg
|
|
|
homeassistant
homeassistant implements an API client for Home Assistant API https://developers.home-assistant.io/docs/api/rest/
|
homeassistant implements an API client for Home Assistant API https://developers.home-assistant.io/docs/api/rest/ |
|
mcp/mock
Package mock provides configurable mock implementations of interfaces for use in tests across the go-llm module.
|
Package mock provides configurable mock implementations of interfaces for use in tests across the go-llm module. |
|
newsapi
newsapi implements an API client for NewsAPI (https://newsapi.org/docs)
|
newsapi implements an API client for NewsAPI (https://newsapi.org/docs) |
|
provider/anthropic
anthropic implements an API client for the Anthropic Messages API.
|
anthropic implements an API client for the Anthropic Messages API. |
|
provider/eliza
eliza implements a mock LLM provider based on the classic ELIZA chatbot created by Joseph Weizenbaum at MIT in 1966.
|
eliza implements a mock LLM provider based on the classic ELIZA chatbot created by Joseph Weizenbaum at MIT in 1966. |
|
provider/google
google implements an API client for the Google Gemini REST API.
|
google implements an API client for the Google Gemini REST API. |
|
provider/mistral
mistral implements an API client for the Mistral AI API.
|
mistral implements an API client for the Mistral AI API. |
|
ui
Package ui defines the interface for chat user interfaces.
|
Package ui defines the interface for chat user interfaces. |
|
ui/bubbletea
Package bubbletea implements ui.ChatUI for interactive terminals using the Charm bubbletea framework.
|
Package bubbletea implements ui.ChatUI for interactive terminals using the Charm bubbletea framework. |
|
ui/command
Package command implements shared slash-command handling for chat UIs.
|
Package command implements shared slash-command handling for chat UIs. |
|
ui/table
Package table provides a terminal table renderer backed by lipgloss.
|
Package table provides a terminal table renderer backed by lipgloss. |
|
ui/telegram
Package telegram implements ui.ChatUI for Telegram bots using telebot v4.
|
Package telegram implements ui.ChatUI for Telegram bots using telebot v4. |
|
weatherapi
weatherapi implements an API client for WeatherAPI https://www.weatherapi.com/docs/
|
weatherapi implements an API client for WeatherAPI https://www.weatherapi.com/docs/ |
