Documentation
¶
Index ¶
- Constants
- func ChunkDocument(content string) []string
- type Config
- type Embedder
- type Message
- type Provider
- func (p *Provider) Chat(ctx context.Context, messages []Message) (string, error)
- func (p *Provider) ChatStream(ctx context.Context, messages []Message) (string, error)
- func (p *Provider) Embedding(ctx context.Context, text string) ([]float32, error)
- func (p *Provider) ListModels(ctx context.Context) ([]string, error)
- func (p *Provider) Validate(ctx context.Context) error
Constants ¶
View Source
const ( // ChunkSize is the maximum character count per chunk. ChunkSize = 500 // ChunkOverlap is the character count overlap between chunks. ChunkOverlap = 50 )
Variables ¶
This section is empty.
Functions ¶
func ChunkDocument ¶
ChunkDocument splits a long document into multiple chunks for embedding. It preserves paragraph boundaries when possible.
Types ¶
type Config ¶
type Config struct {
BaseURL string
APIKey string
EmbeddingModel string
ChatModel string
MaxRetries int
Timeout time.Duration
}
Config holds the AI provider configuration.
type Embedder ¶
type Embedder struct {
// contains filtered or unexported fields
}
Embedder handles embedding generation and storage for memos.
func NewEmbedder ¶
NewEmbedder creates a new embedder.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider provides AI capabilities including LLM and Embedding.
func NewProvider ¶
NewProvider creates a new AI provider.
func NewProviderFromEnv ¶
NewProviderFromEnv creates a provider from environment variables.
func (*Provider) ChatStream ¶
ChatStream performs a streaming chat completion.
func (*Provider) ListModels ¶
ListModels lists available models from the provider.
Click to show internal directories.
Click to hide internal directories.