瀏覽代碼

[Bug Fix]: Fix test cases and update version to 0.1.93 (#1303)

Deshraj Yadav 1 年之前
父節點
當前提交
4428768eaa

+ 0 - 2
embedchain/config/llm/base.py

@@ -97,7 +97,6 @@ class BaseLlmConfig(BaseConfig):
         endpoint: Optional[str] = None,
         model_kwargs: Optional[dict[str, Any]] = None,
         local: Optional[bool] = False,
-        base_url: Optional[str] = None,
     ):
         """
         Initializes a configuration class instance for the LLM.
@@ -172,7 +171,6 @@ class BaseLlmConfig(BaseConfig):
         self.endpoint = endpoint
         self.model_kwargs = model_kwargs
         self.local = local
-        self.base_url = base_url
 
         if isinstance(prompt, str):
             prompt = Template(prompt)

+ 1 - 1
pyproject.toml

@@ -1,6 +1,6 @@
 [tool.poetry]
 name = "embedchain"
-version = "0.1.92"
+version = "0.1.93"
 description = "Simplest open source retrieval(RAG) framework"
 authors = [
     "Taranjeet Singh <taranjeet@embedchain.ai>",

+ 1 - 0
tests/evaluation/test_answer_relevancy_metric.py

@@ -30,6 +30,7 @@ def mock_data():
 @pytest.fixture
 def mock_answer_relevance_metric(monkeypatch):
     monkeypatch.setenv("OPENAI_API_KEY", "test_api_key")
+    monkeypatch.setenv("OPENAI_API_BASE", "test_api_base")
     metric = AnswerRelevance()
     return metric
 

+ 2 - 0
tests/llm/test_openai.py

@@ -73,6 +73,7 @@ def test_get_llm_model_answer_without_system_prompt(config, mocker):
         max_tokens=config.max_tokens,
         model_kwargs={"top_p": config.top_p},
         api_key=os.environ["OPENAI_API_KEY"],
+        base_url=os.environ["OPENAI_API_BASE"],
     )
 
 
@@ -98,6 +99,7 @@ def test_get_llm_model_answer_with_tools(config, mocker, mock_return, expected):
         max_tokens=config.max_tokens,
         model_kwargs={"top_p": config.top_p},
         api_key=os.environ["OPENAI_API_KEY"],
+        base_url=os.environ["OPENAI_API_BASE"],
     )
     mocked_convert_to_openai_tool.assert_called_once_with({"test": "test"})
     mocked_json_output_tools_parser.assert_called_once()

+ 1 - 0
tests/test_app.py

@@ -14,6 +14,7 @@ from embedchain.vectordb.chroma import ChromaDB
 @pytest.fixture
 def app():
     os.environ["OPENAI_API_KEY"] = "test_api_key"
+    os.environ["OPENAI_API_BASE"] = "test_api_base"
     return App()
 
 

+ 1 - 0
tests/test_factory.py

@@ -26,6 +26,7 @@ class TestFactories:
     def test_llm_factory_create(self, provider_name, config_data, expected_class):
         os.environ["ANTHROPIC_API_KEY"] = "test_api_key"
         os.environ["OPENAI_API_KEY"] = "test_api_key"
+        os.environ["OPENAI_API_BASE"] = "test_api_base"
         llm_instance = LlmFactory.create(provider_name, config_data)
         assert isinstance(llm_instance, expected_class)