http

package
v0.0.0-...-df6d72d Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HealthHandler

func HealthHandler(c *fiber.Ctx) error

HealthHandler

@id			glide-health
@Summary	Gateway Health
@Description
@tags		Operations
@Accept		json
@Produce	json
@Success	200	{object}	schemas.HealthSchema
@Router		/v1/health/ [get]

func NotFoundHandler

func NotFoundHandler(c *fiber.Ctx) error

Types

type Handler

type Handler = func(c *fiber.Ctx) error

func LangChatHandler

func LangChatHandler(routerManager *routers.RouterManager) Handler

LangChatHandler

@id				glide-language-chat
@Summary		Language Chat
@Description	Talk to different LLM Chat APIs via unified endpoint
@tags			Language
@Param			router	path	string						true	"Router ID"
@Param			payload	body	schemas.ChatRequest	true	"Request Data"
@Accept			json
@Produce		json
@Success		200	{object}	schemas.ChatResponse
@Failure		400	{object}	schemas.Error
@Failure		404	{object}	schemas.Error
@Router			/v1/language/{router}/chat [POST]

func LangRoutersHandler

func LangRoutersHandler(routerManager *routers.RouterManager) Handler

LangRoutersHandler

@id				glide-language-routers
@Summary		Language Router List
@Description	Retrieve list of configured active language routers and their configurations
@tags			Language
@Accept			json
@Produce		json
@Success		200	{object}	schemas.RouterListSchema
@Router			/v1/language/ [GET]

func LangStreamChatHandler

func LangStreamChatHandler(tel *telemetry.Telemetry, routerManager *routers.RouterManager) Handler

LangStreamChatHandler

@id				glide-language-chat-stream
@Summary		Language Chat
@Description	Talk to different LLM Stream Chat APIs via a unified websocket endpoint
@tags			Language
@Param			router	    			path		string	true	"Router ID"
@Param			Connection				header		string	true	"Websocket Connection Type"
@Param			Upgrade 				header		string	true	"Upgrade header"
@Param			Sec-WebSocket-Key  		header		string	true	"Websocket Security Token"
@Param			Sec-WebSocket-Version  	header		string	true	"Websocket Security Token"
@Accept			json
@Success		101
@Failure		426
@Failure		404	{object}	schemas.Error
@Router			/v1/language/{router}/chatStream [GET]

func LangStreamRouterValidator

func LangStreamRouterValidator(routerManager *routers.RouterManager) Handler

type Server

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

func NewServer

func NewServer(config *ServerConfig, tel *telemetry.Telemetry, routerManager *routers.RouterManager) (*Server, error)

func (*Server) Run

func (srv *Server) Run() error

func (*Server) Shutdown

func (srv *Server) Shutdown(ctx context.Context) error

type ServerConfig

type ServerConfig struct {
	Host               string         `yaml:"host"`
	Port               int            `yaml:"port"`
	ReadTimeout        *time.Duration `yaml:"read_timeout"`
	WriteTimeout       *time.Duration `yaml:"write_timeout"`
	IdleTimeout        *time.Duration `yaml:"idle_timeout"`
	MaxRequestBodySize *int           `yaml:"max_request_body_size"`
}

func DefaultServerConfig

func DefaultServerConfig() *ServerConfig

func (*ServerConfig) Address

func (cfg *ServerConfig) Address() string

func (*ServerConfig) ToServer

func (cfg *ServerConfig) ToServer() *fiber.App

Jump to

Keyboard shortcuts

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