diff --git a/semantic_router/layer.py b/semantic_router/layer.py index b5c9475a37235c3296be2efb41d8d9647955a852..ac55db983d57a96d0e2dff0d5b8b1b13ce5c6b27 100644 --- a/semantic_router/layer.py +++ b/semantic_router/layer.py @@ -303,6 +303,7 @@ class RouteLayer: ) self.llm = OpenAILLM() route.llm = self.llm + return await route.llm.acall(text) # type: ignore else: route.llm = self.llm return route(text) diff --git a/semantic_router/llms/openai.py b/semantic_router/llms/openai.py index f78182010cb4927a7936324f4df7ba5c8304489a..24a38ee3c11ac45f8725eff7d40d4d2c3865adf4 100644 --- a/semantic_router/llms/openai.py +++ b/semantic_router/llms/openai.py @@ -32,7 +32,6 @@ class OpenAILLM(BaseLLM): openai_api_key: Optional[str] = None, temperature: float = 0.01, max_tokens: int = 200, - use_async=False, ): if name is None: name = EncoderDefault.OPENAI.value["language_model"] @@ -123,7 +122,7 @@ class OpenAILLM(BaseLLM): function_schemas if function_schemas is not None else NOT_GIVEN ) - completion = await self.async_client.chat.completions.create( # type: ignore + completion = await self.async_client.chat.completions.create( model=self.name, messages=[m.to_openai() for m in messages], temperature=self.temperature,