core

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2025 License: MIT Imports: 2 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
const (
	OpenAI    Platform = "openai"
	Azure     Platform = "azure"
	Gemini    Platform = "gemini"
	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
	CompletionTokensDetails *openai.CompletionTokensDetails
}

Usage represents the token usage details for an OpenAI API request. It includes the number of tokens used for the prompt, the completion, and the total tokens used. Additionally, it may include detailed information about the completion tokens.

Jump to

Keyboard shortcuts

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