Skip to content

Commit 7517bf7

Browse files
authored
Merge pull request #621 from tisnik/fields-for-responses
Fields for responses
2 parents 145f5e8 + dcf6596 commit 7517bf7

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

src/models/responses.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ class QueryResponse(BaseModel):
9696
],
9797
)
9898

99-
rag_chunks: list[RAGChunk] = []
99+
rag_chunks: list[RAGChunk] = Field(
100+
[],
101+
description="List of RAG chunks used to generate the response",
102+
)
100103

101104
tool_calls: Optional[list[ToolCall]] = Field(
102105
None,
@@ -310,7 +313,20 @@ class LivenessResponse(BaseModel):
310313
class NotAvailableResponse(BaseModel):
311314
"""Model representing error response for readiness endpoint."""
312315

313-
detail: dict[str, str]
316+
detail: dict[str, str] = Field(
317+
...,
318+
description="Detailed information about readiness state",
319+
examples=[
320+
{
321+
"response": "Service is not ready",
322+
"cause": "Index is not ready",
323+
},
324+
{
325+
"response": "Service is not ready",
326+
"cause": "LLM is not ready",
327+
},
328+
],
329+
)
314330

315331
# provides examples for /docs endpoint
316332
model_config = {
@@ -433,7 +449,11 @@ class AuthorizedResponse(BaseModel):
433449
class UnauthorizedResponse(BaseModel):
434450
"""Model representing response for missing or invalid credentials."""
435451

436-
detail: str
452+
detail: str = Field(
453+
...,
454+
description="Details about the authorization issue",
455+
examples=["Missing or invalid credentials provided by client"],
456+
)
437457

438458
# provides examples for /docs endpoint
439459
model_config = {

0 commit comments

Comments
 (0)