internal

package
v1.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const FinishReasonLength = "length"

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatCompletionRequest

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

type ChatCompletionResponse

type ChatCompletionResponse struct {
	ID      string  `json:"id,omitempty"`
	Choices Choices `json:"choices,omitempty"`
	Usage   Usage   `json:"usage,omitempty"`
}

type Choices

type Choices []struct {
	Index        int             `json:"index,omitempty"`
	Message      message.Message `json:"message"`
	FinishReason string          `json:"finish_reason,omitempty"`
}

type ErrorResponse

type ErrorResponse struct {
	Error GptError `json:"error,omitempty"`
}

type GptError

type GptError struct {
	Message string      `json:"message,omitempty"`
	Type    string      `json:"type,omitempty"`
	Param   string      `json:"param,omitempty"`
	Code    interface{} `json:"code,omitempty"`
}

type Usage

type Usage struct {
	TotalTokens      int `json:"total_tokens,omitempty"`
	CompletionTokens int `json:"completion_tokens,omitempty"`
	PromptTokens     int `json:"prompt_tokens,omitempty"`
}

type Wrapper

type Wrapper interface {
	//Call todo in a clean way, to handle both internal and external wrappers required splitting Call into two functions build the request and send the request
	Call(auth string, metaData *message.MetaData, request *ChatCompletionRequest) (*ChatCompletionResponse, error)
	SetupCall(messages []message.Message)
	Close() error
}

func NewWrapperFactory

func NewWrapperFactory(endPoint, apiKey string, dropLen int) (Wrapper, error)

func NewWrapperImpl

func NewWrapperImpl(endPoint, apiKey string, dropLen int) Wrapper

func NewWrapperInternalImpl

func NewWrapperInternalImpl(endPoint string, dropLen int) (Wrapper, error)

type WrapperImpl

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

func (*WrapperImpl) Call

func (w *WrapperImpl) Call(cxAuth string, metaData *message.MetaData, request *ChatCompletionRequest) (*ChatCompletionResponse, error)

func (*WrapperImpl) Close

func (w *WrapperImpl) Close() error

func (*WrapperImpl) SetupCall

func (w *WrapperImpl) SetupCall(messages []message.Message)

type WrapperInternalImpl

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

func (*WrapperInternalImpl) Call

func (*WrapperInternalImpl) Close

func (w *WrapperInternalImpl) Close() error

func (*WrapperInternalImpl) SetupCall

func (w *WrapperInternalImpl) SetupCall(messages []message.Message)

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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