toolbot

package
v0.0.0-...-3e6eb1a Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSVExporter

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

CSVExporter is an exporter that writes CSV files for each tool.

func NewCSVExporter

func NewCSVExporter(extractor Extractor, enhancers ...Enhancer) (*CSVExporter, error)

NewCSVExporter creates a new CSVExporter.

func (*CSVExporter) BuildDataPoints

func (x *CSVExporter) BuildDataPoints(ctx context.Context, src []byte) ([]*DataPoint, error)

BuildDataPoints extracts data points from a byte slice representing a Go file.

func (*CSVExporter) EnhanceDataPoint

func (x *CSVExporter) EnhanceDataPoint(ctx context.Context, d *DataPoint) error

EnhanceDataPoint enhances a data point by running all the registered enhancers.

func (*CSVExporter) RunGemini

func (x *CSVExporter) RunGemini(ctx context.Context, input *DataPoint, out io.Writer) error

RunGemini runs a prompt against Gemini, generating context based on the source code.

func (*CSVExporter) VisitCodeDir

func (x *CSVExporter) VisitCodeDir(ctx context.Context, srcDir string) error

VisitCodeDir visits a directory and extracts data points from all Go files in the directory tree.

func (*CSVExporter) WriteCSVForAllTools

func (x *CSVExporter) WriteCSVForAllTools(ctx context.Context, outputDir string) error

WriteCSVForAllTools writes CSV files for all tools.

type DataPoint

type DataPoint struct {
	Type   string
	Input  map[string]string
	Output string
}

DataPoint holds the input and output for a tool.

func (*DataPoint) AddCSVColumns

func (p *DataPoint) AddCSVColumns(columnSet sets.Set[string])

AddCSVColumns adds the columns for the data point to the columnSet.

func (*DataPoint) SetInput

func (p *DataPoint) SetInput(k, v string)

SetInput sets an input value for the data point.

func (*DataPoint) ToGenAIParts

func (p *DataPoint) ToGenAIParts() []genai.Part

ToGenAIParts converts the data point to the input format for Gemini.

func (*DataPoint) WriteCSV

func (p *DataPoint) WriteCSV(csvWriter *csv.Writer, columns []string) error

WriteCSV writes the data point to the CSV writer.

type EnhanceWithProtoDefinition

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

EnhanceWithProtoDefinition is an enhancer that adds the definition of a proto message or service to the data point.

func NewEnhanceWithProtoDefinition

func NewEnhanceWithProtoDefinition(protoDirectory string) (*EnhanceWithProtoDefinition, error)

NewEnhanceWithProtoDefinition creates a new EnhanceWithProtoDefinition.

func (*EnhanceWithProtoDefinition) EnhanceDataPoint

func (x *EnhanceWithProtoDefinition) EnhanceDataPoint(ctx context.Context, p *DataPoint) error

EnhanceDataPoint enhances the data point by adding the definition of the proto message or service.

type Enhancer

type Enhancer interface {
	EnhanceDataPoint(ctx context.Context, d *DataPoint) error
}

Enhancer is an interface for enhancing a data point. For example, it might add a computed field to the data point, such as the definition of a proto message, given the name of the proto message.

type ExtractToolMarkers

type ExtractToolMarkers struct {
}

ExtractToolMarkers extracts tool markers from source code.

func (*ExtractToolMarkers) Extract

func (x *ExtractToolMarkers) Extract(ctx context.Context, src []byte) ([]*DataPoint, error)

Extract extracts tool markers from source code.

type Extractor

type Extractor interface {
	Extract(ctx context.Context, b []byte) ([]*DataPoint, error)
}

Extractor is an interface for extracting data points from source code.

Jump to

Keyboard shortcuts

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