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 14, 2024
1 parent 681efec commit c89b67c
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 @@ -276,7 +275,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 @@ -540,7 +539,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 @@ -562,7 +561,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 c89b67c

Please sign in to comment.