Skip to content

Commit

Permalink
adding support for async validation
Browse files Browse the repository at this point in the history
  • Loading branch information
tvt173 committed Jan 25, 2025
1 parent f86df78 commit 76a7478
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions instructor/process_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ async def process_response_async(
response,
mode=mode,
)
if hasattr(response_model, "model_async_validate"):
await response_model.model_async_validate(model)
return model

model = response_model.from_response(
Expand All @@ -92,6 +94,8 @@ async def process_response_async(
strict=strict,
mode=mode,
)
if hasattr(response_model, "model_async_validate"):
await response_model.model_async_validate(model)

# ? This really hints at the fact that we need a better way of
# ? attaching usage data and the raw response to the model we return.
Expand Down

0 comments on commit 76a7478

Please sign in to comment.