model

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: MIT Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseModelID added in v1.0.2

func ParseModelID(modelIDWithAttributes string) (modelID string, attributes map[string]string)

ParseModelID takes a packaged model ID with optional attributes and converts it into its model ID and optional attributes.

Types

type CapabilityMigrate added in v1.0.0

type CapabilityMigrate interface {
	// Migrate queries the model to migrate source code.
	Migrate(ctx Context) (assessments metrics.Assessments, err error)
}

CapabilityMigrate defines the capability of a model to migrate code.

type CapabilityRepairCode added in v0.6.0

type CapabilityRepairCode interface {
	// RepairCode queries the model to repair a source code with compilation error.
	RepairCode(ctx Context) (assessments metrics.Assessments, err error)
}

CapabilityRepairCode defines the capability of a model to repair code.

type CapabilityTranspile added in v0.6.0

type CapabilityTranspile interface {
	// Transpile queries the model to transpile source code to another language.
	Transpile(ctx Context) (assessments metrics.Assessments, err error)
}

CapabilityTranspile defines the capability of a model to transpile code.

type CapabilityWriteTests added in v0.6.0

type CapabilityWriteTests interface {
	// WriteTests generates test files for the given implementation file in a repository.
	WriteTests(ctx Context) (assessments metrics.Assessments, err error)
}

CapabilityWriteTests defines the capability of a model to generate tests.

type Context added in v0.6.0

type Context struct {
	// Language holds the language for which the task should be evaluated.
	Language language.Language

	// RepositoryPath holds the absolute path to the repository.
	RepositoryPath string
	// FilePath holds the path to the file the model should act on.
	FilePath string

	// Arguments holds extra data that can be used in a query prompt.
	Arguments any

	// Logger is used for logging during evaluation.
	Logger *log.Logger
}

Context holds the data needed by a model for running a task.

type MetaInformation added in v0.6.1

type MetaInformation struct {
	// ID holds the model ID.
	ID string `json:"id"`
	// Name holds the model name.
	Name string `json:"name"`

	// Pricing holds the pricing information of a model.
	Pricing Pricing `json:"pricing"`
}

MetaInformation holds a model.

type Model

type Model interface {
	// ID returns full identifier, including the provider and attributes.
	ID() (id string)
	// ModelID returns the unique identifier of this model with its provider.
	ModelID() (modelID string)
	// ModelIDWithoutProvider returns the unique identifier of this model without its provider.
	ModelIDWithoutProvider() (modelID string)

	// Attributes returns query attributes.
	Attributes() (attributes map[string]string)
	// SetAttributes sets the given attributes.
	SetAttributes(attributes map[string]string)

	// MetaInformation returns the meta information of a model.
	MetaInformation() *MetaInformation

	// Clone returns a copy of the model.
	Clone() (clone Model)
}

Model defines a model that can be queried for generations.

type Pricing added in v0.6.1

type Pricing struct {
	// Prompt holds the price for a prompt in dollars per token.
	Prompt float64 `json:"prompt,string"`
	// Completion holds the price for a completion in dollars per token.
	Completion float64 `json:"completion,string"`
	// Request holds the price for a request in dollars per request.
	Request float64 `json:"request,string"`
	// Image holds the price for an image in dollars per token.
	Image float64 `json:"image,string"`
}

Pricing holds the pricing information of a model.

type SetQueryAttempts added in v0.5.0

type SetQueryAttempts interface {
	// SetQueryAttempts sets the number of query attempts to perform when a model request errors in the process of solving a task.
	SetQueryAttempts(attempts uint)
}

SetQueryAttempts defines a model that can set the number of query attempts when a model request errors in the process of solving a task.

Directories

Path Synopsis
llm

Jump to

Keyboard shortcuts

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