proxy

package
v1.13.13 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 29 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CorsMiddleware added in v1.9.3

func CorsMiddleware() gin.HandlerFunc

func JSON

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

Types

type AlertRequest added in v1.13.0

type AlertRequest struct {
	Email   string `json:"email"`
	Subject string `json:"subject"`
	Body    string `json:"body"`
}

type CustomPolicyDetector added in v1.13.0

type CustomPolicyDetector interface {
	Detect(input []string, requirements []string) (bool, error)
}

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 PoliciesManager added in v1.13.0

type PoliciesManager interface {
	GetPolicyByIdFromMemdb(id string) *policy.Policy
}

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, pub publisher, rlm rateLimitManager, timeOut time.Duration, ac accessCache, pm PoliciesManager, scanner Scanner, cd CustomPolicyDetector) (*ProxyServer, error)

func (*ProxyServer) Run

func (ps *ProxyServer) Run()

func (*ProxyServer) Shutdown

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

type Scanner added in v1.13.0

type Scanner interface {
	Scan(input []string) (*pii.Result, 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 StreamingData added in v1.12.3

type StreamingData struct {
	Data []byte `json:"data"`
}

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