mirror of
https://github.com/kennethreitz/instructor.git
synced 2026-06-05 22:50:18 +00:00
Fix apatch (#165)
This commit is contained in:
+3
-5
@@ -134,9 +134,7 @@ def retry_sync(
|
||||
raise e
|
||||
|
||||
|
||||
def wrap_chatcompletion(func: Callable) -> Callable:
|
||||
is_async = inspect.iscoroutinefunction(func)
|
||||
|
||||
def wrap_chatcompletion(func: Callable, is_async: bool = None) -> Callable:
|
||||
@wraps(func)
|
||||
async def new_chatcompletion_async(
|
||||
response_model=None,
|
||||
@@ -211,7 +209,7 @@ def apatch(client):
|
||||
- `validation_context` parameter to validate the response using the pydantic model
|
||||
- `strict` parameter to use strict json parsing
|
||||
"""
|
||||
client.chat.completions.acreate = wrap_chatcompletion(
|
||||
client.chat.completions.acreate
|
||||
client.chat.completions.create = wrap_chatcompletion(
|
||||
client.chat.completions.create, is_async=True
|
||||
)
|
||||
return client
|
||||
|
||||
Reference in New Issue
Block a user