From 80f5bc3daf97cc2e09342b2cf15422d86f70c6c9 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Sun, 24 Aug 2025 12:52:53 +0200 Subject: [PATCH] Updated docstrings for models --- src/models/requests.py | 13 +++++++------ src/models/responses.py | 24 +++++++++++++++--------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/models/requests.py b/src/models/requests.py index 56c801ef..14755fbf 100644 --- a/src/models/requests.py +++ b/src/models/requests.py @@ -1,4 +1,4 @@ -"""Model for service requests.""" +"""Models for REST API requests.""" from typing import Optional, Self from enum import Enum @@ -13,9 +13,9 @@ class Attachment(BaseModel): - """Model representing an attachment that can be send from UI as part of query. + """Model representing an attachment that can be send from the UI as part of query. - List of attachments can be optional part of 'query' request. + A list of attachments can be an optional part of 'query' request. Attributes: attachment_type: The attachment type, like "log", "configuration" etc. @@ -23,7 +23,7 @@ class Attachment(BaseModel): content: The actual attachment content YAML attachments with **kind** and **metadata/name** attributes will - be handled as resources with specified name: + be handled as resources with the specified name: ``` kind: Pod metadata: @@ -40,7 +40,8 @@ class Attachment(BaseModel): examples=["text/plain"], ) content: str = Field( - description="The actual attachment content", examples=["warning: quota exceed"] + description="The actual attachment content", + examples=["warning: quota exceeded"], ) # provides examples for /docs endpoint @@ -212,7 +213,7 @@ def validate_provider_and_model(self) -> Self: @model_validator(mode="after") def validate_media_type(self) -> Self: - """Log use of media_type that is unsupported but kept for backwards compatibility.""" + """Log use of media_type that is unsupported but kept for backward compatibility.""" if self.media_type: logger.warning( "media_type was set in the request but is not supported. The value will be ignored." diff --git a/src/models/responses.py b/src/models/responses.py index 65311bd7..d55dd65f 100644 --- a/src/models/responses.py +++ b/src/models/responses.py @@ -1,4 +1,4 @@ -"""Models for service responses.""" +"""Models for REST API responses.""" from typing import Any, Optional @@ -80,7 +80,7 @@ class QueryResponse(BaseModel): class InfoResponse(BaseModel): - """Model representing a response to a info request. + """Model representing a response to an info request. Attributes: name: Service name. @@ -451,16 +451,18 @@ class ConversationDetails(BaseModel): 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. - model: The model used for the conversation. + last_used_model: The last model used for the conversation. + last_used_provider: The provider of the last used model. Example: ```python - conversation = ConversationSummary( + conversation = ConversationDetails( conversation_id="123e4567-e89b-12d3-a456-426614174000" created_at="2024-01-01T00:00:00Z", last_message_at="2024-01-01T00:05:00Z", message_count=5, - model="gemini/gemini-2.0-flash" + last_used_model="gemini/gemini-2.0-flash", + last_used_provider="gemini", ) ``` """ @@ -488,13 +490,15 @@ class ConversationsListResponse(BaseModel): created_at="2024-01-01T00:00:00Z", last_message_at="2024-01-01T00:05:00Z", message_count=5, - model="gemini/gemini-2.0-flash" + last_used_model="gemini/gemini-2.0-flash", + last_used_provider="gemini", ), ConversationDetails( conversation_id="456e7890-e12b-34d5-a678-901234567890" created_at="2024-01-01T01:00:00Z", message_count=2, - model="gemini/gemini-2.5-flash" + last_used_model="gemini/gemini-2.0-flash", + last_used_provider="gemini", ) ] ) @@ -514,13 +518,15 @@ class ConversationsListResponse(BaseModel): "created_at": "2024-01-01T00:00:00Z", "last_message_at": "2024-01-01T00:05:00Z", "message_count": 5, - "model": "gemini/gemini-2.0-flash", + "last_used_model": "gemini/gemini-2.0-flash", + "last_used_provider": "gemini", }, { "conversation_id": "456e7890-e12b-34d5-a678-901234567890", "created_at": "2024-01-01T01:00:00Z", "message_count": 2, - "model": "gemini/gemini-2.5-flash", + "last_used_model": "gemini/gemini-2.5-flash", + "last_used_provider": "gemini", }, ] }