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.
Click to show internal directories.
Click to hide internal directories.