llm

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 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 CodeExample

type CodeExample struct {
	FilePath    string `json:"file_path"`
	Function    string `json:"function"`
	Code        string `json:"code"`
	Description string `json:"description"`
	LineStart   int    `json:"line_start"`
	LineEnd     int    `json:"line_end"`
}

CodeExample represents a code example with context

type Context

type Context struct {
	ProjectID        string              `json:"project_id"`
	Summary          *ProjectSummary     `json:"summary"`
	RelevantNodes    []core.Node         `json:"relevant_nodes"`
	Relationships    []core.Relationship `json:"relationships"`
	CodeExamples     []CodeExample       `json:"code_examples"`
	QuerySuggestions []string            `json:"query_suggestions"`
}

Context represents context information for LLMs

type ContextGenerator

type ContextGenerator interface {
	GenerateContext(ctx context.Context, projectID string, query string) (*Context, error)
	GetProjectSummary(ctx context.Context, projectID string) (*ProjectSummary, error)
}

ContextGenerator generates context for LLMs from graph data

type CypherQuery

type CypherQuery struct {
	Query       string         `json:"query"`
	Parameters  map[string]any `json:"parameters"`
	Description string         `json:"description"`
	Confidence  float64        `json:"confidence"`
}

CypherQuery represents a translated Cypher query

type CypherTranslator

type CypherTranslator interface {
	Translate(ctx context.Context, query string, schema string) (*CypherQuery, error)
	GetSchema(ctx context.Context, projectID string) (string, error)
}

CypherTranslator translates natural language to Cypher queries

type CypherTranslatorConfig

type CypherTranslatorConfig struct {
	APIKey string
	Model  string
}

CypherTranslatorConfig holds configuration for the translator

type DefaultContextGenerator

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

DefaultContextGenerator implements ContextGenerator

func NewDefaultContextGenerator

func NewDefaultContextGenerator(graphService graph.Service) *DefaultContextGenerator

NewDefaultContextGenerator creates a new context generator

func (*DefaultContextGenerator) GenerateContext

func (g *DefaultContextGenerator) GenerateContext(
	ctx context.Context,
	projectID string,
	query string,
) (*Context, error)

GenerateContext generates context information for LLMs

func (*DefaultContextGenerator) GetProjectSummary

func (g *DefaultContextGenerator) GetProjectSummary(ctx context.Context, projectID string) (*ProjectSummary, error)

GetProjectSummary generates a high-level project summary

type OpenAICypherTranslator

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

OpenAICypherTranslator implements CypherTranslator using OpenAI

func NewOpenAICypherTranslator

func NewOpenAICypherTranslator(config CypherTranslatorConfig, graphService graph.Service) *OpenAICypherTranslator

NewOpenAICypherTranslator creates a new OpenAI-based Cypher translator

func (*OpenAICypherTranslator) GetSchema

func (t *OpenAICypherTranslator) GetSchema(ctx context.Context, projectID string) (string, error)

GetSchema retrieves the graph schema for a project

func (*OpenAICypherTranslator) Translate

func (t *OpenAICypherTranslator) Translate(ctx context.Context, query string, schema string) (*CypherQuery, error)

Translate converts natural language to Cypher query

type ProjectSummary

type ProjectSummary struct {
	Name           string         `json:"name"`
	TotalFiles     int            `json:"total_files"`
	TotalPackages  int            `json:"total_packages"`
	TotalFunctions int            `json:"total_functions"`
	MainPackages   []string       `json:"main_packages"`
	Dependencies   map[string]int `json:"dependencies"`
	Metrics        map[string]any `json:"metrics"`
}

ProjectSummary represents a high-level summary of a project

Jump to

Keyboard shortcuts

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