Documentation
¶
Index ¶
- Constants
- func Doctor(ctx context.Context, root, backend string, sidecar SidecarConfig) (map[string]any, error)
- func DoctorProvider(ctx context.Context, name, model string) (map[string]any, error)
- func Save(ctx context.Context, root string, chunks []Chunk, backend string, ...) (string, error)
- type BackendInfo
- type BatchProvider
- type Chunk
- type FakeProvider
- type FileStore
- type GeminiProvider
- type OllamaProvider
- func (p OllamaProvider) Doctor(ctx context.Context) error
- func (p OllamaProvider) Embed(ctx context.Context, text string) ([]float64, error)
- func (p OllamaProvider) EmbedBatch(ctx context.Context, texts []string) ([][]float64, error)
- func (p OllamaProvider) Model() string
- func (p OllamaProvider) Name() string
- type OpenAIProvider
- type Provider
- type ProviderInfo
- type SearchHit
- type SidecarConfig
Constants ¶
View Source
const ( DefaultBackend = "lancedb" FakeBackend = "fake" SidecarSchema = "pinax.kb.sidecar.v1" )
View Source
const ( DefaultProvider = "gemini" DefaultModel = "text-embedding-004" OpenAIDefaultModel = "text-embedding-3-small" OllamaDefaultModel = "nomic-embed-text" FakeProviderModel = "fake-hash-v1" )
Variables ¶
This section is empty.
Functions ¶
func DoctorProvider ¶ added in v0.1.3
Types ¶
type BackendInfo ¶ added in v0.1.3
type BackendInfo struct {
Name string `json:"name"`
LocalOnly bool `json:"local_only"`
RequiresSidecar bool `json:"requires_sidecar"`
Description string `json:"description,omitempty"`
}
func ListBackends ¶ added in v0.1.3
func ListBackends() []BackendInfo
type BatchProvider ¶ added in v0.1.3
type Chunk ¶
type Chunk struct {
ChunkID string `json:"chunk_id"`
NoteID string `json:"note_id,omitempty"`
VaultPath string `json:"vault_path"`
Title string `json:"title"`
HeadingPath string `json:"heading_path,omitempty"`
ChunkText string `json:"chunk_text"`
Preview string `json:"preview"`
ContentHash string `json:"content_hash"`
ChunkHash string `json:"chunk_hash"`
TokenCount int `json:"token_count"`
Tags []string `json:"tags,omitempty"`
Kind string `json:"kind,omitempty"`
Status string `json:"status,omitempty"`
EmbeddingModel string `json:"embedding_model"`
EmbeddingDim int `json:"embedding_dim"`
Provider string `json:"provider"`
Backend string `json:"backend"`
Vector []float64 `json:"vector"`
IndexedAt string `json:"indexed_at"`
}
type FakeProvider ¶
type FakeProvider struct{ ModelName string }
func (FakeProvider) EmbedBatch ¶ added in v0.1.3
func (FakeProvider) Model ¶
func (p FakeProvider) Model() string
func (FakeProvider) Name ¶
func (p FakeProvider) Name() string
type FileStore ¶
func NewFileStore ¶
type GeminiProvider ¶
func (GeminiProvider) Model ¶
func (p GeminiProvider) Model() string
func (GeminiProvider) Name ¶
func (p GeminiProvider) Name() string
type OllamaProvider ¶ added in v0.1.3
func (OllamaProvider) Doctor ¶ added in v0.1.3
func (p OllamaProvider) Doctor(ctx context.Context) error
func (OllamaProvider) EmbedBatch ¶ added in v0.1.3
func (OllamaProvider) Model ¶ added in v0.1.3
func (p OllamaProvider) Model() string
func (OllamaProvider) Name ¶ added in v0.1.3
func (p OllamaProvider) Name() string
type OpenAIProvider ¶ added in v0.1.3
type OpenAIProvider struct {
APIKey string
ModelName string
BaseURL string
HTTPClient *http.Client
}
func (OpenAIProvider) EmbedBatch ¶ added in v0.1.3
func (OpenAIProvider) Model ¶ added in v0.1.3
func (p OpenAIProvider) Model() string
func (OpenAIProvider) Name ¶ added in v0.1.3
func (p OpenAIProvider) Name() string
type Provider ¶
type Provider interface {
Name() string
Model() string
Embed(ctx context.Context, text string) ([]float64, error)
}
func NewProvider ¶
type ProviderInfo ¶ added in v0.1.3
type ProviderInfo struct {
Name string `json:"name"`
DefaultModel string `json:"default_model"`
Configured bool `json:"configured"`
CredentialSource string `json:"credential_source,omitempty"`
LocalOnly bool `json:"local_only"`
RequiresCredential bool `json:"requires_credential"`
}
func ListProviders ¶ added in v0.1.3
func ListProviders() []ProviderInfo
func ProviderInfoFor ¶ added in v0.1.3
func ProviderInfoFor(name string) (ProviderInfo, error)
type SearchHit ¶
type SearchHit struct {
ChunkID string `json:"chunk_id"`
NoteID string `json:"note_id,omitempty"`
Path string `json:"path"`
Title string `json:"title"`
HeadingPath string `json:"heading_path,omitempty"`
Preview string `json:"preview"`
Score float64 `json:"score"`
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
Tags []string `json:"tags,omitempty"`
Kind string `json:"kind,omitempty"`
Status string `json:"status,omitempty"`
}
type SidecarConfig ¶
Click to show internal directories.
Click to hide internal directories.