provider

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatCompletionMessage

type ChatCompletionMessage struct {
	Role    ChatMessageRole
	Content string
}

type ChatCompletionRequest

type ChatCompletionRequest struct {
	Messages []ChatCompletionMessage
}

type ChatCompletionResponse

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

type ChatCompletionStreamChoice added in v0.2.0

type ChatCompletionStreamChoice struct {
	Index        int                             `json:"index"`
	Delta        ChatCompletionStreamChoiceDelta `json:"delta"`
	FinishReason string                          `json:"finish_reason"`
}

type ChatCompletionStreamChoiceDelta added in v0.2.0

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

type ChatCompletionStreamResponse added in v0.2.0

type ChatCompletionStreamResponse struct {
	ID      string                       `json:"id"`
	Object  string                       `json:"object"`
	Created int64                        `json:"created"`
	Model   string                       `json:"model"`
	Choices []ChatCompletionStreamChoice `json:"choices"`
}

type ChatGPTService

type ChatGPTService interface {
	CreateChatCompletion(ctx context.Context, req ChatCompletionRequest) (*ChatCompletionResponse, error)
	CreateChatCompletionStream(ctx context.Context, req ChatCompletionRequest, send chan<- ChatCompletionStreamResponse) error
}

func NewChatGPTService

func NewChatGPTService(apiKey, model string) ChatGPTService

type ChatMessageRole

type ChatMessageRole string
const (
	ChatMessageRoleSystem    ChatMessageRole = "system"
	ChatMessageRoleUser      ChatMessageRole = "user"
	ChatMessageRoleAssistant ChatMessageRole = "assistant"
)

The Chat message role defined by the OpenAI API refers to the role that a message plays in a conversation between a user and an AI language model. The API allows developers to define the role of each message in a conversation, which can help the language model understand the context and intent of the conversation.

Jump to

Keyboard shortcuts

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