88class ModelsResponse (BaseModel ):
99 """Model representing a response to models request."""
1010
11- models : list [dict [str , Any ]]
11+ models : list [dict [str , Any ]] = Field (
12+ ...,
13+ description = "List of models available" ,
14+ examples = [
15+ {
16+ "identifier" : "openai/gpt-4-turbo" ,
17+ "metadata" : {},
18+ "api_model_type" : "llm" ,
19+ "provider_id" : "openai" ,
20+ "type" : "model" ,
21+ "provider_resource_id" : "gpt-4-turbo" ,
22+ "model_type" : "llm" ,
23+ },
24+ {
25+ "identifier" : "openai/gpt-3.5-turbo-0125" ,
26+ "metadata" : {},
27+ "api_model_type" : "llm" ,
28+ "provider_id" : "openai" ,
29+ "type" : "model" ,
30+ "provider_resource_id" : "gpt-3.5-turbo-0125" ,
31+ "model_type" : "llm" ,
32+ },
33+ ],
34+ )
1235
1336
1437# TODO(lucasagomes): a lot of fields to add to QueryResponse. For now
@@ -30,8 +53,18 @@ class QueryResponse(BaseModel):
3053 response: The response.
3154 """
3255
33- conversation_id : Optional [str ] = None
34- response : str
56+ conversation_id : Optional [str ] = Field (
57+ None ,
58+ description = "The optional conversation ID (UUID)" ,
59+ examples = ["c5260aec-4d82-4370-9fdf-05cf908b3f16" ],
60+ )
61+
62+ response : str = Field (
63+ description = "Response from LLM" ,
64+ examples = [
65+ "Kubernetes is an open-source container orchestration system for automating ..."
66+ ],
67+ )
3568
3669 # provides examples for /docs endpoint
3770 model_config = {
@@ -62,8 +95,15 @@ class InfoResponse(BaseModel):
6295 ```
6396 """
6497
65- name : str
66- version : str
98+ name : str = Field (
99+ description = "Service name" ,
100+ examples = ["Lightspeed Stack" ],
101+ )
102+
103+ version : str = Field (
104+ description = "Service version" ,
105+ examples = ["0.1.0" , "0.2.0" , "1.0.0" ],
106+ )
67107
68108 # provides examples for /docs endpoint
69109 model_config = {
@@ -483,7 +523,23 @@ class ConversationsListResponse(BaseModel):
483523class ErrorResponse (BaseModel ):
484524 """Model representing error response for query endpoint."""
485525
486- detail : dict [str , str ]
526+ detail : dict [str , str ] = Field (
527+ description = "Error details" ,
528+ examples = [
529+ {
530+ "detail" : {
531+ "response" : "Error while validation question" ,
532+ "cause" : "Failed to handle request to https://bam-api.res.ibm.com/v2/text" ,
533+ },
534+ },
535+ {
536+ "detail" : {
537+ "response" : "Error retrieving conversation history" ,
538+ "cause" : "Invalid conversation ID 1237-e89b-12d3-a456-426614174000" ,
539+ },
540+ },
541+ ],
542+ )
487543
488544 model_config = {
489545 "json_schema_extra" : {
0 commit comments