apiutils

package
v0.13.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadRequest    = fmt.Errorf("bad request")
	ErrModelNotFound = fmt.Errorf("model not found")
)

Functions

func MergeModelAdapter

func MergeModelAdapter(model, adapter string) string

MergeModelAdapter merges a model and adapter name into a single string.

func SplitModelAdapter

func SplitModelAdapter(s string) (model, adapter string)

SplitModelAdapter splits a requested model name into KubeAI Model.metadata.name and Model.spec.adapters[].name.

Types

type ModelClient added in v0.13.0

type ModelClient interface {
	LookupModel(ctx context.Context, model, adapter string, selectors []string) (*v1.Model, error)
}

type Request added in v0.13.0

type Request struct {
	Body []byte

	Selectors []string

	ID string

	// RequestedModel is the model name requested by the client.
	// This might contain the adapter name as well.
	RequestedModel string

	Model   string
	Adapter string

	LoadBalancing v1.LoadBalancing

	Prefix string

	ContentLength int64
	// contains filtered or unexported fields
}

func ParseRequest added in v0.13.0

func ParseRequest(ctx context.Context, client ModelClient, body io.Reader, path string, headers http.Header) (*Request, error)

Jump to

Keyboard shortcuts

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