models

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatCompletionRequest

type ChatCompletionRequest struct {
	Model       string    `json:"model"`
	Messages    []Message `json:"messages"`
	Temperature *float32  `json:"temperature,omitempty"` // Optional field (pointer to float32)
	Stream      bool      `json:"stream"`
}

ChatCompletionRequest Define the request body structure

type ChatCompletionResponse

type ChatCompletionResponse struct {
	Choices []Choice `json:"choices"`
}

ChatCompletionResponse represents the entire response structure from OpenAI's chat completion API.

type Choice

type Choice struct {
	Delta Delta `json:"delta"`
}

Choice represents an individual choice in the response.

type Data

type Data struct {
	Object    string    `json:"object"`
	Embedding []float64 `json:"embedding"` // Embedding is an array of 1536 floats
	Index     int       `json:"index"`
}

Data represents each individual embedding

type Delta

type Delta struct {
	Content string `json:"content"`
}

Delta represents the delta object in each choice containing the content.

type EmbeddingRequest

type EmbeddingRequest struct {
	Input          string `json:"input"`           // The input text to be embedded
	Model          string `json:"model"`           // The model used for generating embeddings
	EncodingFormat string `json:"encoding_format"` // The encoding format (in this case, "float")
}

EmbeddingRequest represents the request structure for the OpenAI embedding API

type EmbeddingResponse

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

EmbeddingResponse represents the entire response from the embedding API

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

Message Define the request body structure

type UsageInfo

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

UsageInfo represents the token usage details in the API response

Jump to

Keyboard shortcuts

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