server

package
v0.0.0-...-3b69c6d Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadRequestError

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

type Config

type Config struct {
	// Valkey (open-source version of Redis) endpoint to store rate limiting information.
	// E.g., localhost:6379
	ValkeyEndpoint string `yaml:"valkey_endpoint"`

	// API key to access the Ogem service. The user should provide this key in the Authorization header with the Bearer scheme.
	OgemApiKey string

	// Project ID of the Google Cloud project to use Vertex AI.
	// E.g., my-project-12345
	GoogleCloudProject string `yaml:"google_cloud_project"`

	// API key to access the GenAI Studio service.
	GenaiStudioApiKey string

	// API key to access the OpenAI service.
	OpenAiApiKey string

	// API key to access the Claude service.
	ClaudeApiKey string

	// Interval to retry when no available endpoints are found. E.g., 10m
	RetryInterval string `yaml:"retry_interval"`

	// Interval to update the status of the providers. E.g., 1h30m
	PingInterval string `yaml:"ping_interval"`

	// Port to listen for incoming requests.
	Port int `yaml:"port"`

	// Configuration for each provider.
	Providers ogem.ProvidersStatus `yaml:"providers"`
}

type InternalServerError

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

type ModelProxy

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

func NewProxyServer

func NewProxyServer(stateManager state.Manager, cleanup func(), config Config, logger *zap.SugaredLogger) (*ModelProxy, error)

func (*ModelProxy) HandleAuthentication

func (s *ModelProxy) HandleAuthentication(handler http.HandlerFunc) http.HandlerFunc

func (*ModelProxy) HandleChatCompletions

func (s *ModelProxy) HandleChatCompletions(httpResponse http.ResponseWriter, httpRequest *http.Request)

func (*ModelProxy) PingInterval

func (s *ModelProxy) PingInterval() time.Duration

func (*ModelProxy) Shutdown

func (s *ModelProxy) Shutdown()

func (*ModelProxy) StartPingLoop

func (s *ModelProxy) StartPingLoop(ctx context.Context)

type RateLimitError

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

type RequestTimeoutError

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

type UnavailableError

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

Jump to

Keyboard shortcuts

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