CLI
This page documents the command-line interface for evaLLM.
cli
CLI for evaLLM
CLI Usage
Evaluate a dataset
Configuration model
evallm run needs two top-level sections:
datasetinput_file(required): path to JSONL filetext_key(required): key containing text to evaluaterecord_id_key(optional): key for record IDs (#IDX#fallback)
metrics- required list of one or more metric specs
- each spec supports
name, optionalconfig, optionalresult_key
You can provide configuration in two ways:
- through CLI flags, or
- as a config file (
--config, JSON or YAML)
Warning
If both are used, config file values are loaded first and CLI flags override
them. If any --metric flags are passed, they replace config.metrics!
Supported --metric forms
Configuration file
# eval_config.yml
dataset:
input_file: ./data/dataset.jsonl
text_key: text
record_id_key: id
metrics:
- name: CountsMetric
result_key: chars
- name: CountsMetric
config:
segments: tokens
segmentation: whitespace
result_key: tokens
- name: CountsMetric
config:
segments: encodings
segmentation: meta-llama/Llama-3.1-8B
result_key: llama_3_1
- name: JsonFormatMetric
config:
expected_schema:
type: object
properties:
question:
type: string
pattern: '\?$'
setup:
type: string
joke:
type: string
funniness_score:
type: number
minimum: 0.0
maximum: 1.0
required:
- question
- joke
check_formats: true
result_key: structured_output
// eval_config.json
{
"dataset": {
"input_file": "./data/dataset.jsonl",
"text_key": "text",
"record_id_key": "id"
},
"metrics": [
{
"name": "CountsMetric",
"result_key": "chars"
},
{
"name": "CountsMetric",
"config": {
"segments": "tokens",
"segmentation": "whitespace"
},
"result_key": "tokens"
},
{
"name": "CountsMetric",
"config": {
"segments": "encodings",
"segmentation": "meta-llama/Llama-3.1-8B"
},
"result_key": "llama_3_1"
},
{
"name": "JsonFormatMetric",
"config": {
"expected_schema": {
"type": "object",
"properties": {
"question": {
"type": "string",
"pattern": "\\?$"
},
"setup": {
"type": "string"
},
"joke": {
"type": "string"
},
"funniness_score": {
"type": "number",
"minimum": 0.0,
"maximum": 1.0
}
},
"required": [
"question",
"joke"
]
},
"check_formats": true
},
"result_key": "structured_output"
}
]
}
Process output
Each record's evaluation result is serialized as a JSON object. By default, results are streamed to the console, which lets you pipe them however you want. You can of course also have them written to a results file in JSONL format.
Help and discovery
Metric discovery and configuration help
Referenced by:
| MODULE | DESCRIPTION |
|---|---|
main |