Documentation
¶
Overview ¶
Package rag — v0.8.438 doküman soru-cevap (RAG) servisi.
Deterministik "prefetch + narrate" deseninin retrieval'lı hali: bu paket soruyu embed eder, ClickHouse'tan en yakın chunk'ları çeker ve Copilot chat'ine hazır bir bağlam bloğu üretir; 2B model yalnız anlatır (tool-loop yok). Embedding, OpenAI-uyumlu /v1/embeddings sunan herhangi bir endpoint'ten gelir (vLLM/KServe'deki bge-m3 gibi) ve TAMAMEN config-gated'dir: endpoint girilmemişse Ready()=false ve chat bugünkü gibi RAG'siz çalışır — sessiz, dürüst degrade.
Index ¶
- func ChunkText(text string) []string
- func NewHTTPClient(timeout time.Duration, insecureSkipVerify bool) *http.Client
- type Config
- type CrawlSource
- type CrawledPage
- type Service
- func (s *Service) Configure(c Config)
- func (s *Service) EffectiveTopK() int
- func (s *Service) Embed(ctx context.Context, texts []string) ([][]float32, error)
- func (s *Service) LoadPersisted(ctx context.Context, store SettingsStore) error
- func (s *Service) Ready() bool
- func (s *Service) SavePersisted(ctx context.Context, store SettingsStore, c Config) error
- func (s *Service) Snapshot() Config
- func (s *Service) StartConfigRefresh(ctx context.Context, store SettingsStore, interval time.Duration)
- type SettingsStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Endpoint string `json:"endpoint"` // ör. http://bge-m3.ai.svc:8000/v1
Model string `json:"model"` // ör. BAAI/bge-m3
APIKey string `json:"apiKey,omitempty"` // opsiyonel — asla geri echo edilmez
Enabled bool `json:"enabled"`
TopK int `json:"topK,omitempty"` // 0 → 5
// InsecureSkipVerify (v0.9.23) — operatör-raporlu prod bug'ı:
// air-gapped kurulumda embedding endpoint'i (vLLM/KServe) ve iç
// wiki'ler self-signed sertifikayla koşuyor; upload chunk+embed
// adımında TLS doğrulamasına takılıyordu. Tempo/Zoom deseninin
// aynısı; varsayılan kapalı.
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"`
// Sources (v0.8.442) — wiki/URL kaynakları; 30 dk'lık senkron
// tick'i her kaynağı sınırlı crawl edip hash-diff'le indeksler.
Sources []CrawlSource `json:"sources,omitempty"`
}
Config — rag_embedding system_settings blob'u (invariant #6).
type CrawlSource ¶ added in v0.8.442
type CrawlSource struct {
URL string `json:"url"`
AuthHeader string `json:"authHeader,omitempty"` // "Header: value" — asla geri echo edilmez
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
}
CrawlSource — Settings'ten gelen tek kaynak tanımı.
Auth iki yoldan biri (ikisi de doluysa AuthHeader kazanır):
- AuthHeader: "Header: value" ham başlık (token tabanlı wiki'ler).
- Username/Password: HTTP Basic (v0.8.451 — operatörün on-prem Azure DevOps wiki'si; PAT kullanımında kullanıcı adı boş, PAT şifre alanına). Password asla geri echo edilmez.
type CrawledPage ¶ added in v0.8.442
type CrawledPage struct {
URL string
Title string
Text string
Hash string // sha256(Text) hex — diff senkronun anahtarı
}
CrawledPage — bir sayfanın çıkarılmış hali.
func Crawl ¶ added in v0.8.442
func Crawl(ctx context.Context, httpc *http.Client, src CrawlSource) ([]CrawledPage, error)
Crawl — kaynak URL'den başlayıp aynı host+prefix altında BFS. ctx iptali anında durur; hata tek sayfayı atlatır, taramayı öldürmez.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) EffectiveTopK ¶
func (*Service) LoadPersisted ¶
func (s *Service) LoadPersisted(ctx context.Context, store SettingsStore) error
LoadPersisted / SavePersisted — copilot.Service'in birebir deseni.
func (*Service) SavePersisted ¶
func (*Service) StartConfigRefresh ¶
func (s *Service) StartConfigRefresh(ctx context.Context, store SettingsStore, interval time.Duration)
StartConfigRefresh — multi-pod senkronu (copilot deseninin aynısı).