Skip to content

Commit

Permalink
Remove the use of async validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanleomk committed Aug 19, 2024
1 parent b192528 commit 4948dd9
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions instructor/process_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from instructor.dsl.simple_type import AdapterBase, ModelAdapter, is_simple_type
from instructor.function_calls import OpenAISchema, openai_schema
from instructor.utils import merge_consecutive_messages
from instructor.validators import AsyncValidationError
from openai.types.chat import ChatCompletion
from pydantic import BaseModel, create_model
import json
Expand Down Expand Up @@ -81,11 +80,6 @@ async def process_response_async(
mode=mode,
)

if isinstance(model, OpenAISchema):
validation_errors = await model.model_async_validate(validation_context)
if validation_errors:
raise AsyncValidationError(f"Validation errors: {validation_errors}")

# ? 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.
if isinstance(model, IterableBase):
Expand Down Expand Up @@ -153,12 +147,6 @@ def process_response(
mode=mode,
)

if isinstance(model, OpenAISchema):
if model.has_async_validators():
logging.warning(
"Async Validators will not run in a synchronous client. Please make sure to use an Async client"
)

# ? 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.
if isinstance(model, IterableBase):
Expand Down

0 comments on commit 4948dd9

Please sign in to comment.