[Feature] Add support for OpenAI assistants and support openai version >=1.0.0 (#921)
This commit is contained in:
@@ -86,7 +86,9 @@ class TestAppFromConfig:
|
||||
with open(yaml_path, "r") as file:
|
||||
return yaml.safe_load(file)
|
||||
|
||||
def test_from_chroma_config(self):
|
||||
def test_from_chroma_config(self, mocker):
|
||||
mocker.patch("embedchain.vectordb.chroma.chromadb.Client")
|
||||
|
||||
yaml_path = "configs/chroma.yaml"
|
||||
config_data = self.load_config_data(yaml_path)
|
||||
|
||||
@@ -119,7 +121,9 @@ class TestAppFromConfig:
|
||||
assert app.embedder.config.model == embedder_config["model"]
|
||||
assert app.embedder.config.deployment_name == embedder_config["deployment_name"]
|
||||
|
||||
def test_from_opensource_config(self):
|
||||
def test_from_opensource_config(self, mocker):
|
||||
mocker.patch("embedchain.vectordb.chroma.chromadb.Client")
|
||||
|
||||
yaml_path = "configs/opensource.yaml"
|
||||
config_data = self.load_config_data(yaml_path)
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@ def test_whole_app(app_instance, mocker):
|
||||
|
||||
|
||||
def test_add_after_reset(app_instance, mocker):
|
||||
mocker.patch("embedchain.vectordb.chroma.chromadb.Client")
|
||||
|
||||
config = AppConfig(log_level="DEBUG", collect_metrics=False)
|
||||
chroma_config = {"allow_reset": True}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ def config():
|
||||
top_p=0.8,
|
||||
stream=False,
|
||||
system_prompt="System prompt",
|
||||
model="orca-mini-3b.ggmlv3.q4_0.bin",
|
||||
model="orca-mini-3b-gguf2-q4_0.gguf",
|
||||
)
|
||||
yield config
|
||||
|
||||
@@ -40,7 +40,7 @@ def test_gpt4all_init_with_config(config, gpt4all_with_config):
|
||||
|
||||
|
||||
def test_gpt4all_init_without_config(gpt4all_without_config):
|
||||
assert gpt4all_without_config.config.model == "orca-mini-3b.ggmlv3.q4_0.bin"
|
||||
assert gpt4all_without_config.config.model == "orca-mini-3b-gguf2-q4_0.gguf"
|
||||
assert isinstance(gpt4all_without_config.instance, LangchainGPT4All)
|
||||
|
||||
|
||||
|
||||
@@ -33,12 +33,14 @@ def cleanup_db():
|
||||
print("Error: %s - %s." % (e.filename, e.strerror))
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="ChromaDB client needs to be mocked")
|
||||
def test_chroma_db_init_with_host_and_port(chroma_db):
|
||||
settings = chroma_db.client.get_settings()
|
||||
assert settings.chroma_server_host == "test-host"
|
||||
assert settings.chroma_server_http_port == "1234"
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="ChromaDB client needs to be mocked")
|
||||
def test_chroma_db_init_with_basic_auth():
|
||||
chroma_config = {
|
||||
"host": "test-host",
|
||||
@@ -159,6 +161,8 @@ def test_chroma_db_collection_add_with_skip_embedding(app_with_settings):
|
||||
"embeddings": None,
|
||||
"ids": ["id"],
|
||||
"metadatas": [{"url": "url_1", "doc_id": "doc_id_1"}],
|
||||
"data": None,
|
||||
"uris": None,
|
||||
}
|
||||
|
||||
assert data == expected_value
|
||||
|
||||
Reference in New Issue
Block a user