chore: more mypy fixes (#2029)

# What does this PR do?

Mainly tried to cover the entire llama_stack/apis directory, we only
have one left. Some excludes were just noop.

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han 2025-05-06 18:52:31 +02:00 committed by GitHub
parent feb9eb8b0d
commit 1a529705da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 581 additions and 166 deletions

View file

@ -4052,9 +4052,13 @@
"properties": {
"type": {
"type": "string",
"enum": [
"json_schema",
"grammar"
],
"description": "Must be \"grammar\" to identify this format type",
"const": "grammar",
"default": "grammar",
"description": "Must be \"grammar\" to identify this format type"
"default": "grammar"
},
"bnf": {
"type": "object",
@ -4178,9 +4182,13 @@
"properties": {
"type": {
"type": "string",
"enum": [
"json_schema",
"grammar"
],
"description": "Must be \"json_schema\" to identify this format type",
"const": "json_schema",
"default": "json_schema",
"description": "Must be \"json_schema\" to identify this format type"
"default": "json_schema"
},
"json_schema": {
"type": "object",
@ -5638,6 +5646,14 @@
},
"step_type": {
"type": "string",
"enum": [
"inference",
"tool_execution",
"shield_call",
"memory_retrieval"
],
"title": "StepType",
"description": "Type of the step in an agent turn.",
"const": "inference",
"default": "inference"
},
@ -5679,6 +5695,14 @@
},
"step_type": {
"type": "string",
"enum": [
"inference",
"tool_execution",
"shield_call",
"memory_retrieval"
],
"title": "StepType",
"description": "Type of the step in an agent turn.",
"const": "memory_retrieval",
"default": "memory_retrieval"
},
@ -5767,6 +5791,14 @@
},
"step_type": {
"type": "string",
"enum": [
"inference",
"tool_execution",
"shield_call",
"memory_retrieval"
],
"title": "StepType",
"description": "Type of the step in an agent turn.",
"const": "shield_call",
"default": "shield_call"
},
@ -5807,6 +5839,14 @@
},
"step_type": {
"type": "string",
"enum": [
"inference",
"tool_execution",
"shield_call",
"memory_retrieval"
],
"title": "StepType",
"description": "Type of the step in an agent turn.",
"const": "tool_execution",
"default": "tool_execution"
},
@ -6069,6 +6109,15 @@
"properties": {
"event_type": {
"type": "string",
"enum": [
"step_start",
"step_complete",
"step_progress",
"turn_start",
"turn_complete",
"turn_awaiting_input"
],
"title": "AgentTurnResponseEventType",
"const": "step_complete",
"default": "step_complete"
},
@ -6126,6 +6175,15 @@
"properties": {
"event_type": {
"type": "string",
"enum": [
"step_start",
"step_complete",
"step_progress",
"turn_start",
"turn_complete",
"turn_awaiting_input"
],
"title": "AgentTurnResponseEventType",
"const": "step_progress",
"default": "step_progress"
},
@ -6161,6 +6219,15 @@
"properties": {
"event_type": {
"type": "string",
"enum": [
"step_start",
"step_complete",
"step_progress",
"turn_start",
"turn_complete",
"turn_awaiting_input"
],
"title": "AgentTurnResponseEventType",
"const": "step_start",
"default": "step_start"
},
@ -6231,6 +6298,15 @@
"properties": {
"event_type": {
"type": "string",
"enum": [
"step_start",
"step_complete",
"step_progress",
"turn_start",
"turn_complete",
"turn_awaiting_input"
],
"title": "AgentTurnResponseEventType",
"const": "turn_awaiting_input",
"default": "turn_awaiting_input"
},
@ -6250,6 +6326,15 @@
"properties": {
"event_type": {
"type": "string",
"enum": [
"step_start",
"step_complete",
"step_progress",
"turn_start",
"turn_complete",
"turn_awaiting_input"
],
"title": "AgentTurnResponseEventType",
"const": "turn_complete",
"default": "turn_complete"
},
@ -6269,6 +6354,15 @@
"properties": {
"event_type": {
"type": "string",
"enum": [
"step_start",
"step_complete",
"step_progress",
"turn_start",
"turn_complete",
"turn_awaiting_input"
],
"title": "AgentTurnResponseEventType",
"const": "turn_start",
"default": "turn_start"
},
@ -6876,7 +6970,7 @@
"type": "object",
"properties": {
"type": {
"type": "string",
"$ref": "#/components/schemas/ScoringFnParamsType",
"const": "basic",
"default": "basic"
},
@ -6889,7 +6983,8 @@
},
"additionalProperties": false,
"required": [
"type"
"type",
"aggregation_functions"
],
"title": "BasicScoringFnParams"
},
@ -6941,7 +7036,7 @@
"type": "object",
"properties": {
"type": {
"type": "string",
"$ref": "#/components/schemas/ScoringFnParamsType",
"const": "llm_as_judge",
"default": "llm_as_judge"
},
@ -6967,7 +7062,9 @@
"additionalProperties": false,
"required": [
"type",
"judge_model"
"judge_model",
"judge_score_regexes",
"aggregation_functions"
],
"title": "LLMAsJudgeScoringFnParams"
},
@ -7005,7 +7102,7 @@
"type": "object",
"properties": {
"type": {
"type": "string",
"$ref": "#/components/schemas/ScoringFnParamsType",
"const": "regex_parser",
"default": "regex_parser"
},
@ -7024,7 +7121,9 @@
},
"additionalProperties": false,
"required": [
"type"
"type",
"parsing_regexes",
"aggregation_functions"
],
"title": "RegexParserScoringFnParams"
},
@ -7049,6 +7148,15 @@
}
}
},
"ScoringFnParamsType": {
"type": "string",
"enum": [
"llm_as_judge",
"regex_parser",
"basic"
],
"title": "ScoringFnParamsType"
},
"EvaluateRowsRequest": {
"type": "object",
"properties": {
@ -7317,6 +7425,17 @@
},
"type": {
"type": "string",
"enum": [
"model",
"shield",
"vector_db",
"dataset",
"scoring_function",
"benchmark",
"tool",
"tool_group"
],
"title": "ResourceType",
"const": "benchmark",
"default": "benchmark"
},
@ -7358,7 +7477,6 @@
"additionalProperties": false,
"required": [
"identifier",
"provider_resource_id",
"provider_id",
"type",
"dataset_id",
@ -7398,6 +7516,17 @@
},
"type": {
"type": "string",
"enum": [
"model",
"shield",
"vector_db",
"dataset",
"scoring_function",
"benchmark",
"tool",
"tool_group"
],
"title": "ResourceType",
"const": "dataset",
"default": "dataset"
},
@ -7443,7 +7572,6 @@
"additionalProperties": false,
"required": [
"identifier",
"provider_resource_id",
"provider_id",
"type",
"purpose",
@ -7573,6 +7701,17 @@
},
"type": {
"type": "string",
"enum": [
"model",
"shield",
"vector_db",
"dataset",
"scoring_function",
"benchmark",
"tool",
"tool_group"
],
"title": "ResourceType",
"const": "model",
"default": "model"
},
@ -7609,7 +7748,6 @@
"additionalProperties": false,
"required": [
"identifier",
"provider_resource_id",
"provider_id",
"type",
"metadata",
@ -7808,6 +7946,17 @@
},
"type": {
"type": "string",
"enum": [
"model",
"shield",
"vector_db",
"dataset",
"scoring_function",
"benchmark",
"tool",
"tool_group"
],
"title": "ResourceType",
"const": "scoring_function",
"default": "scoring_function"
},
@ -7849,7 +7998,6 @@
"additionalProperties": false,
"required": [
"identifier",
"provider_resource_id",
"provider_id",
"type",
"metadata",
@ -7901,6 +8049,17 @@
},
"type": {
"type": "string",
"enum": [
"model",
"shield",
"vector_db",
"dataset",
"scoring_function",
"benchmark",
"tool",
"tool_group"
],
"title": "ResourceType",
"const": "shield",
"default": "shield"
},
@ -7933,7 +8092,6 @@
"additionalProperties": false,
"required": [
"identifier",
"provider_resource_id",
"provider_id",
"type"
],
@ -8113,6 +8271,17 @@
},
"type": {
"type": "string",
"enum": [
"model",
"shield",
"vector_db",
"dataset",
"scoring_function",
"benchmark",
"tool",
"tool_group"
],
"title": "ResourceType",
"const": "tool",
"default": "tool"
},
@ -8160,7 +8329,6 @@
"additionalProperties": false,
"required": [
"identifier",
"provider_resource_id",
"provider_id",
"type",
"toolgroup_id",
@ -8193,6 +8361,17 @@
},
"type": {
"type": "string",
"enum": [
"model",
"shield",
"vector_db",
"dataset",
"scoring_function",
"benchmark",
"tool",
"tool_group"
],
"title": "ResourceType",
"const": "tool_group",
"default": "tool_group"
},
@ -8228,7 +8407,6 @@
"additionalProperties": false,
"required": [
"identifier",
"provider_resource_id",
"provider_id",
"type"
],
@ -8395,6 +8573,17 @@
},
"type": {
"type": "string",
"enum": [
"model",
"shield",
"vector_db",
"dataset",
"scoring_function",
"benchmark",
"tool",
"tool_group"
],
"title": "ResourceType",
"const": "vector_db",
"default": "vector_db"
},
@ -8408,7 +8597,6 @@
"additionalProperties": false,
"required": [
"identifier",
"provider_resource_id",
"provider_id",
"type",
"embedding_model",
@ -9110,6 +9298,15 @@
}
}
},
"EventType": {
"type": "string",
"enum": [
"unstructured_log",
"structured_log",
"metric"
],
"title": "EventType"
},
"LogSeverity": {
"type": "string",
"enum": [
@ -9158,7 +9355,7 @@
}
},
"type": {
"type": "string",
"$ref": "#/components/schemas/EventType",
"const": "metric",
"default": "metric"
},
@ -9195,7 +9392,7 @@
"type": "object",
"properties": {
"type": {
"type": "string",
"$ref": "#/components/schemas/StructuredLogType",
"const": "span_end",
"default": "span_end"
},
@ -9214,7 +9411,7 @@
"type": "object",
"properties": {
"type": {
"type": "string",
"$ref": "#/components/schemas/StructuredLogType",
"const": "span_start",
"default": "span_start"
},
@ -9268,7 +9465,7 @@
}
},
"type": {
"type": "string",
"$ref": "#/components/schemas/EventType",
"const": "structured_log",
"default": "structured_log"
},
@ -9303,6 +9500,14 @@
}
}
},
"StructuredLogType": {
"type": "string",
"enum": [
"span_start",
"span_end"
],
"title": "StructuredLogType"
},
"UnstructuredLogEvent": {
"type": "object",
"properties": {
@ -9339,7 +9544,7 @@
}
},
"type": {
"type": "string",
"$ref": "#/components/schemas/EventType",
"const": "unstructured_log",
"default": "unstructured_log"
},

View file

@ -2812,10 +2812,13 @@ components:
properties:
type:
type: string
const: grammar
default: grammar
enum:
- json_schema
- grammar
description: >-
Must be "grammar" to identify this format type
const: grammar
default: grammar
bnf:
type: object
additionalProperties:
@ -2897,10 +2900,13 @@ components:
properties:
type:
type: string
const: json_schema
default: json_schema
enum:
- json_schema
- grammar
description: >-
Must be "json_schema" to identify this format type
const: json_schema
default: json_schema
json_schema:
type: object
additionalProperties:
@ -3959,6 +3965,13 @@ components:
description: The time the step completed.
step_type:
type: string
enum:
- inference
- tool_execution
- shield_call
- memory_retrieval
title: StepType
description: Type of the step in an agent turn.
const: inference
default: inference
model_response:
@ -3991,6 +4004,13 @@ components:
description: The time the step completed.
step_type:
type: string
enum:
- inference
- tool_execution
- shield_call
- memory_retrieval
title: StepType
description: Type of the step in an agent turn.
const: memory_retrieval
default: memory_retrieval
vector_db_ids:
@ -4052,6 +4072,13 @@ components:
description: The time the step completed.
step_type:
type: string
enum:
- inference
- tool_execution
- shield_call
- memory_retrieval
title: StepType
description: Type of the step in an agent turn.
const: shield_call
default: shield_call
violation:
@ -4083,6 +4110,13 @@ components:
description: The time the step completed.
step_type:
type: string
enum:
- inference
- tool_execution
- shield_call
- memory_retrieval
title: StepType
description: Type of the step in an agent turn.
const: tool_execution
default: tool_execution
tool_calls:
@ -4245,6 +4279,14 @@ components:
properties:
event_type:
type: string
enum:
- step_start
- step_complete
- step_progress
- turn_start
- turn_complete
- turn_awaiting_input
title: AgentTurnResponseEventType
const: step_complete
default: step_complete
step_type:
@ -4283,6 +4325,14 @@ components:
properties:
event_type:
type: string
enum:
- step_start
- step_complete
- step_progress
- turn_start
- turn_complete
- turn_awaiting_input
title: AgentTurnResponseEventType
const: step_progress
default: step_progress
step_type:
@ -4310,6 +4360,14 @@ components:
properties:
event_type:
type: string
enum:
- step_start
- step_complete
- step_progress
- turn_start
- turn_complete
- turn_awaiting_input
title: AgentTurnResponseEventType
const: step_start
default: step_start
step_type:
@ -4354,6 +4412,14 @@ components:
properties:
event_type:
type: string
enum:
- step_start
- step_complete
- step_progress
- turn_start
- turn_complete
- turn_awaiting_input
title: AgentTurnResponseEventType
const: turn_awaiting_input
default: turn_awaiting_input
turn:
@ -4369,6 +4435,14 @@ components:
properties:
event_type:
type: string
enum:
- step_start
- step_complete
- step_progress
- turn_start
- turn_complete
- turn_awaiting_input
title: AgentTurnResponseEventType
const: turn_complete
default: turn_complete
turn:
@ -4383,6 +4457,14 @@ components:
properties:
event_type:
type: string
enum:
- step_start
- step_complete
- step_progress
- turn_start
- turn_complete
- turn_awaiting_input
title: AgentTurnResponseEventType
const: turn_start
default: turn_start
turn_id:
@ -4825,7 +4907,7 @@ components:
type: object
properties:
type:
type: string
$ref: '#/components/schemas/ScoringFnParamsType'
const: basic
default: basic
aggregation_functions:
@ -4835,6 +4917,7 @@ components:
additionalProperties: false
required:
- type
- aggregation_functions
title: BasicScoringFnParams
BenchmarkConfig:
type: object
@ -4874,7 +4957,7 @@ components:
type: object
properties:
type:
type: string
$ref: '#/components/schemas/ScoringFnParamsType'
const: llm_as_judge
default: llm_as_judge
judge_model:
@ -4893,6 +4976,8 @@ components:
required:
- type
- judge_model
- judge_score_regexes
- aggregation_functions
title: LLMAsJudgeScoringFnParams
ModelCandidate:
type: object
@ -4923,7 +5008,7 @@ components:
type: object
properties:
type:
type: string
$ref: '#/components/schemas/ScoringFnParamsType'
const: regex_parser
default: regex_parser
parsing_regexes:
@ -4937,6 +5022,8 @@ components:
additionalProperties: false
required:
- type
- parsing_regexes
- aggregation_functions
title: RegexParserScoringFnParams
ScoringFnParams:
oneOf:
@ -4949,6 +5036,13 @@ components:
llm_as_judge: '#/components/schemas/LLMAsJudgeScoringFnParams'
regex_parser: '#/components/schemas/RegexParserScoringFnParams'
basic: '#/components/schemas/BasicScoringFnParams'
ScoringFnParamsType:
type: string
enum:
- llm_as_judge
- regex_parser
- basic
title: ScoringFnParamsType
EvaluateRowsRequest:
type: object
properties:
@ -5111,6 +5205,16 @@ components:
type: string
type:
type: string
enum:
- model
- shield
- vector_db
- dataset
- scoring_function
- benchmark
- tool
- tool_group
title: ResourceType
const: benchmark
default: benchmark
dataset_id:
@ -5132,7 +5236,6 @@ components:
additionalProperties: false
required:
- identifier
- provider_resource_id
- provider_id
- type
- dataset_id
@ -5159,6 +5262,16 @@ components:
type: string
type:
type: string
enum:
- model
- shield
- vector_db
- dataset
- scoring_function
- benchmark
- tool
- tool_group
title: ResourceType
const: dataset
default: dataset
purpose:
@ -5185,7 +5298,6 @@ components:
additionalProperties: false
required:
- identifier
- provider_resource_id
- provider_id
- type
- purpose
@ -5284,6 +5396,16 @@ components:
type: string
type:
type: string
enum:
- model
- shield
- vector_db
- dataset
- scoring_function
- benchmark
- tool
- tool_group
title: ResourceType
const: model
default: model
metadata:
@ -5302,7 +5424,6 @@ components:
additionalProperties: false
required:
- identifier
- provider_resource_id
- provider_id
- type
- metadata
@ -5438,6 +5559,16 @@ components:
type: string
type:
type: string
enum:
- model
- shield
- vector_db
- dataset
- scoring_function
- benchmark
- tool
- tool_group
title: ResourceType
const: scoring_function
default: scoring_function
description:
@ -5459,7 +5590,6 @@ components:
additionalProperties: false
required:
- identifier
- provider_resource_id
- provider_id
- type
- metadata
@ -5498,6 +5628,16 @@ components:
type: string
type:
type: string
enum:
- model
- shield
- vector_db
- dataset
- scoring_function
- benchmark
- tool
- tool_group
title: ResourceType
const: shield
default: shield
params:
@ -5513,7 +5653,6 @@ components:
additionalProperties: false
required:
- identifier
- provider_resource_id
- provider_id
- type
title: Shield
@ -5628,6 +5767,16 @@ components:
type: string
type:
type: string
enum:
- model
- shield
- vector_db
- dataset
- scoring_function
- benchmark
- tool
- tool_group
title: ResourceType
const: tool
default: tool
toolgroup_id:
@ -5653,7 +5802,6 @@ components:
additionalProperties: false
required:
- identifier
- provider_resource_id
- provider_id
- type
- toolgroup_id
@ -5679,6 +5827,16 @@ components:
type: string
type:
type: string
enum:
- model
- shield
- vector_db
- dataset
- scoring_function
- benchmark
- tool
- tool_group
title: ResourceType
const: tool_group
default: tool_group
mcp_endpoint:
@ -5696,7 +5854,6 @@ components:
additionalProperties: false
required:
- identifier
- provider_resource_id
- provider_id
- type
title: ToolGroup
@ -5810,6 +5967,16 @@ components:
type: string
type:
type: string
enum:
- model
- shield
- vector_db
- dataset
- scoring_function
- benchmark
- tool
- tool_group
title: ResourceType
const: vector_db
default: vector_db
embedding_model:
@ -5819,7 +5986,6 @@ components:
additionalProperties: false
required:
- identifier
- provider_resource_id
- provider_id
- type
- embedding_model
@ -6259,6 +6425,13 @@ components:
unstructured_log: '#/components/schemas/UnstructuredLogEvent'
metric: '#/components/schemas/MetricEvent'
structured_log: '#/components/schemas/StructuredLogEvent'
EventType:
type: string
enum:
- unstructured_log
- structured_log
- metric
title: EventType
LogSeverity:
type: string
enum:
@ -6289,7 +6462,7 @@ components:
- type: boolean
- type: 'null'
type:
type: string
$ref: '#/components/schemas/EventType'
const: metric
default: metric
metric:
@ -6314,7 +6487,7 @@ components:
type: object
properties:
type:
type: string
$ref: '#/components/schemas/StructuredLogType'
const: span_end
default: span_end
status:
@ -6328,7 +6501,7 @@ components:
type: object
properties:
type:
type: string
$ref: '#/components/schemas/StructuredLogType'
const: span_start
default: span_start
name:
@ -6360,7 +6533,7 @@ components:
- type: boolean
- type: 'null'
type:
type: string
$ref: '#/components/schemas/EventType'
const: structured_log
default: structured_log
payload:
@ -6382,6 +6555,12 @@ components:
mapping:
span_start: '#/components/schemas/SpanStartPayload'
span_end: '#/components/schemas/SpanEndPayload'
StructuredLogType:
type: string
enum:
- span_start
- span_end
title: StructuredLogType
UnstructuredLogEvent:
type: object
properties:
@ -6402,7 +6581,7 @@ components:
- type: boolean
- type: 'null'
type:
type: string
$ref: '#/components/schemas/EventType'
const: unstructured_log
default: unstructured_log
message: