v1

package
v0.0.0-...-f03bf9e Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatChoice

type ChatChoice struct {
	Index        int               `json:"index"`
	Message      map[string]string `json:"message"`
	FinishReason string            `json:"finish_reason"`
}

type ChatResult

type ChatResult struct {
	Id      string         `json:"id"`
	Object  string         `json:"object"`
	Created int            `json:"created"`
	Model   string         `json:"model"`
	Choices []ChatChoice   `json:"choices"`
	Usage   map[string]int `json:"usage,omitempty"`
}

type ChatStreamChoice

type ChatStreamChoice struct {
	Index        int               `json:"index"`
	Delta        map[string]string `json:"delta"`
	FinishReason string            `json:"finish_reason,omitempty"`
}

type ChatStreamResult

type ChatStreamResult struct {
	Id      string             `json:"id"`
	Object  string             `json:"object"`
	Created int                `json:"created"`
	Model   string             `json:"model"`
	Choices []ChatStreamChoice `json:"choices"`
}

type EmbeddingData

type EmbeddingData struct {
	Object    string    `json:"object"`
	Embedding []float32 `json:"embedding"`
	Index     int       `json:"index"`
}

type EmbeddingResult

type EmbeddingResult struct {
	Object string       `json:"object"`
	Data   []Embeddings `json:"data"`
	Model  string       `json:"model"`
	Usage  Usage        `json:"usage"`
}

type Embeddings

type Embeddings struct {
	Embedding []float32 `json:"embedding"`
}

type OpenAIV1

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

func NewOpenAIV1

func NewOpenAIV1(log logger.Logger, baseUrl, key string, conf config.OpenAIConfig) *OpenAIV1

func (*OpenAIV1) Chat

func (o *OpenAIV1) Chat(ctx context.Context, stream bool, history []map[string]string, resp chan<- map[string]string) (tokens map[string]int, err error)

func (*OpenAIV1) Completion

func (o *OpenAIV1) Completion(ctx context.Context, prompt prompts.PromptTemplate, parameters map[string]string) ([]string, map[string]int, error)

func (*OpenAIV1) Embedding

func (o *OpenAIV1) Embedding(ctx context.Context, doc string) (*EmbeddingResult, error)

func (*OpenAIV1) GetAssistantModel

func (o *OpenAIV1) GetAssistantModel() string

func (*OpenAIV1) GetSystemModel

func (o *OpenAIV1) GetSystemModel() string

func (*OpenAIV1) GetUserModel

func (o *OpenAIV1) GetUserModel() string

type Usage

type Usage struct {
	PromptTokens int `json:"prompt_tokens"`
	TotalTokens  int `json:"total_tokens"`
}

Jump to

Keyboard shortcuts

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