Documentation
¶
Index ¶
- Constants
- type AzureConfig
- func (a *AzureConfig) ChatAPIKey() string
- func (a *AzureConfig) ChatAPIVersion() string
- func (a *AzureConfig) ChatEndpoint() string
- func (a *AzureConfig) ChatModel() string
- func (a *AzureConfig) EmbedAPIKey() string
- func (a *AzureConfig) EmbedAPIVersion() string
- func (a *AzureConfig) EmbedEndpoint() string
- func (a *AzureConfig) EmbedModel() string
- type AzureServiceConfig
- type CommunityConfig
- type Config
- type IndexingConfig
- type LLMConfig
- type LogConfig
- type OllamaConfig
- type OpenAIConfig
- type ServerConfig
Constants ¶
const DefaultProjectSlug = "_default"
DefaultProjectSlug is the slug used when no ?project= / X-Project value is supplied on a request. Locked by Phase-1 spec.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AzureConfig ¶
type AzureConfig struct {
// Shared defaults — used when chat/embed-specific values are not set.
Endpoint string `mapstructure:"endpoint"`
APIKey string `mapstructure:"api_key" secret:"true"`
APIVersion string `mapstructure:"api_version"`
Chat AzureServiceConfig `mapstructure:"chat"`
Embed AzureServiceConfig `mapstructure:"embed"`
}
AzureConfig supports shared defaults with per-service overrides. Top-level fields (endpoint, api_key, api_version) are shared defaults. Chat/Embed sub-configs override specific fields when set.
Env vars (prefix DOCSIQ):
DOCSIQ_LLM_AZURE_ENDPOINT — shared endpoint DOCSIQ_LLM_AZURE_API_KEY — shared API key DOCSIQ_LLM_AZURE_API_VERSION — shared API version DOCSIQ_LLM_AZURE_CHAT_ENDPOINT — chat-specific endpoint DOCSIQ_LLM_AZURE_CHAT_API_KEY — chat-specific API key DOCSIQ_LLM_AZURE_CHAT_MODEL — chat model name DOCSIQ_LLM_AZURE_EMBED_ENDPOINT — embedding-specific endpoint DOCSIQ_LLM_AZURE_EMBED_API_KEY — embedding-specific API key DOCSIQ_LLM_AZURE_EMBED_MODEL — embedding model name
func (*AzureConfig) ChatAPIKey ¶
func (a *AzureConfig) ChatAPIKey() string
func (*AzureConfig) ChatAPIVersion ¶
func (a *AzureConfig) ChatAPIVersion() string
func (*AzureConfig) ChatEndpoint ¶
func (a *AzureConfig) ChatEndpoint() string
func (*AzureConfig) ChatModel ¶
func (a *AzureConfig) ChatModel() string
func (*AzureConfig) EmbedAPIKey ¶
func (a *AzureConfig) EmbedAPIKey() string
func (*AzureConfig) EmbedAPIVersion ¶
func (a *AzureConfig) EmbedAPIVersion() string
func (*AzureConfig) EmbedEndpoint ¶
func (a *AzureConfig) EmbedEndpoint() string
func (*AzureConfig) EmbedModel ¶
func (a *AzureConfig) EmbedModel() string
type AzureServiceConfig ¶
type CommunityConfig ¶
type Config ¶
type Config struct {
DataDir string `mapstructure:"data_dir"`
DefaultProject string `mapstructure:"default_project"`
LLM LLMConfig `mapstructure:"llm"`
Indexing IndexingConfig `mapstructure:"indexing"`
Community CommunityConfig `mapstructure:"community"`
Server ServerConfig `mapstructure:"server"`
Log LogConfig `mapstructure:"log"`
// Phase-5: per-project LLM overrides. Keyed by project slug.
// When a slug is missing from the map, callers fall back to the
// top-level LLM field. Not bound to env vars — configure via
// YAML only (env flat-string rewriting doesn't nest well).
LLMOverrides map[string]LLMConfig `mapstructure:"llm_overrides"`
}
func (*Config) LLMConfigForProject ¶
LLMConfigForProject returns the override for slug if present, otherwise the root LLM config. A missing or empty slug yields the root config. The Provider field is treated as the presence sentinel — a YAML block with no `provider:` key leaves Provider empty, so we treat that as "no override declared" and fall back to the root.
func (*Config) NotesDir ¶
NotesDir returns the per-project notes directory: $DATA_DIR/projects/<slug>/notes. Callers that actually intend to read or write notes should use os.MkdirAll on this path first — the config helper does not touch the filesystem.
func (*Config) ProjectDBPath ¶
ProjectDBPath returns the per-project SQLite path for the given slug: $DATA_DIR/projects/<slug>/docsiq.db. Does NOT validate the slug — callers should use project.IsValidSlug or store.OpenForProject (which performs the check) when the slug came from untrusted input.
func (*Config) Redact ¶ added in v0.1.0
Redact returns a deep copy of c with every string field tagged secret:"true" zeroed. The original c is not mutated. Safe for logging and for serializing config for introspection endpoints.
Nested structs are walked recursively. Slices, maps, and pointers to structs are supported, though config.Config uses only direct struct nesting today — the broader coverage is cheap insurance.
type IndexingConfig ¶
type IndexingConfig struct {
ChunkSize int `mapstructure:"chunk_size"`
ChunkOverlap int `mapstructure:"chunk_overlap"`
BatchSize int `mapstructure:"batch_size"`
Workers int `mapstructure:"workers"`
ExtractGraph bool `mapstructure:"extract_graph"`
ExtractClaims bool `mapstructure:"extract_claims"`
MaxGleanings int `mapstructure:"max_gleanings"`
}
type LLMConfig ¶
type LLMConfig struct {
Provider string `mapstructure:"provider"`
Azure AzureConfig `mapstructure:"azure"`
Ollama OllamaConfig `mapstructure:"ollama"`
OpenAI OpenAIConfig `mapstructure:"openai"`
// CallTimeout caps the end-to-end duration of a single provider
// call (Complete / Embed / EmbedBatch). Any retry wrapper counts
// against this deadline — the timeout is NOT reset between
// attempts. Zero disables the per-call cap (caller's ctx is
// authoritative). Default 60s. Block 3.3.
CallTimeout time.Duration `mapstructure:"call_timeout"`
}
type LogConfig ¶ added in v0.1.0
type LogConfig struct {
// Format chooses the slog handler. "text" (default) emits a
// human-readable single-line format with emoji prefixes; "json"
// strips emoji and emits machine-parseable JSON objects.
Format string `mapstructure:"format"`
}
LogConfig controls structured-log emission format. Lowest-priority source of truth — `--log-format` flag and `DOCSIQ_LOG_FORMAT` env var both outrank this value in cmd/root.go.
type OllamaConfig ¶
type OpenAIConfig ¶
type OpenAIConfig struct {
APIKey string `mapstructure:"api_key" secret:"true"`
BaseURL string `mapstructure:"base_url"`
ChatModel string `mapstructure:"chat_model"`
EmbedModel string `mapstructure:"embed_model"`
Organization string `mapstructure:"organization"`
}
OpenAIConfig configures the direct OpenAI (api.openai.com) provider, as opposed to Azure OpenAI which lives on AzureConfig. Env vars:
DOCSIQ_LLM_OPENAI_API_KEY — API key (required)
DOCSIQ_LLM_OPENAI_BASE_URL — override for proxies / gateways
DOCSIQ_LLM_OPENAI_CHAT_MODEL — chat model, default gpt-4o-mini
DOCSIQ_LLM_OPENAI_EMBED_MODEL — embedding model, default
text-embedding-3-small
DOCSIQ_LLM_OPENAI_ORGANIZATION — optional org header
type ServerConfig ¶
type ServerConfig struct {
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
APIKey string `mapstructure:"api_key" secret:"true"`
MaxUploadBytes int64 `mapstructure:"max_upload_bytes"` // 0 or negative disables the cap
WorkqWorkers int `mapstructure:"workq_workers"` // 0 → runtime.NumCPU()
WorkqDepth int `mapstructure:"workq_depth"` // 0 → 64
HSTSEnabled bool `mapstructure:"hsts_enabled"` // emits Strict-Transport-Security when true
// RequestTimeout caps the duration of every HTTP handler except
// the carve-outs listed in isUploadRoute. Block 3.2 default 30s.
// Zero disables the cap (not recommended in production).
RequestTimeout time.Duration `mapstructure:"request_timeout"`
// UploadTimeout caps long-running upload / import endpoints
// (POST /api/upload, POST /api/projects/{project}/import). Block
// 3.2 default 10m.
UploadTimeout time.Duration `mapstructure:"upload_timeout"`
}