Skip to content

Commit bc1fcc0

Browse files
committed
made exception catches more specific
1 parent 3748406 commit bc1fcc0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

effectful/handlers/llm/completions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def _call_assistant[T, U](
293293
try:
294294
decoded_tool_call = decode_tool_call(validated_tool_call, tools)
295295
tool_calls.append(decoded_tool_call)
296-
except Exception as e:
296+
except (KeyError, pydantic.ValidationError) as e:
297297
decoding_errors.append((validated_tool_call, e))
298298

299299
# If there were tool call decoding errors, add error feedback and retry
@@ -345,7 +345,7 @@ def _call_assistant[T, U](
345345
tool_calls,
346346
result,
347347
)
348-
except Exception as e:
348+
except pydantic.ValidationError as e:
349349
last_error = e
350350
# Add the assistant message and error feedback for result decoding failure
351351
messages_list.append(

0 commit comments

Comments
 (0)