openai

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 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 AudioRequest

type AudioRequest struct {
	Model        string `json:"model"`
	Input        string `json:"input"`
	Voice        string `json:"voice"`
	Instructions string `json:"instructions,omitempty"`
}

type ChatRequest

type ChatRequest struct {
	Model    string    `json:"model"`
	Messages []Message `json:"messages"`
}

type ChatResponse

type ChatResponse struct {
	Choices []struct {
		Message Message `json:"message"`
	} `json:"choices"`
}

type Message

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

type OpenAI

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

func New

func New(apiKey string, transcriptionModel string, speechModel string, chatModel string, voice string) *OpenAI

func (*OpenAI) Chat

func (o *OpenAI) Chat(messages []Message) (string, error)

func (*OpenAI) GenerateAudio

func (o *OpenAI) GenerateAudio(text string, instructions string) (io.Reader, error)

func (*OpenAI) Transcribe

func (o *OpenAI) Transcribe(audioFile io.Reader) (string, error)

type TranscriptionResponse

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

Jump to

Keyboard shortcuts

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