service

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorNoAvailableClient = errors.New("no available client")

Functions

func CalculatePromptToken

func CalculatePromptToken(inputs ...string) (promptToken int64)

func CheckAllowIP

func CheckAllowIP(_ context.Context, ip string, allowIPs []string) bool

func CheckApiKeyAvailable

func CheckApiKeyAvailable(ctx context.Context, key string) (exist bool, allowIPs string, err error)

func CheckManagementKey

func CheckManagementKey[req any, res any](ctx http.Context[req, *http.BaseResponse[res]])

func CheckManagementKeyAvailable

func CheckManagementKeyAvailable(_ context.Context, key string) bool

func GetAvailableClient

func GetAvailableClient(ctx context.Context, key string, modelName string, promptToken int64, endpoint string) (client openai.Client, metadata *dto.AvailableClientDTO, err error)

Types

type CompatibleService

type CompatibleService struct{}

func NewCompatibleService

func NewCompatibleService() *CompatibleService

func (*CompatibleService) ChatComplete

func (*CompatibleService) CreateSpeech

func (*CompatibleService) CreateSpeechAuthorize

func (*CompatibleService) Embedding

func (*CompatibleService) EmbeddingAuthorize

func (*CompatibleService) ListModel

func (*CompatibleService) ListModelAuthorize

type ManagementService

type ManagementService struct{}

func NewManagementService

func NewManagementService() *ManagementService

func (*ManagementService) AuthorizeManagementKey

func (srv *ManagementService) AuthorizeManagementKey(ctx http.Context[http.NoBody, http.NoResponse])

func (*ManagementService) CreateClient

func (*ManagementService) CreateClientModels

func (*ManagementService) CreateWhisperUser

func (*ManagementService) GetWhisperUser

func (*ManagementService) ListAllClients

func (*ManagementService) ListClientModels

func (*ManagementService) ListWhisperUsers

func (*ManagementService) Overview

func (*ManagementService) PreCheckCookie

func (srv *ManagementService) PreCheckCookie(ctx *gin.Context)

func (*ManagementService) UpdateWhisperUser

Jump to

Keyboard shortcuts

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