openai

package
v0.0.0-...-3b69c6d Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const REGION = "openai"

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchJob

type BatchJob struct {
	Id           string                         `json:"custom_id"`
	Method       BatchJobMethod                 `json:"method"`
	Url          string                         `json:"url"`
	Body         *openai.ChatCompletionRequest  `json:"body"`
	Status       BatchJobStatus                 `json:"-"`
	Result       *openai.ChatCompletionResponse `json:"-"`
	Error        error                          `json:"-"`
	Waiters      []chan struct{}                `json:"-"`
	BatchId      string                         `json:"-"`
	InputFileId  string                         `json:"-"`
	OutputFileId string                         `json:"-"`
}

type BatchJobMethod

type BatchJobMethod string
const (
	ChatCompletionMethod BatchJobMethod = "POST"
)

type BatchJobStatus

type BatchJobStatus string
const (
	BatchJobStatusPending   BatchJobStatus = "pending"
	BatchJobStatusCompleted BatchJobStatus = "completed"
	BatchJobStatusFailed    BatchJobStatus = "failed"
)

type Endpoint

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

func NewEndpoint

func NewEndpoint(providerName string, region string, baseUrl string, apiKey string) (*Endpoint, error)

func (*Endpoint) GenerateBatchChatCompletion

func (p *Endpoint) GenerateBatchChatCompletion(ctx context.Context, openaiRequest *openai.ChatCompletionRequest) (*openai.ChatCompletionResponse, error)

func (*Endpoint) GenerateChatCompletion

func (p *Endpoint) GenerateChatCompletion(ctx context.Context, openaiRequest *openai.ChatCompletionRequest) (*openai.ChatCompletionResponse, error)

func (*Endpoint) Ping

func (p *Endpoint) Ping(ctx context.Context) (time.Duration, error)

func (*Endpoint) Provider

func (p *Endpoint) Provider() string

func (*Endpoint) Region

func (p *Endpoint) Region() string

func (*Endpoint) Shutdown

func (p *Endpoint) Shutdown() error

Jump to

Keyboard shortcuts

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