openai

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpenaiModelAPIURL    = "https://api.openai.com/v1"
	OpenaiDefaultTimeout = 300 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type OpenAI

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

func NewOpenAI

func NewOpenAI(apiKey string, baseURL string) (*OpenAI, error)

func (*OpenAI) Call

func (o *OpenAI) Call(data []byte) (llms.Response, error)

func (OpenAI) Type

func (o OpenAI) Type() llms.LLMType

func (*OpenAI) Validate

func (o *OpenAI) Validate(ctx context.Context, options ...langchainllms.CallOption) (llms.Response, error)

Validate OpenAI service

type Response

type Response struct {
	Code    int    `json:"code"`
	Data    string `json:"data"`
	Msg     string `json:"msg"`
	Success bool   `json:"success"`
}

func (*Response) Bytes

func (response *Response) Bytes() []byte

func (*Response) String

func (response *Response) String() string

func (*Response) Type

func (response *Response) Type() llms.LLMType

func (*Response) Unmarshal

func (response *Response) Unmarshal(bytes []byte) error

Jump to

Keyboard shortcuts

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