server

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IS added in v1.4.0

type IS struct {
	v1.UnimplementedInferenceInternalServiceServer
	// contains filtered or unexported fields
}

IS is a server for internal services.

func NewInternalServer added in v1.4.0

func NewInternalServer(
	infProcessor *infprocessor.P,
	taskExchanger *taskexchanger.E,
	logger logr.Logger,
) *IS

NewInternalServer creates a new internal server.

func (*IS) ProcessTasksInternal added in v1.4.0

func (is *IS) ProcessTasksInternal(srv v1.InferenceInternalService_ProcessTasksInternalServer) error

ProcessTasksInternal processes tasks.

func (*IS) Run added in v1.4.0

func (is *IS) Run(ctx context.Context, port int) error

Run runs the internal service server.

func (*IS) RunWithListener added in v1.4.0

func (is *IS) RunWithListener(ctx context.Context, l net.Listener) error

RunWithListener runs the server with a given listener.

func (*IS) Stop added in v1.4.0

func (is *IS) Stop()

Stop stops the internal service server.

type ModelClient

type ModelClient interface {
	GetModel(ctx context.Context, in *mv1.GetModelRequest, opts ...grpc.CallOption) (*mv1.Model, error)
}

ModelClient is an interface for a model client.

type NoopModelClient

type NoopModelClient struct {
}

NoopModelClient is a no-op model client.

func (*NoopModelClient) GetModel

func (c *NoopModelClient) GetModel(ctx context.Context, in *mv1.GetModelRequest, opts ...grpc.CallOption) (*mv1.Model, error)

GetModel is a no-op implementation of GetModel.

type NoopRewriter

type NoopRewriter struct {
}

NoopRewriter is a no-op rewriter.

func (*NoopRewriter) ProcessMessages

ProcessMessages is a no-op implementation of ProcessMessages.

type NoopVectorStoreClient

type NoopVectorStoreClient struct {
}

NoopVectorStoreClient is a no-op vector store client.

func (*NoopVectorStoreClient) GetVectorStoreByName

GetVectorStoreByName is a no-op implementation of GetVectorStoreByName.

type Rewriter

type Rewriter interface {
	ProcessMessages(
		ctx context.Context,
		vstore *vsv1.VectorStore,
		messages []*v1.CreateChatCompletionRequest_Message,
	) ([]*v1.CreateChatCompletionRequest_Message, error)
}

Rewriter is an interface for rag.

type S

type S struct {
	v1.UnimplementedChatServiceServer
	// contains filtered or unexported fields
}

S is a server.

func New

func New(
	m metricsMonitoring,
	usage sender.UsageSetter,
	rate rate.Limiter,
	modelClient ModelClient,
	vsClient VectorStoreClient,
	r Rewriter,
	taskSender taskSender,
	logger logr.Logger,
) *S

New creates a server.

func (*S) CreateChatCompletion

func (s *S) CreateChatCompletion(
	w http.ResponseWriter,
	req *http.Request,
	pathParams map[string]string,
)

CreateChatCompletion creates a chat completion.

func (*S) CreateCompletion

func (s *S) CreateCompletion(
	w http.ResponseWriter,
	req *http.Request,
	pathParams map[string]string,
)

CreateCompletion creates a (legacy) completion.

The implementation is similar to CreateChatCompletion, but this has extra logic for converting a legacy request to a non-legacy request (and vice versa for response).

TODO(kenji): Avoid code duplication CreateChatCompletion.

func (*S) CreateEmbedding

func (s *S) CreateEmbedding(
	w http.ResponseWriter,
	req *http.Request,
	pathParams map[string]string,
)

CreateEmbedding creates an embedding.

func (*S) Run

func (s *S) Run(ctx context.Context, port int, authConfig config.AuthConfig) error

Run starts the gRPC server.

func (*S) Stop

func (s *S) Stop()

Stop stops the gRPC server.

type VectorStoreClient

type VectorStoreClient interface {
	GetVectorStoreByName(ctx context.Context, req *vsv1.GetVectorStoreByNameRequest, opts ...grpc.CallOption) (*vsv1.VectorStore, error)
}

VectorStoreClient is an interface for a vector store client.

type WS

type WS struct {
	v1.UnimplementedInferenceWorkerServiceServer
	// contains filtered or unexported fields
}

WS is a server for worker services.

func NewWorkerServiceServer

func NewWorkerServiceServer(infProcessor *infprocessor.P, logger logr.Logger) *WS

NewWorkerServiceServer creates a new worker service server.

func (*WS) ProcessTasks

func (ws *WS) ProcessTasks(srv v1.InferenceWorkerService_ProcessTasksServer) error

ProcessTasks processes tasks.

func (*WS) Run

func (ws *WS) Run(ctx context.Context, port int, authConfig config.AuthConfig, tlsConfig *config.TLS) error

Run runs the worker service server.

func (*WS) RunWithListener added in v1.4.0

func (ws *WS) RunWithListener(ctx context.Context, authConfig config.AuthConfig, tlsConfig *config.TLS, l net.Listener) error

RunWithListener runs the server with a given listener.

func (*WS) Stop

func (ws *WS) Stop()

Stop stops the worker service server.

Jump to

Keyboard shortcuts

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