proxy

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSON

func JSON(c *gin.Context, code int, message string)

Types

type CustomProvidersManager

type CustomProvidersManager interface {
	GetRouteConfigFromMem(name, path string) *custom.RouteConfig
	GetCustomProviderFromMem(name string) *custom.Provider
}

type DeletionResponse

type DeletionResponse struct {
	Id      string `json:"id"`
	Object  string `json:"object"`
	Deleted bool   `json:"deleted"`
}

type EmbeddingResponse

type EmbeddingResponse struct {
	Object string               `json:"object"`
	Data   []goopenai.Embedding `json:"data"`
	Model  string               `json:"model"`
	Usage  goopenai.Usage       `json:"usage"`
}

EmbeddingResponse is the response from a Create embeddings request.

type EmbeddingResponseBase64

type EmbeddingResponseBase64 struct {
	Object string                     `json:"object"`
	Data   []goopenai.Base64Embedding `json:"data"`
	Model  string                     `json:"model"`
	Usage  goopenai.Usage             `json:"usage"`
}

EmbeddingResponse is the response from a Create embeddings request.

type Error

type Error struct {
	Type    string `json:"type"`
	Message string `json:"message"`
}

type ErrorResponse

type ErrorResponse struct {
	Error *Error `json:"error"`
}

type Form

type Form struct {
	File *multipart.FileHeader `form:"file" binding:"required"`
}

type ImageEditForm added in v1.5.0

type ImageEditForm struct {
	Image *multipart.FileHeader `form:"image" binding:"required"`
	Mask  *multipart.FileHeader `form:"mask" binding:"required"`
}

type ImageVariationForm added in v1.5.0

type ImageVariationForm struct {
	Image *multipart.FileHeader `form:"image" binding:"required"`
}

type KeyManager

type KeyManager interface {
	GetKeys(tags, keyIds []string, provider string) ([]*key.ResponseKey, error)
	UpdateKey(id string, key *key.UpdateKey) (*key.ResponseKey, error)
	CreateKey(key *key.RequestKey) (*key.ResponseKey, error)
	DeleteKey(id string) error
}

type ModerationRequest

type ModerationRequest struct {
	Input any    `json:"input"`
	Model string `json:"model"`
}

type ProviderSettingsManager

type ProviderSettingsManager interface {
	CreateSetting(setting *provider.Setting) (*provider.Setting, error)
	UpdateSetting(id string, setting *provider.UpdateSetting) (*provider.Setting, error)
	GetSetting(id string) (*provider.Setting, error)
}

type ProxyServer

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

func NewProxyServer

func NewProxyServer(log *zap.Logger, mode, privacyMode string, c cache, m KeyManager, rm routeManager, a authenticator, psm ProviderSettingsManager, cpm CustomProvidersManager, ks keyStorage, kms keyMemStorage, e estimator, ae anthropicEstimator, aoe azureEstimator, v validator, r recorder, rlm rateLimitManager, timeOut time.Duration) (*ProxyServer, error)

func (*ProxyServer) Run

func (ps *ProxyServer) Run()

func (*ProxyServer) Shutdown

func (ps *ProxyServer) Shutdown(ctx context.Context) error

type SpeechRequest added in v1.5.0

type SpeechRequest struct {
	Model          string  `json:"model"`
	Input          string  `json:"input"`
	Voice          string  `json:"voice"`
	ResponseFormat string  `json:"response_format"`
	Speed          float64 `json:"speed"`
}

type TranslationForm added in v1.5.0

type TranslationForm struct {
	File *multipart.FileHeader `form:"file" binding:"required"`
}

type TransriptionForm added in v1.5.0

type TransriptionForm struct {
	File *multipart.FileHeader `form:"file" binding:"required"`
}

Jump to

Keyboard shortcuts

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