File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
llama_stack/providers/utils/inference Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 55# the root directory of this source tree.
66import asyncio
77from typing import Any
8+
89from sqlalchemy .exc import IntegrityError
910
1011from llama_stack .apis .inference import (
@@ -144,15 +145,15 @@ async def _write_chat_completion(
144145 data = record_data ,
145146 )
146147 except IntegrityError as e :
148+ # Duplicate chat completion IDs can be generated during tests especially if they are replaying
149+ # recorded responses across different tests. No need to warn or error under those circumstances.
150+ # In the wild, this is not likely to happen at all (no evidence) so we aren't really hiding any problem.
151+
147152 # Check if it's a unique constraint violation
148153 error_message = str (e .orig ) if e .orig else str (e )
149154 if self ._is_unique_constraint_error (error_message ):
150155 # Update the existing record instead
151- await self .sql_store .update (
152- table = "chat_completions" ,
153- data = record_data ,
154- where = {"id" : data ["id" ]}
155- )
156+ await self .sql_store .update (table = "chat_completions" , data = record_data , where = {"id" : data ["id" ]})
156157 else :
157158 # Re-raise if it's not a unique constraint error
158159 raise
You can’t perform that action at this time.
0 commit comments