openai

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PostChatCompletion

func PostChatCompletion(messages []ChatCompletionMessage, apiKey string, apiHost string) (string, error)

func PostTextCompletion

func PostTextCompletion(prompt string, apiKey string, apiHost string) (string, error)

Types

type ChatCompletionChoice

type ChatCompletionChoice struct {
	Message *ChatCompletionMessage `json:"message"`
}

type ChatCompletionMessage

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

type ChatCompletionResponse

type ChatCompletionResponse struct {
	Error   any                    `json:"error"`
	Model   string                 `json:"model"`
	Choices []ChatCompletionChoice `json:"choices"`
}

type TextCompletionChoice

type TextCompletionChoice struct {
	Text string `json:"text"`
}

type TextCompletionResponse

type TextCompletionResponse struct {
	Error   any                    `json:"error"`
	Model   string                 `json:"model"`
	Choices []TextCompletionChoice `json:"choices"`
}

Jump to

Keyboard shortcuts

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