Skip to content

Commit

Permalink
implement #665;
Browse files Browse the repository at this point in the history
  • Loading branch information
ellipsis-dev[bot] committed May 29, 2024
1 parent 81b6a76 commit e1ca7c2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions instructor/dsl/partial.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from __future__ import annotations

import pydantic_core
import jitter

Check failure on line 11 in instructor/dsl/partial.py

View workflow job for this annotation

GitHub Actions / Pyright (macos-latest, 3.11)

Import "jitter" could not be resolved (reportMissingImports)

Check failure on line 11 in instructor/dsl/partial.py

View workflow job for this annotation

GitHub Actions / Pyright (ubuntu-latest, 3.9)

Import "jitter" could not be resolved (reportMissingImports)

Check failure on line 11 in instructor/dsl/partial.py

View workflow job for this annotation

GitHub Actions / Pyright (ubuntu-latest, 3.10)

Import "jitter" could not be resolved (reportMissingImports)
from pydantic import BaseModel, create_model # type: ignore - remove once Pydantic is updated
from pydantic.fields import FieldInfo
from typing import (
Expand Down Expand Up @@ -128,7 +128,7 @@ def model_from_chunks(
for chunk in json_chunks:
potential_object += chunk

obj = pydantic_core.from_json(potential_object or "{}", allow_partial=True)
jitter.from_json(potential_object or "{}", allow_partial=True)
obj = partial_model.model_validate(obj, strict=None, **kwargs)
yield obj

Expand All @@ -140,7 +140,7 @@ async def model_from_chunks_async(
partial_model = cls.get_partial_model()
async for chunk in json_chunks:
potential_object += chunk
obj = pydantic_core.from_json(potential_object or "{}", allow_partial=True)
jitter.from_json(potential_object or "{}", allow_partial=True)
obj = partial_model.model_validate(obj, strict=None, **kwargs)
yield obj

Expand Down Expand Up @@ -302,4 +302,4 @@ def _wrap_models(field: FieldInfo) -> tuple[object, FieldInfo]:
)
for field_name, field_info in wrapped_class.model_fields.items()
},
) # type: ignore
) # type: ignore

0 comments on commit e1ca7c2

Please sign in to comment.