Documentation
¶
Index ¶
- type Adapter
- type AnswerResult
- type ClassifyResult
- type ClaudeAdapter
- func (c *ClaudeAdapter) Answer(ctx context.Context, query string, notes []*model.Note) (AnswerResult, error)
- func (c *ClaudeAdapter) Classify(ctx context.Context, content string, categories []model.Category, ...) (ClassifyResult, error)
- func (c *ClaudeAdapter) Summarize(ctx context.Context, content string) (string, error)
- type OllamaAdapter
- func (o *OllamaAdapter) Answer(ctx context.Context, query string, notes []*model.Note) (AnswerResult, error)
- func (o *OllamaAdapter) Classify(ctx context.Context, content string, categories []model.Category, ...) (ClassifyResult, error)
- func (o *OllamaAdapter) Summarize(ctx context.Context, content string) (string, error)
- type OpenAIAdapter
- func (o *OpenAIAdapter) Answer(ctx context.Context, query string, notes []*model.Note) (AnswerResult, error)
- func (o *OpenAIAdapter) Classify(ctx context.Context, content string, categories []model.Category, ...) (ClassifyResult, error)
- func (o *OpenAIAdapter) Summarize(ctx context.Context, content string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter interface {
// Classify returns category, tags, sensitivity, and a one-line summary.
// Called when a note is added without explicit metadata.
Classify(ctx context.Context, content string, categories []model.Category, tags []string) (ClassifyResult, error)
// Answer performs RAG generation: query + retrieved notes → structured response.
// The response carries both the natural-language answer and a flag telling the
// caller whether the notes were actually useful (so callers can hide "Sources"
// blocks when the LLM rejected every candidate).
Answer(ctx context.Context, query string, notes []*model.Note) (AnswerResult, error)
// Summarize returns a one-line description of the note content.
Summarize(ctx context.Context, content string) (string, error)
}
Adapter defines the contract for all LLM backends. Implementations: claude.go, ollama.go.
type AnswerResult ¶
AnswerResult is the structured output from RAG answer generation.
Matched is true iff the LLM concluded that at least one of the provided notes contained the answer. UsedNoteIDs holds short-prefix IDs of the notes the LLM actually used; the search layer filters the retrieved notes down to these so the CLI only displays sources that contributed.
When Matched is false, UsedNoteIDs is empty and Answer is the LLM's natural-language explanation that the answer is not in the notes.
type ClassifyResult ¶
ClassifyResult is the structured output from LLM classification.
type ClaudeAdapter ¶
type ClaudeAdapter struct {
// contains filtered or unexported fields
}
ClaudeAdapter implements LLMAdapter using the Anthropic Claude API.
func NewClaudeAdapter ¶
func NewClaudeAdapter(apiKey, modelName string) *ClaudeAdapter
NewClaudeAdapter creates a Claude API adapter.
func (*ClaudeAdapter) Answer ¶
func (c *ClaudeAdapter) Answer(ctx context.Context, query string, notes []*model.Note) (AnswerResult, error)
Answer performs RAG generation — retrieved notes as context, Claude answers. Returns a structured result so the caller knows whether the notes were actually useful and which ones the model relied on.
type OllamaAdapter ¶
type OllamaAdapter struct {
// contains filtered or unexported fields
}
OllamaAdapter implements LLMAdapter using a local Ollama server.
func NewOllamaAdapter ¶
func NewOllamaAdapter(baseURL, modelName string) *OllamaAdapter
NewOllamaAdapter creates an adapter pointed at the given Ollama base URL.
func (*OllamaAdapter) Answer ¶
func (o *OllamaAdapter) Answer(ctx context.Context, query string, notes []*model.Note) (AnswerResult, error)
Answer performs RAG generation using retrieved notes as context. Returns a structured result so the caller knows whether the notes were actually useful and which ones the model relied on.
type OpenAIAdapter ¶
type OpenAIAdapter struct {
// contains filtered or unexported fields
}
OpenAIAdapter implements the LLM Adapter using the OpenAI Chat Completions API. It talks plain HTTP (no SDK dependency) so the binary stays lean and `go install` needs no extra modules, mirroring the Ollama adapter's style, but pointed at OpenAI with Bearer auth and JSON-mode responses.
func NewOpenAIAdapter ¶
func NewOpenAIAdapter(apiKey, modelName, baseURL string) *OpenAIAdapter
NewOpenAIAdapter creates an adapter for the OpenAI Chat Completions API. baseURL defaults to the public API; override it to target Azure OpenAI, a gateway, or a compatible endpoint. modelName defaults to a fast, cheap model.
func (*OpenAIAdapter) Answer ¶
func (o *OpenAIAdapter) Answer(ctx context.Context, query string, notes []*model.Note) (AnswerResult, error)
Answer performs RAG generation using retrieved notes as context. Returns a structured result so the caller knows whether the notes were actually useful and which ones the model relied on.