server

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: BSD-2-Clause Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultNetwork is the default network.
	DefaultNetwork = "tcp4"
	// DefaultAddress is the default address.
	DefaultAddress = ":8080"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Network        string
	Address        string
	AllowedOrigins []string
	TLSEnabled     bool
	TLSCert        string
	TLSKey         string
}

Config is the configuration for the server.

type RequestHandler

type RequestHandler interface {
	RegisterServer(grpc.ServiceRegistrar) error
	RegisterHandlerServer(context.Context, *runtime.ServeMux) error
}

RequestHandler is implemented by any task-specific service that can be registered in the main Server.

func NewServerForLanguageModeling added in v0.1.2

func NewServerForLanguageModeling(predictor languagemodeling.Interface) RequestHandler

func NewServerForQuestionAnswering

func NewServerForQuestionAnswering(engine questionanswering.Interface) RequestHandler

func NewServerForTextClassification

func NewServerForTextClassification(classifier textclassification.Interface) RequestHandler

func NewServerForTextEncoding

func NewServerForTextEncoding(encoder textencoding.Interface) RequestHandler

func NewServerForTextGeneration

func NewServerForTextGeneration(generator textgeneration.Interface) RequestHandler

func NewServerForTokenClassification

func NewServerForTokenClassification(classifier tokenclassification.Interface) RequestHandler

func NewServerForZeroShotClassification

func NewServerForZeroShotClassification(classifier zeroshotclassifier.Interface) RequestHandler

func ResolveRequestHandler

func ResolveRequestHandler(model any) (RequestHandler, error)

ResolveRequestHandler instantiates a new task-server based on the model.

type Server

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

Server is a server that provides gRPC and HTTP/2 APIs.

func New

func New(conf *Config, handler RequestHandler) *Server

New creates a new server.

func (*Server) ClientAddr

func (s *Server) ClientAddr() string

ClientAddr returns the Address used to connect clients (without the network). Helpful in testing when we designate a random port (0).

func (*Server) ReadyForConnections

func (s *Server) ReadyForConnections(dur time.Duration) bool

ReadyForConnections returns `true` if the server is ready to accept requests. If after the duration `dur` the server is still not ready, returns `false`.

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start up the server and block until the context is done.

Directories

Path Synopsis
gen
proto/go/languagemodeling/v1
Package languagemodelingv1 is a reverse proxy.
Package languagemodelingv1 is a reverse proxy.
proto/go/questionanswering/v1
Package questionansweringv1 is a reverse proxy.
Package questionansweringv1 is a reverse proxy.
proto/go/textclassification/v1
Package textclassificationv1 is a reverse proxy.
Package textclassificationv1 is a reverse proxy.
proto/go/textencoding/v1
Package textencodingv1 is a reverse proxy.
Package textencodingv1 is a reverse proxy.
proto/go/textgeneration/v1
Package textgenerationv1 is a reverse proxy.
Package textgenerationv1 is a reverse proxy.
proto/go/tokenclassification/v1
Package tokenclassificationv1 is a reverse proxy.
Package tokenclassificationv1 is a reverse proxy.
proto/go/zeroshot/v1
Package zeroshotv1 is a reverse proxy.
Package zeroshotv1 is a reverse proxy.

Jump to

Keyboard shortcuts

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