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 EnableSharedResolver(r sharedcredentials.Resolver)
- 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 KBDomain
- 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 PermissionFilter
- type Provider
- type ProviderInfo
- type Record
- type SearchHit
- type SidecarConfig
Constants ¶
const ( DefaultBackend = "lancedb" FakeBackend = "fake" SidecarSchema = "pinax.kb.sidecar.v1" )
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
func EnableSharedResolver ¶ added in v0.1.6
func EnableSharedResolver(r sharedcredentials.Resolver)
EnableSharedResolver attaches the credentialctl shared credential resolver so the OpenAI embedding provider falls back to the shared credential when OPENAI_API_KEY is unset. Passing nil disables the fallback.
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 KBDomain ¶ added in v0.1.6
type KBDomain struct{}
KBDomain is the pinax knowledge-base adapter for the shared lance vector + RAG platform. It knows the table name, the redaction policy for note metadata, and the permission rules (filter by note status and kind).
The metadata field names mirror pinax's existing sidecarChunk schema (chunk_id, note_id, vault_path, heading_path, status, kind, ...).
func (KBDomain) Redact ¶ added in v0.1.6
Redact strips sensitive fields from a record's metadata before it leaves the knowledge-base domain. The safe-to-surface keys (chunk_id, note_id, vault_path, heading_path, title, preview, kind, status, tags, content_hash, chunk_hash, token_count) pass through untouched.
func (KBDomain) ResolvePermission ¶ added in v0.1.6
func (KBDomain) ResolvePermission(_ context.Context, records []Record, filter PermissionFilter) []string
ResolvePermission computes the set of allowed record IDs given an opaque filter. The filter may carry:
- note_status: []string e.g. ["active"] — only records whose metadata["status"] is in this list are allowed.
- note_kind: []string e.g. ["note","journal"] — only records whose metadata["kind"] is in this list are allowed.
A missing or empty filter dimension matches everything (no restriction). Records with no metadata pass unless a filter dimension is set.
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 PermissionFilter ¶ added in v0.1.8
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"`
}