Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 32 additions & 6 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,11 @@
"properties": {
"conversation_id": {
"type": "string",
"title": "Conversation Id"
"title": "Conversation Id",
"description": "Conversation ID (UUID)",
"examples": [
"c5260aec-4d82-4370-9fdf-05cf908b3f16"
]
},
"created_at": {
"anyOf": [
Expand All @@ -1111,7 +1115,11 @@
"type": "null"
}
],
"title": "Created At"
"title": "Created At",
"description": "When the conversation was created",
"examples": [
"2024-01-01T01:00:00Z"
]
},
"last_message_at": {
"anyOf": [
Expand All @@ -1122,7 +1130,11 @@
"type": "null"
}
],
"title": "Last Message At"
"title": "Last Message At",
"description": "When the last message was sent",
"examples": [
"2024-01-01T01:00:00Z"
]
},
"message_count": {
"anyOf": [
Expand All @@ -1133,7 +1145,11 @@
"type": "null"
}
],
"title": "Message Count"
"title": "Message Count",
"description": "Number of user messages in the conversation",
"examples": [
42
]
},
"last_used_model": {
"anyOf": [
Expand All @@ -1144,7 +1160,12 @@
"type": "null"
}
],
"title": "Last Used Model"
"title": "Last Used Model",
"description": "Identification of the last model used for the conversation",
"examples": [
"gpt-4-turbo",
"gpt-3.5-turbo-0125"
]
},
"last_used_provider": {
"anyOf": [
Expand All @@ -1155,7 +1176,12 @@
"type": "null"
}
],
"title": "Last Used Provider"
"title": "Last Used Provider",
"description": "Identification of the last provider used for the conversation",
"examples": [
"openai",
"gemini"
]
}
},
"type": "object",
Expand Down
12 changes: 6 additions & 6 deletions docs/openapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -609,12 +609,12 @@ Example:

| Field | Type | Description |
|-------|------|-------------|
| conversation_id | string | |
| created_at | | |
| last_message_at | | |
| message_count | | |
| last_used_model | | |
| last_used_provider | | |
| conversation_id | string | Conversation ID (UUID) |
| created_at | | When the conversation was created |
| last_message_at | | When the last message was sent |
| message_count | | Number of user messages in the conversation |
| last_used_model | | Identification of the last model used for the conversation |
| last_used_provider | | Identification of the last provider used for the conversation |


## ConversationResponse
Expand Down
12 changes: 6 additions & 6 deletions docs/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -609,12 +609,12 @@ Example:

| Field | Type | Description |
|-------|------|-------------|
| conversation_id | string | |
| created_at | | |
| last_message_at | | |
| message_count | | |
| last_used_model | | |
| last_used_provider | | |
| conversation_id | string | Conversation ID (UUID) |
| created_at | | When the conversation was created |
| last_message_at | | When the last message was sent |
| message_count | | Number of user messages in the conversation |
| last_used_model | | Identification of the last model used for the conversation |
| last_used_provider | | Identification of the last provider used for the conversation |


## ConversationResponse
Expand Down
41 changes: 35 additions & 6 deletions src/models/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,41 @@ class ConversationDetails(BaseModel):
```
"""

conversation_id: str
created_at: Optional[str] = None
last_message_at: Optional[str] = None
message_count: Optional[int] = None
last_used_model: Optional[str] = None
last_used_provider: Optional[str] = None
conversation_id: str = Field(
...,
description="Conversation ID (UUID)",
examples=["c5260aec-4d82-4370-9fdf-05cf908b3f16"],
)

created_at: Optional[str] = Field(
None,
description="When the conversation was created",
examples=["2024-01-01T01:00:00Z"],
)

last_message_at: Optional[str] = Field(
None,
description="When the last message was sent",
examples=["2024-01-01T01:00:00Z"],
)

message_count: Optional[int] = Field(
None,
description="Number of user messages in the conversation",
examples=[42],
)
Comment on lines +491 to +507
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Use precise types and basic validation for timestamps and counts.

This tightens schema and improves docs without changing behavior.

-    created_at: Optional[str] = Field(
-        None,
-        description="When the conversation was created",
-        examples=["2024-01-01T01:00:00Z"],
-    )
+    created_at: Optional[datetime] = Field(
+        None,
+        description="When the conversation was created",
+        examples=["2024-01-01T01:00:00Z"],
+    )
@@
-    last_message_at: Optional[str] = Field(
-        None,
-        description="When the last message was sent",
-        examples=["2024-01-01T01:00:00Z"],
-    )
+    last_message_at: Optional[datetime] = Field(
+        None,
+        description="When the last message was sent",
+        examples=["2024-01-01T01:00:00Z"],
+    )
@@
-    message_count: Optional[int] = Field(
-        None,
-        description="Number of user messages in the conversation",
-        examples=[42],
-    )
+    message_count: Optional[int] = Field(
+        None,
+        ge=0,
+        description="Number of user messages in the conversation",
+        examples=[42],
+    )

Add the import:

+from datetime import datetime
🤖 Prompt for AI Agents
In src/models/responses.py around lines 491 to 507, tighten the schema by using
proper datetime types for timestamps and a non-negative constrained int for
message_count: change created_at and last_message_at from Optional[str] to
Optional[datetime] and change message_count to Optional[conint(ge=0)], keep the
Field descriptions and examples but ensure examples remain ISO8601 strings, and
add the imports "from datetime import datetime" and "from pydantic import
conint" at the top of the file.


last_used_model: Optional[str] = Field(
None,
description="Identification of the last model used for the conversation",
examples=["gpt-4-turbo", "gpt-3.5-turbo-0125"],
)

last_used_provider: Optional[str] = Field(
None,
description="Identification of the last provider used for the conversation",
examples=["openai", "gemini"],
)


class ConversationsListResponse(BaseModel):
Expand Down