From 74acb7822ae5102f0b7953af5b62e0b2aae88b25 Mon Sep 17 00:00:00 2001 From: Luca Mannini Date: Fri, 15 Dec 2023 19:00:36 +0100 Subject: [PATCH] format --- docs/examples/function_calling.ipynb | 2 +- semantic_router/encoders/openai.py | 1 + tests/unit/encoders/test_openai.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/examples/function_calling.ipynb b/docs/examples/function_calling.ipynb index c12eed73..a418d05f 100644 --- a/docs/examples/function_calling.ipynb +++ b/docs/examples/function_calling.ipynb @@ -28,6 +28,7 @@ "import openai\n", "from semantic_router.utils.logger import logger\n", "\n", + "\n", "# Docs # https://platform.openai.com/docs/guides/function-calling\n", "def llm_openai(prompt: str, model: str = \"gpt-4\") -> str:\n", " try:\n", @@ -349,7 +350,6 @@ "metadata": {}, "outputs": [], "source": [ - "\n", "def get_time(location: str) -> str:\n", " \"\"\"Useful to get the time in a specific location\"\"\"\n", " print(f\"Calling `get_time` function with location: {location}\")\n", diff --git a/semantic_router/encoders/openai.py b/semantic_router/encoders/openai.py index 920fac20..0b4aa94e 100644 --- a/semantic_router/encoders/openai.py +++ b/semantic_router/encoders/openai.py @@ -4,6 +4,7 @@ import openai from openai import OpenAIError from openai.types import CreateEmbeddingResponse + from semantic_router.encoders import BaseEncoder from semantic_router.utils.logger import logger diff --git a/tests/unit/encoders/test_openai.py b/tests/unit/encoders/test_openai.py index a1f458d1..501a9b04 100644 --- a/tests/unit/encoders/test_openai.py +++ b/tests/unit/encoders/test_openai.py @@ -71,7 +71,7 @@ def test_openai_encoder_call_failure_non_openai_error(self, openai_encoder, mock ) with pytest.raises(ValueError) as e: openai_encoder(["test document"]) - + assert "OpenAI API call failed. Error: Non-OpenAIError" in str(e.value) def test_openai_encoder_call_successful_retry(self, openai_encoder, mocker):