Documentation
¶
Index ¶
- type ChatMessageType
- type CodeChunk
- type CodeChunkingOptions
- type CodeEntityDefinition
- type CodeSymbol
- type ContentChoice
- type ContentPart
- type ContentResponse
- type Document
- type FileMetadata
- type MessageContent
- type ModelDetails
- type NoOpReranker
- type OutputParser
- type ParserPlugin
- type Reranker
- type Retriever
- type ScoredDocument
- type SparseVector
- type StringParser
- type TextContent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatMessageType ¶
type ChatMessageType string
const ( ChatMessageTypeSystem ChatMessageType = "system" ChatMessageTypeHuman ChatMessageType = "human" ChatMessageTypeAI ChatMessageType = "ai" ChatMessageTypeGeneric ChatMessageType = "generic" )
type CodeChunk ¶
type CodeChunk struct {
Content string `json:"content"`
LineStart int `json:"lineStart"`
LineEnd int `json:"lineEnd"`
Type string `json:"type"`
Identifier string `json:"identifier"`
Annotations map[string]string `json:"annotations"`
TokenCount int `json:"tokenCount"`
EnrichedContent string `json:"enrichedContent"`
ParentContext string `json:"parentContext"`
ContextLevel int `json:"contextLevel"`
Sparse *SparseVector `json:"sparse,omitempty"`
// ParentID uniquely identifies the parent code structure (function/class) this chunk belongs to.
// Empty for top-level chunks that are not split.
ParentID string `json:"parentID,omitempty"`
// FullParentText contains the complete text of the parent structure.
// WARNING: This can be large. Logic should truncate this before storage.
FullParentText string `json:"fullParentText,omitempty"`
// IsDefinition is true if this chunk represents the primary source-of-truth definition of a symbol.
IsDefinition bool `json:"is_definition"`
// SymbolType is the category of the symbol (e.g., struct, interface, function).
SymbolType string `json:"symbol_type"`
}
type CodeChunkingOptions ¶
type CodeEntityDefinition ¶
type CodeSymbol ¶
type ContentChoice ¶ added in v0.2.0
type ContentPart ¶
type ContentPart interface {
String() string
// contains filtered or unexported methods
}
type ContentResponse ¶ added in v0.2.0
type ContentResponse struct {
Choices []*ContentChoice
}
type Document ¶
type Document struct {
PageContent string
Metadata map[string]any
Sparse *SparseVector
}
type FileMetadata ¶
type FileMetadata struct {
FilePath string `json:"file_path"`
Language string `json:"language"`
PackageName string `json:"package_name"`
Imports []string `json:"imports"`
Definitions []CodeEntityDefinition `json:"definitions"`
Symbols []CodeSymbol `json:"symbols"`
Properties map[string]string `json:"properties"`
}
type MessageContent ¶
type MessageContent struct {
Role ChatMessageType
Parts []ContentPart
}
func NewAIMessage ¶
func NewAIMessage(text string) MessageContent
func NewHumanMessage ¶
func NewHumanMessage(text string) MessageContent
func NewSystemMessage ¶
func NewSystemMessage(text string) MessageContent
func NewTextMessage ¶
func NewTextMessage(role ChatMessageType, text string) MessageContent
func (MessageContent) GetTextContent ¶
func (mc MessageContent) GetTextContent() string
func (MessageContent) String ¶
func (mc MessageContent) String() string
type ModelDetails ¶
func (ModelDetails) String ¶
func (md ModelDetails) String() string
type NoOpReranker ¶ added in v0.15.0
type NoOpReranker struct{}
NoOpReranker returns documents in their original order with a constant high score.
func (NoOpReranker) Rerank ¶ added in v0.15.0
func (n NoOpReranker) Rerank(_ context.Context, _ string, docs []Document) ([]ScoredDocument, error)
type OutputParser ¶ added in v0.15.0
OutputParser converts raw LLM text output into a structured type.
type ParserPlugin ¶
type ParserPlugin interface {
Name() string
Extensions() []string
CanHandle(path string, info fs.FileInfo) bool
Chunk(content string, path string, opts *CodeChunkingOptions) ([]CodeChunk, error)
ExtractMetadata(content string, path string) (FileMetadata, error)
IsGenerated(content string, path string) bool
// ExtractUsedSymbols identifies potential external types/functions
// being used in the code that might need a definition lookup.
ExtractUsedSymbols(content string) []string
}
type ScoredDocument ¶ added in v0.15.0
type SparseVector ¶ added in v0.15.0
type StringParser ¶ added in v0.15.0
type StringParser struct{}
StringParser is an identity parser that returns the raw LLM output as-is.
type TextContent ¶
type TextContent struct {
Text string
}
func (TextContent) String ¶
func (tc TextContent) String() string
Click to show internal directories.
Click to hide internal directories.