Skip to content

Commit

Permalink
fix oai provider bug (#696)
Browse files Browse the repository at this point in the history
  • Loading branch information
emrgnt-cmplxty authored Jul 14, 2024
1 parent c61cf66 commit 2be5fac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "r2r"
version = "0.2.59"
version = "0.2.60"
description = "SciPhi R2R"
authors = ["Owen Colegrove <[email protected]>"]
license = "MIT"
Expand Down
5 changes: 3 additions & 2 deletions r2r/providers/llms/openai/base_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(
"The provided config must be an instance of OpenAIConfig."
)
try:
from openai import OpenAI # noqa
from openai import AsyncOpenAI, OpenAI # noqa
except ImportError:
raise ImportError(
"Error, `openai` is required to run an OpenAILLM. Please install it using `pip install openai`."
Expand All @@ -44,6 +44,7 @@ def __init__(
)
super().__init__(config)
self.config: LLMConfig = config
self.async_client = AsyncOpenAI()
self.client = OpenAI()

def get_completion(
Expand Down Expand Up @@ -141,4 +142,4 @@ async def _aget_completion(

args = {**args, **kwargs}
# Create the chat completion
return await self.client.chat.completions.create(**args)
return await self.async_client.chat.completions.create(**args)

0 comments on commit 2be5fac

Please sign in to comment.