diff --git a/pkgs/swarmauri/tests/unit/llms/OpenRouterModel_unit_test.py b/pkgs/swarmauri/tests/unit/llms/OpenRouterModel_unit_test.py index b3b1c51bf..f80260bd1 100644 --- a/pkgs/swarmauri/tests/unit/llms/OpenRouterModel_unit_test.py +++ b/pkgs/swarmauri/tests/unit/llms/OpenRouterModel_unit_test.py @@ -46,7 +46,7 @@ def test_serialization(openrouter_model): @pytest.mark.unit def test_default_name(openrouter_model): - assert openrouter_model.name == "01-ai/yi-34b" + assert openrouter_model.name == "mistralai/pixtral-12b:free" @pytest.mark.parametrize("model_name", get_allowed_models()) @@ -68,6 +68,7 @@ def test_no_system_context(openrouter_model, model_name): @pytest.mark.parametrize("model_name", get_allowed_models()) @pytest.mark.unit def test_preamble_system_context(openrouter_model, model_name): + failed_models = [] model = openrouter_model model.name = model_name conversation = Conversation() @@ -86,5 +87,6 @@ def test_preamble_system_context(openrouter_model, model_name): assert isinstance(prediction, str) assert "Jeff" in prediction except Exception as e: + failed_models.append(model.name) pytest.fail(f"Error: {e}") # pytest.skip(f"Error: {e}") diff --git a/pkgs/swarmauri/tests/unit/vector_stores/RedisVectorStore_test.py b/pkgs/swarmauri/tests/unit/vector_stores/RedisVectorStore_test.py index af80aab75..5754d2c2d 100644 --- a/pkgs/swarmauri/tests/unit/vector_stores/RedisVectorStore_test.py +++ b/pkgs/swarmauri/tests/unit/vector_stores/RedisVectorStore_test.py @@ -1,14 +1,24 @@ import pytest from swarmauri.documents.concrete.Document import Document from swarmauri.vector_stores.concrete.RedisVectorStore import RedisVectorStore +from dotenv import load_dotenv +from os import getenv + +load_dotenv() + +REDIS_HOST = getenv("REDIS_HOST") +REDIS_PORT = getenv("REDIS_HOST", "12648") +REDIS_PASSWORD = getenv("REDIS_PASSWORD") @pytest.fixture(scope="module") def vector_store(): + if not all([REDIS_HOST, REDIS_PORT, REDIS_PASSWORD]): + pytest.skip("Skipping due to environment variable not set") vector_store = RedisVectorStore( - redis_host="redis-12648.c305.ap-south-1-1.ec2.redns.redis-cloud.com", - redis_port=12648, - redis_password="EaNg3YcgUW94Uj1P5wT3LScNtM97avu2", # Replace with your password if needed + redis_host=REDIS_HOST, + redis_port=REDIS_PORT, + redis_password=REDIS_PASSWORD, # Replace with your password if needed embedding_dimension=8000, # Adjust based on your embedder ) return vector_store @@ -25,29 +35,17 @@ def sample_document(): @pytest.mark.unit -def test_ubc_resource(): - vs = RedisVectorStore( - redis_host="redis-12648.c305.ap-south-1-1.ec2.redns.redis-cloud.com", - redis_port=12648, - redis_password="EaNg3YcgUW94Uj1P5wT3LScNtM97avu2", # Replace with your password if needed - embedding_dimension=8000, # Adjust based on your embedder - ) - assert vs.resource == "VectorStore" +def test_ubc_resource(vector_store): + assert vector_store.resource == "VectorStore" @pytest.mark.unit -def test_ubc_type(): - vs = RedisVectorStore( - redis_host="redis-12648.c305.ap-south-1-1.ec2.redns.redis-cloud.com", - redis_port=12648, - redis_password="EaNg3YcgUW94Uj1P5wT3LScNtM97avu2", - embedding_dimension=8000, - ) - assert vs.type == "RedisVectorStore" +def test_ubc_type(vector_store): + assert vector_store.type == "RedisVectorStore" @pytest.mark.unit -def top_k_test(vs=vector_store): +def top_k_test(vector_store): documents = [ Document(content="test"), Document(content="test1"), @@ -55,8 +53,8 @@ def top_k_test(vs=vector_store): Document(content="test3"), ] - vs.add_documents(documents) - assert len(vs.retrieve(query="test", top_k=2)) == 2 + vector_store.add_documents(documents) + assert len(vector_store.retrieve(query="test", top_k=2)) == 2 @pytest.mark.unit