core

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generative

type Generative interface {
	// Completion generates a completion based on the provided content.
	// It takes a context and a string as input and returns a Response pointer and an error.
	Completion(ctx context.Context, content string) (resp *Response, err error)

	// GetSummaryPrefix generates a summary prefix based on the provided content.
	// It takes a context and a string as input and returns a Response pointer and an error.
	GetSummaryPrefix(ctx context.Context, content string) (resp *Response, err error)
}

Generative defines an interface for generative AI operations. It includes methods for creating completions and obtaining summary prefixes.

type Platform

type Platform string

Platform represents a type for different AI platforms.

const (
	// OpenAI represents the OpenAI platform.
	OpenAI Platform = "openai"
	// Azure represents the Azure platform.
	Azure Platform = "azure"
	// Gemini represents the Gemini platform.
	Gemini Platform = "gemini"
	// Anthropic represents the Anthropic platform.
	Anthropic Platform = "anthropic"
)

func (Platform) IsValid

func (p Platform) IsValid() bool

IsValid returns true if the Platform is valid.

func (Platform) String

func (p Platform) String() string

String returns the string representation of the Platform.

type Response

type Response struct {
	Content string
	Usage   Usage
}

Response represents the structure of a response from the OpenAI API. It contains the content of the response and the usage information.

type Usage

type Usage struct {
	PromptTokens            int
	CompletionTokens        int
	TotalTokens             int
	PromptTokensDetails     *openai.PromptTokensDetails
	CompletionTokensDetails *openai.CompletionTokensDetails
}

Usage represents the token usage statistics for a given request. It includes counts for the prompt tokens, the completion tokens, and the overall total tokens. In addition, it may provide detailed breakdowns for both prompt and completion tokens, allowing for deeper insights into token distribution if the corresponding details are available.

func (Usage) String added in v0.16.0

func (u Usage) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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