models

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

README

Model Data Extractor

Type: models-data-extractor

The Models Data Extractor converts the response from a models-data-source into endpoint attributes consumed by filters and scorers.

What it does

  1. Receives the parsed API response forwarded by models-data-source.
  2. Converts it into a ModelDataCollection — a slice of ModelData entries, each with:
    • ID (string): model identifier (e.g. "llama-3-8b").
    • Parent (string, optional): base model the adapter derives from.
  3. Stores the collection as an attribute on the corresponding endpoint.

Attributes produced

  • ModelDataCollection stored at attribute key ModelsAttributeKey ("/v1/models") on each endpoint.
attr, ok := endpoint.GetAttributes().Get(models.ModelsAttributeKey)
if !ok || attr == nil {
    return fmt.Errorf("no models found")
}
modelData, ok := attr.(models.ModelDataCollection)

Configuration

No configuration parameters.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModelServerExtractorFactory

func ModelServerExtractorFactory(name string, _ *json.Decoder, _ fwkplugin.Handle) (fwkplugin.Plugin, error)

ModelServerExtractorFactory is a factory function used to instantiate data layer's models extractor plugins specified in a configuration.

Types

type ModelExtractor

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

ModelExtractor implements the models extraction.

func NewModelExtractor

func NewModelExtractor() *ModelExtractor

NewModelExtractor returns a new model extractor.

func (*ModelExtractor) Extract

Extract stores the model list as an endpoint attribute.

func (*ModelExtractor) Produces

func (me *ModelExtractor) Produces() map[fwkplugin.DataKey]any

Produces returns data produced by the producer.

func (*ModelExtractor) TypedName

func (me *ModelExtractor) TypedName() fwkplugin.TypedName

TypedName returns the type and name of the ModelExtractor.

type ModelResponse

type ModelResponse struct {
	Object string                 `json:"object"`
	Data   []attrmodels.ModelData `json:"data"`
}

ModelResponse is the response from /v1/models API.

Jump to

Keyboard shortcuts

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