Documentation
¶
Overview ¶
Package resolve answers queries against an index through swappable resolvers. The keyword resolver needs no LLM. The LLM resolver retrieves candidates with the keyword index, then asks a local model to rank them and write a short recommendation, grounded so it cannot invent people or channels.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfidenceLabel ¶ added in v0.1.8
ConfidenceLabel names a confidence value for display: strong, moderate, or weak. It returns the empty string for zero, when confidence is unknown.
Types ¶
type Answer ¶
type Answer struct {
// People is the ranked list of people to talk to.
People []model.Match
// Channels is the ranked list of places to ask.
Channels []model.ChannelMatch
// Summary is a short written recommendation; empty in keyword mode.
Summary string
}
Answer is a resolved response: ranked people, ranked channels, and an optional written summary that the LLM resolver fills in.
func (Answer) View ¶
func (a Answer) View(query string) JSONAnswer
View renders the answer as a flat JSONAnswer for the given query.
type Chatter ¶
type Chatter interface {
// Chat returns the model's reply to the system and user messages.
Chat(ctx context.Context, system, user string) (string, error)
}
Chatter sends a system and user prompt to a model and returns its reply. The llm package's Ollama client satisfies it.
type Embedder ¶
type Embedder interface {
// Embed returns the embedding vector for text.
Embed(ctx context.Context, text string) ([]float32, error)
}
Embedder turns text into a vector for semantic retrieval. The llm package's Ollama client satisfies it.
type JSONAnswer ¶
type JSONAnswer struct {
// Query echoes the question asked.
Query string `json:"query,omitempty"`
// Summary is the written recommendation, present in LLM mode.
Summary string `json:"summary,omitempty"`
// People is the ranked list of people to talk to.
People []JSONPerson `json:"people"`
// Channels is the ranked list of places to ask.
Channels []JSONChannel `json:"channels,omitempty"`
}
JSONAnswer is a flat, JSON-friendly view of an Answer, shared by the CLI and the web server so both emit the same shape.
type JSONChannel ¶
type JSONChannel struct {
// Name is the channel name.
Name string `json:"name"`
// Topic is the channel's stated topic.
Topic string `json:"topic,omitempty"`
// Score is the relevance score.
Score float64 `json:"score"`
// Confidence estimates how trustworthy the match is, from zero to one.
// Zero means unknown and is omitted.
Confidence float64 `json:"confidence,omitempty"`
// Reasons explains why the channel matched.
Reasons []string `json:"reasons,omitempty"`
// Members are the most relevant people active in the channel.
Members []JSONMember `json:"members,omitempty"`
}
JSONChannel is one ranked channel.
type JSONMember ¶
type JSONMember struct {
// Name is the member's display name.
Name string `json:"name"`
// Email is the member's work email.
Email string `json:"email,omitempty"`
}
JSONMember is one active channel member.
type JSONPerson ¶
type JSONPerson struct {
// ID is the person's canonical identifier, the stable target for feedback.
ID string `json:"id"`
// Name is the person's display name.
Name string `json:"name"`
// Email is the person's work email.
Email string `json:"email,omitempty"`
// Title is the person's job title.
Title string `json:"title,omitempty"`
// Team is the person's team name.
Team string `json:"team,omitempty"`
// Identities lists alternate identifiers merged into this person, such as
// a GitHub login joined to an email.
Identities []string `json:"identities,omitempty"`
// Topics are the person's strongest expertise areas, strongest first.
Topics []string `json:"topics,omitempty"`
// Score is the relevance score.
Score float64 `json:"score"`
// Confidence estimates how trustworthy the match is, from zero to one.
// Zero means unknown and is omitted.
Confidence float64 `json:"confidence,omitempty"`
// Reasons explains why the person matched.
Reasons []string `json:"reasons,omitempty"`
}
JSONPerson is one ranked person.
type JSONProfile ¶ added in v0.1.15
type JSONProfile struct {
// ID is the person's canonical identifier.
ID string `json:"id"`
// Name is the person's display name.
Name string `json:"name"`
// Email is the person's work email.
Email string `json:"email,omitempty"`
// Title is the person's job title.
Title string `json:"title,omitempty"`
// Team is the person's team name.
Team string `json:"team,omitempty"`
// Org is the person's organization name.
Org string `json:"org,omitempty"`
// Manager is the person's manager, if known.
Manager *JSONMember `json:"manager,omitempty"`
// Identities lists alternate identifiers merged into this person.
Identities []string `json:"identities,omitempty"`
// Channels lists the channels the person is active in.
Channels []string `json:"channels,omitempty"`
// Topics are the person's expertise areas, strongest first.
Topics []string `json:"topics,omitempty"`
}
JSONProfile is the full picture of one person, for the profile view.
func ProfileView ¶ added in v0.1.15
func ProfileView(p index.Profile) JSONProfile
ProfileView renders a profile for the web and CLI.
type Keyword ¶
type Keyword struct {
// contains filtered or unexported fields
}
Keyword is a non-LLM resolver that ranks by keyword and affinity scoring over the index. It needs no external services.
func NewKeyword ¶
NewKeyword returns a Keyword resolver over ix. It panics if ix is nil.
type LLM ¶
type LLM struct {
// contains filtered or unexported fields
}
LLM is a resolver that retrieves candidates with the keyword index, then asks a model to rank them and summarize. It stays grounded: model output is matched back to retrieved candidates and anything invented is dropped. In redacted mode, built for cloud models under the redacted policy, candidates leave the machine as numbered roles with no names or emails, the model returns numbers, and the summary is written locally.
func NewLLM ¶
NewLLM returns an LLM resolver. The embedder may be nil, in which case candidates are retrieved by keyword. It panics if ix or chat is nil.
func NewRedactedLLM ¶ added in v0.1.17
NewRedactedLLM returns an LLM resolver that never sends names, emails, or message text to the model: candidates go out as numbered roles, and the written summary is composed locally. Use it with cloud providers under the redacted policy.
type Resolver ¶
type Resolver interface {
// Resolve ranks up to limit people and channels for query.
Resolve(ctx context.Context, query string, limit int) (Answer, error)
}
Resolver answers a natural-language query.
type ResolverFunc ¶
ResolverFunc adapts a function to the Resolver interface.
type Semantic ¶
type Semantic struct {
// contains filtered or unexported fields
}
Semantic is a resolver that ranks purely by embedding similarity. It needs an embedder and an index built with embeddings; it uses no chat model.
func NewSemantic ¶
NewSemantic returns a Semantic resolver. It panics if ix or embedder is nil.