Documentation
¶
Index ¶
- Constants
- func DetachContext(ctx context.Context) context.Context
- func EstimateTokens(text string) int
- func IsCJK(r rune) bool
- type ChannelType
- type Confidence
- type ContentCallback
- type EmbedCallback
- type Enum
- type FeatureStatus
- type MessageRole
- type ProviderType
- type RPCSenderFunc
- type ReputationQuerier
- type Triple
- type TripleCallback
Constants ¶
const DIDPrefix = "did:lango:"
DIDPrefix is the method-specific prefix for Lango v1 DIDs.
const DIDv2Prefix = "did:lango:v2:"
DIDv2Prefix is the method-specific prefix for Lango v2 DIDs (content-addressed).
Variables ¶
This section is empty.
Functions ¶
func DetachContext ¶
DetachContext returns a new context that is independent of the parent's cancellation and deadline but preserves all context values. Use this when spawning long-running goroutines that must not be cancelled when the originating request completes.
func EstimateTokens ¶
EstimateTokens returns a character-based token count approximation. ASCII/Latin characters are counted as 1 token per 4 characters. CJK characters (Chinese, Japanese, Korean) are counted as 1 token per 2 characters.
Types ¶
type ChannelType ¶
type ChannelType string
ChannelType represents a messaging platform channel type.
const ( ChannelTelegram ChannelType = "telegram" ChannelDiscord ChannelType = "discord" ChannelSlack ChannelType = "slack" )
func (ChannelType) Valid ¶
func (c ChannelType) Valid() bool
Valid reports whether c is a known channel type.
func (ChannelType) Values ¶
func (c ChannelType) Values() []ChannelType
Values returns all known channel types.
type Confidence ¶
type Confidence string
Confidence represents a confidence level for analysis results.
const ( ConfidenceHigh Confidence = "high" ConfidenceMedium Confidence = "medium" ConfidenceLow Confidence = "low" )
func (Confidence) Valid ¶
func (c Confidence) Valid() bool
Valid reports whether c is a known confidence level.
func (Confidence) Values ¶
func (c Confidence) Values() []Confidence
Values returns all known confidence levels.
type ContentCallback ¶
ContentCallback is an optional hook called when content is saved, enabling asynchronous processing without importing external packages.
type EmbedCallback ¶
EmbedCallback is an optional hook called when content is saved, enabling asynchronous embedding without importing the embedding package.
type Enum ¶
Enum defines a common interface for typed enum values. Each enum type should implement Valid() and Values() as value receiver methods.
type FeatureStatus ¶ added in v0.7.0
type FeatureStatus struct {
// Name is the human-readable feature name (e.g., "Embedding & RAG").
Name string `json:"name"`
// Enabled indicates whether the feature is active.
Enabled bool `json:"enabled"`
// Healthy indicates whether the feature initialized without errors.
Healthy bool `json:"healthy"`
// AutoEnabled indicates the feature was auto-enabled (not explicitly configured).
AutoEnabled bool `json:"autoEnabled,omitempty"`
// Reason explains why the feature is disabled or unhealthy (empty when OK).
Reason string `json:"reason,omitempty"`
// Suggestion provides an actionable next step for the user (empty when OK).
Suggestion string `json:"suggestion,omitempty"`
}
FeatureStatus describes the initialization state of a subsystem feature. Used by doctor checks, status command, and TUI for structured diagnostics.
type MessageRole ¶
type MessageRole string
MessageRole represents the role of a message participant.
const ( RoleUser MessageRole = "user" RoleAssistant MessageRole = "assistant" RoleTool MessageRole = "tool" RoleFunction MessageRole = "function" RoleModel MessageRole = "model" )
func (MessageRole) Normalize ¶
func (r MessageRole) Normalize() MessageRole
Normalize converts legacy role names to their canonical forms. "model" becomes "assistant", "function" becomes "tool". All other roles are returned as-is.
func (MessageRole) Valid ¶
func (r MessageRole) Valid() bool
Valid reports whether r is a known message role.
func (MessageRole) Values ¶
func (r MessageRole) Values() []MessageRole
Values returns all known message roles.
type ProviderType ¶
type ProviderType string
ProviderType represents an LLM provider type.
const ( ProviderOpenAI ProviderType = "openai" ProviderAnthropic ProviderType = "anthropic" ProviderGemini ProviderType = "gemini" ProviderGoogle ProviderType = "google" ProviderOllama ProviderType = "ollama" ProviderGitHub ProviderType = "github" )
func (ProviderType) Valid ¶
func (p ProviderType) Valid() bool
Valid reports whether p is a known provider type.
func (ProviderType) Values ¶
func (p ProviderType) Values() []ProviderType
Values returns all known provider types.
type RPCSenderFunc ¶
RPCSenderFunc defines how to send an RPC request to a remote provider.
type ReputationQuerier ¶ added in v0.7.0
ReputationQuerier queries peer trust scores. The score is in [0, 1].
type TripleCallback ¶
type TripleCallback func(triples []Triple)
TripleCallback is an optional hook for saving graph triples.