Fix apatch (#165)

This commit is contained in:
Jason Liu
2023-11-11 16:24:54 -05:00
committed by GitHub
parent 21eaa812e3
commit 3d2035bb30
6 changed files with 104 additions and 33 deletions
+3 -5
View File
@@ -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