result_types
Class info¶
Classes¶
Name | Children | Inherits |
---|---|---|
BaseResponseDefinition llmling_agent.models.result_types Base class for response definitions. |
||
ImportedResponseDefinition llmling_agent.models.result_types Response definition that imports an existing Pydantic model. |
||
InlineResponseDefinition llmling_agent.models.result_types Inline definition of an agent's response structure. |
||
ResponseField llmling_agent.models.result_types Field definition for inline response types. |
🛈 DocStrings¶
Models for response fields and definitions.
BaseResponseDefinition
¶
Bases: BaseModel
Base class for response definitions.
Source code in src/llmling_agent/models/result_types.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
description
class-attribute
instance-attribute
¶
description: str | None = None
A description for this response definition.
result_retries
class-attribute
instance-attribute
¶
result_retries: int | None = None
Retry override. How often the Agent should try to validate the response.
ImportedResponseDefinition
¶
Bases: BaseResponseDefinition
Response definition that imports an existing Pydantic model.
Allows using externally defined Pydantic models as response types. Benefits: - Reuse existing model definitions - Full Python type support - Complex validation logic - IDE support for imported types
Example
responses: AnalysisResult: type: import import_path: myapp.models.AnalysisResult
Source code in src/llmling_agent/models/result_types.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
import_path
instance-attribute
¶
import_path: str
The path to the pydantic model to use as the response type.
type
class-attribute
instance-attribute
¶
type: Literal['import'] = Field('import', init=False)
Import-path based response definition.
resolve_model
¶
resolve_model() -> type[BaseModel]
Import and return the model class.
Source code in src/llmling_agent/models/result_types.py
126 127 128 129 130 131 132 133 134 135 136 137 |
|
InlineResponseDefinition
¶
Bases: BaseResponseDefinition
Inline definition of an agent's response structure.
Allows defining response types directly in the configuration using: - Field definitions with types and descriptions - Optional validation constraints - Custom field descriptions
Example
responses: BasicResult: type: inline fields: success: {type: bool, description: "Operation success"} message: {type: str, description: "Result details"}
Source code in src/llmling_agent/models/result_types.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
type
class-attribute
instance-attribute
¶
type: Literal['inline'] = Field('inline', init=False)
Inline response definition.
create_model
¶
create_model() -> type[BaseModel]
Create Pydantic model from inline definition.
Source code in src/llmling_agent/models/result_types.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
ResponseField
¶
Bases: BaseModel
Field definition for inline response types.
Defines a single field in an inline response definition, including: - Data type specification - Optional description - Validation constraints
Used by InlineResponseDefinition to structure response fields.
Source code in src/llmling_agent/models/result_types.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|