ai

package
v0.0.1-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

type Chain struct {
	// contains filtered or unexported fields
}

Chain handles AI operations on code

func NewChain

func NewChain(idx *indexer.Indexer, provider llm.Provider) *Chain

NewChain creates a new AI chain

func (*Chain) AnalyzeEntity

func (c *Chain) AnalyzeEntity(ctx context.Context, entityName string) (string, error)

AnalyzeEntity provides detailed analysis of a specific entity

func (*Chain) Chat

func (c *Chain) Chat(ctx context.Context, conversation *ConversationContext, userMessage string) (string, error)

Chat enables multi-turn conversation about code

func (*Chain) GenerateDocs

func (c *Chain) GenerateDocs(ctx context.Context, entityName string) (string, error)

GenerateDocs generates documentation for an entity

func (*Chain) GenerateProjectDocs

func (c *Chain) GenerateProjectDocs(ctx context.Context, promptInstruction string, progressFn func(string)) (string, error)

GenerateProjectDocs generates AI-assisted documentation for every file in the project. All entities of a file are batched into a single prompt so the number of API calls equals the number of indexed files.

promptInstruction shapes the documentation style and is used as the system message. When empty a default technical-writing instruction is used.

progressFn (optional) is called with each file path just before its API call so the caller can print progress.

func (*Chain) QueryNatural

func (c *Chain) QueryNatural(ctx context.Context, query string) (string, error)

QueryNatural performs a natural language query on the code graph

func (*Chain) ReviewCode

func (c *Chain) ReviewCode(ctx context.Context, entityName string) (string, error)

ReviewCode provides code review and suggestions

func (*Chain) Summarize

func (c *Chain) Summarize(ctx context.Context, filePath string) (string, error)

Summarize generates a summary of a file or entity

type ChainType

type ChainType string

ChainType represents the type of AI chain

const (
	ChainNLQuery      ChainType = "nl_query"
	ChainAnalyze      ChainType = "analyze"
	ChainGenerateDocs ChainType = "generate_docs"
	ChainCodeReview   ChainType = "code_review"
	ChainSummarize    ChainType = "summarize"
)

type ConversationContext

type ConversationContext struct {
	Messages   []*Message
	EntityID   int64
	EntityName string
	FilePath   string
}

ConversationContext holds conversation state

type Message

type Message struct {
	Role    string // "system", "user", "assistant"
	Content string
}

Message represents a conversation message

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL