Skip to content

Commit

Permalink
narrow type to OpenAISchema
Browse files Browse the repository at this point in the history
  • Loading branch information
savarin committed Feb 12, 2024
1 parent eafeeb9 commit 9cfd5eb
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions instructor/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from typing import (
Any,
Callable,
Coroutine,
Dict,
Generator,
get_args,
Expand Down Expand Up @@ -277,7 +276,7 @@ async def process_response_async(


async def retry_async( # type: ignore[return]
func: Callable[..., Coroutine[Any, Any, ChatCompletion]],
func: Callable[..., ChatCompletion],
response_model: Union[Type[OpenAISchema], ParallelBase],
validation_context: Optional[Dict[str, Any]],
args: Tuple[Any, ...],
Expand Down Expand Up @@ -541,7 +540,7 @@ async def new_create_async(
max_retries: int = 1,
*args: Any,
**kwargs: Any,
) -> Union[BaseModel, List[BaseModel]]:
) -> Union[OpenAISchema, List[OpenAISchema], Dict[str, Any], Generator[Any, None, None]]:
new_response_model, new_kwargs = handle_response_model(
response_model=response_model, mode=mode, **kwargs
)
Expand All @@ -563,7 +562,7 @@ def new_create_sync(
max_retries: int = 1,
*args: Any,
**kwargs: Any,
) -> Union[BaseModel, List[BaseModel]]:
) -> Union[OpenAISchema, List[OpenAISchema]]:
new_response_model, new_kwargs = handle_response_model(
response_model=response_model, mode=mode, **kwargs
)
Expand Down

0 comments on commit 9cfd5eb

Please sign in to comment.