A model is the inference endpoint under evaluation - a hosted provider API, an agent platform deployment, or an endpoint served by your own infrastructure. A task whose evaluated_entity_type is model sends its samples to whichever model an evaluation pairs it with.
A model that performs no inference, e.g. when samples already contain the outputs to score.
Stateful endpoints, which keep conversation state server-side instead of replaying the history on every turn, need an adapter that carries the state identifier across turns - see Integrate Stateful Model Endpoint.
Integrate a Model walks through each of these paths and helps choose between them.
Credentials and throughput
To keep API keys out of the configuration, declare them in the model’s secrets mapping (or at the root of the run config) and reference them from config with the << secrets.NAME >> syntax. Secret values themselves are usually read from the environment with the $VAR directive, or stored server-side beforehand with lf secret add. See the secrets guide.
rate_limit (requests per minute) and max_concurrent_requests throttle LF AI Platform to what the endpoint tolerates; set them when an evaluation would otherwise trip provider limits.
Working with models
Register a model with lf add model and check that LF AI Platform can actually reach it with lf test model before running an evaluation (see Testing Models). The registered models are listed by lf list model. In a run config, a provider model can also be declared inline with the $provider shorthand instead of a full model definition.
Configuration
Properties
secretsobject
Secrets which can be used to reference secret values in designated places.
Default: None
keyKeyrequired
Reference to an existing entity in AI Platform.
Pattern: ^[a-zA-Z0-9_\-\$]+$ Max Length: 250
display_namestringrequired
The model’s name displayed to the user.
descriptionstring
Short description of the model.
Default: None
rate_limitinteger
The maximum allowed number of requests per minute.
Default: None
max_concurrent_requestsinteger
The maximum allowed number of concurrent requests.
Default: None
taskenum MLTask
The ML task of the model.
Default: chat_completion
NotePossible MLTask values
The type of machine learning task to be performed.
display_name:"OpenAI GPT-4.1 Nano"key:"openai-gpt-4-1-nano"description: > Fastest, most cost-efficient version of GPT-4.1 GPT-4.1 nano excels at instruction following and tool calling.rate_limit:60task:"chat_completion"config:adapter:key:"openai-chat-completion"connection_type:"custom_connection"url:"https://api.openai.com/v1/chat/completions"api_key: $OPENAI_API_KEYmodel_key:"gpt-4.1-nano"
display_name:"OpenAI GPT-4.1 Nano (Custom Inference)"key:"gpt-4-1-nano-custom-inference"description:"OpenAI's GPT-4-1 Nano defined as a model with custom inference."rate_limit:60task:"chat_completion"config:connection_type:"custom_inference"adapter:key:"latticeflow$openai_chat_completion"run_inference_snippet: !include "./run_inference.py"environment:MODEL_ENDPOINT_URL:"https://api.openai.com/v1/chat/completions"MODEL_ENDPOINT_API_KEY: $OPENAI_API_KEYMODEL_KEY:"gpt-4.1-nano"timeout:15
The model adapter responsible for converting the endpoint inputs and outputs into a standardized format.
Default: {'key': 'latticeflow$identity'}
urlstringrequired
The model endpoint URL.
api_keySecretTemplate, string
The key to be passed as the authorization header (Authorization: Bearer API_KEY). Can reference an existing secret.
Default: None
model_keystring
This field is used in case the model is not specified in the URL but in the body instead. For the “openai” adapter, this will be passed as the “model” parameter. For custom adapters, this value is available as model_info.model_key.