ClientResponse
Base class for client responses with metadata. Provides a consistent structure for all API response wrappers, including status information and request tracing.
Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
status_code | int | ✓ | PydanticUndefined | HTTP response status code |
headers | ForwardRef('Dict[str, str]') | ✗ | PydanticUndefined | HTTP response headers |
request_id | ForwardRef('Optional[str]') | ✗ | None | Unique request identifier for tracing |
Usage Example
from credoai.models import ClientResponse
# Create a new instance
model = ClientResponse(
status_code=123, # HTTP response status code
)
# Convert to dictionary
model_dict = model.model_dump()
print(model_dict)
# Create from dictionary
data = {
"status_code": 123,
}
model_from_dict = ClientResponse(**data)
JSON Schema
{
"type": "object",
"title": "ClientResponse",
"description": "Base class for client responses with metadata.
Provides a consistent structure for all API response wrappers,
including status information and request tracing.",
"properties": {
"status_code": {
"type": "int",
"description": "HTTP response status code"
},
"headers": {
"type": "forwardref('dict[str, str]')",
"description": "HTTP response headers"
},
"request_id": {
"type": "forwardref('optional[str]')",
"description": "Unique request identifier for tracing"
}
},
"required": ["status_code", ]
}