Skip to content

Commit a73311c

Browse files
updating ID length in all places
1 parent 5d28182 commit a73311c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/nat/data_models/api_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ class ResponsesOutputItem(BaseModel):
10591059
"""Output item in Responses API format."""
10601060

10611061
type: typing.Literal["message"] = "message"
1062-
id: str = Field(default_factory=lambda: f"msg_test_{uuid.uuid4().hex}[:24]")
1062+
id: str = Field(default_factory=lambda: f"msg_{uuid.uuid4().hex}{uuid.uuid4().hex}"[:56])
10631063
status: typing.Literal["in_progress", "completed", "incomplete"] = "completed"
10641064
role: typing.Literal["assistant"] = "assistant"
10651065
content: list[ResponsesOutputContent] = Field(default_factory=list)
@@ -1079,7 +1079,7 @@ class ResponsesAPIResponse(ResponseBaseModelOutput):
10791079
https://platform.openai.com/docs/api-reference/responses
10801080
"""
10811081

1082-
id: str = Field(default_factory=lambda: f"resp_{uuid.uuid4().hex}[:24]")
1082+
id: str = Field(default_factory=lambda: f"resp_{uuid.uuid4().hex}{uuid.uuid4().hex}"[:55])
10831083
object: typing.Literal["response"] = "response"
10841084
created_at: int = Field(
10851085
default_factory=lambda: int(datetime.datetime.now(tz=datetime.timezone.utc).timestamp()))

src/nat/front_ends/fastapi/response_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ async def generate_responses_api_streaming(
233233
_logger = logging.getLogger(__name__)
234234

235235
response_id = f"resp_{uuid_module.uuid4().hex}{uuid_module.uuid4().hex}"[:55]
236-
message_id = f"msg_{uuid_module.uuid4().hex[:24]}"
236+
message_id = f"msg_{uuid_module.uuid4().hex}{uuid_module.uuid4().hex}"[:55]
237237
output_index = 0
238238
content_index = 0
239239
accumulated_text = ""

0 commit comments

Comments
 (0)