dataplane

package
v0.0.0-...-30b5f87 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataPlaneOption

type DataPlaneOption interface {
	// contains filtered or unexported methods
}

func WithDataPlaneAddr

func WithDataPlaneAddr(addr string) DataPlaneOption

func WithDataPlaneIdleTimeout

func WithDataPlaneIdleTimeout(timeout time.Duration) DataPlaneOption

func WithDataPlaneLLMClient

func WithDataPlaneLLMClient(client LLMClient) DataPlaneOption

func WithDataPlaneLogger

func WithDataPlaneLogger(logger *slog.Logger) DataPlaneOption

func WithDataPlaneProviders

func WithDataPlaneProviders(providers ...Provider) DataPlaneOption

func WithDataPlaneReadTimeout

func WithDataPlaneReadTimeout(timeout time.Duration) DataPlaneOption

func WithDataPlaneTokenAuthenticator

func WithDataPlaneTokenAuthenticator(authenticator *auth.TokenAuthenticator) DataPlaneOption

func WithDataPlaneUsageMetrics

func WithDataPlaneUsageMetrics(metrics *monitoring.UsageMetrics) DataPlaneOption

func WithDataPlaneUsageRepository

func WithDataPlaneUsageRepository(repo trustedai.UsageRepository) DataPlaneOption

func WithDataPlaneWriteTimeout

func WithDataPlaneWriteTimeout(timeout time.Duration) DataPlaneOption

type DataPlaneServer

type DataPlaneServer struct {
	LLMClient LLMClient
	// contains filtered or unexported fields
}

func NewDataPlaneServer

func NewDataPlaneServer(options ...DataPlaneOption) (*DataPlaneServer, error)

func (*DataPlaneServer) GetMux

func (s *DataPlaneServer) GetMux() *http.ServeMux

func (*DataPlaneServer) GetServer

func (s *DataPlaneServer) GetServer() *http.Server

func (*DataPlaneServer) Shutdown

func (s *DataPlaneServer) Shutdown(ctx context.Context) error

func (*DataPlaneServer) Start

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

type LLMClient

type LLMClient interface {
	Generate(ctx context.Context, req gai.GenerateRequest) (*gai.Response, error)
	GenerateStream(ctx context.Context, req gai.GenerateRequest) (gai.ResponseStream, error)
}

type ModelRouter

type ModelRouter interface {
	ListModels(ctx context.Context) ([]gai.Model, error)
}

type Provider

type Provider interface {
	Name() string
	SetupRoutes(mux *http.ServeMux, baseAuth func(http.Handler) http.Handler)
	SetLLMClient(client LLMClient)
	Shutdown(ctx context.Context) error
}

type ProviderOption

type ProviderOption interface {
	Apply(*ProviderOptions)
}

func WithModelRouter

func WithModelRouter(router ModelRouter) ProviderOption

func WithProviderLogger

func WithProviderLogger(logger *slog.Logger) ProviderOption

type ProviderOptions

type ProviderOptions struct {
	Logger      *slog.Logger
	ModelRouter ModelRouter
}

type TrackedLLMClient

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

TrackedLLMClient wraps an LLMClient to automatically handle usage tracking

func NewTrackedLLMClient

func NewTrackedLLMClient(client LLMClient, usageMiddleware interfaces.UsageMiddleware) *TrackedLLMClient

NewTrackedLLMClient creates a new LLMClient wrapper that automatically tracks usage

func (*TrackedLLMClient) Generate

Generate implements the LLMClient interface with automatic usage tracking

func (*TrackedLLMClient) GenerateStream

func (t *TrackedLLMClient) GenerateStream(ctx context.Context, req gai.GenerateRequest) (gai.ResponseStream, error)

GenerateStream implements the LLMClient interface with automatic usage tracking

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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