Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions ragas/pyproject.toml → pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ test = []
ragas-experimental = "ragas.experimental.cli:app"

[tool.setuptools]
package-dir = {"" = "src"}
package-dir = {"" = "ragas/src"}

[tool.setuptools.dynamic]
readme = {file = ["README.md"], content-type = "text/markdown"}
Expand All @@ -79,15 +79,13 @@ build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
# Path to version file relative to this pyproject.toml
version_file = "src/ragas/_version.py"
# Point to the repository root (one level up)
root = ".."
version_file = "ragas/src/ragas/_version.py"

[tool.pytest.ini_options]
addopts = "-n 0"
asyncio_default_fixture_loop_scope = "function"
[pytest]
testpaths = ["tests"]
testpaths = ["ragas/tests"]
markers = [
"experimental_ci: Set of tests that will be run as part of Experimental CI",
"e2e: End-to-End tests for Experimental",
Expand Down
16 changes: 10 additions & 6 deletions ragas/tests/unit/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def mocked_import(name, *args, **kwargs):
base_url="http://localhost:8001",
llm_id=19,
x_openapi_token="test_token",
x_generative_ai_client="test_client"
x_generative_ai_client="test_client",
)
assert fabrix_wrapper.base_url == "http://localhost:8001"
assert fabrix_wrapper.llm_id == 19
Expand Down Expand Up @@ -138,14 +138,14 @@ def test_fabrix_and_bge_wrappers_import():
base_url="http://localhost:8001",
llm_id=19,
x_openapi_token="test_token",
x_generative_ai_client="test_client"
x_generative_ai_client="test_client",
)

assert fabrix_wrapper.base_url == "http://localhost:8001"
assert fabrix_wrapper.llm_id == 19
assert fabrix_wrapper.x_openapi_token == "test_token"
assert fabrix_wrapper.x_generative_ai_client == "test_client"

# Test BGEEmbeddingsWrapper import and instantiation
bge_wrapper = BGEEmbeddingsWrapper(model_name="BAAI/bge-base-en")
assert bge_wrapper.model_name == "BAAI/bge-base-en"
Expand Down Expand Up @@ -189,12 +189,15 @@ def mocked_import(name, *args, **kwargs):
langchain_mocked_embedding = MagicMock(spec=OpenAIEmbeddings)
langchain_mocked_embedding.model = "text-embedding-ada-002"

langchain_wrapper = LangchainEmbeddingsWrapper(embeddings=langchain_mocked_embedding)
langchain_wrapper = LangchainEmbeddingsWrapper(
embeddings=langchain_mocked_embedding
)
assert langchain_wrapper.embeddings.model == "text-embedding-ada-002" # type: ignore

# Test: Importing BGEEmbeddingsWrapper fails
with pytest.raises(ImportError, match="sentence-transformers"):
from ragas.embeddings import BGEEmbeddingsWrapper

BGEEmbeddingsWrapper(model_name="BAAI/bge-base-en")


Expand Down Expand Up @@ -223,9 +226,10 @@ def mocked_import(name, *args, **kwargs):
# Test: Importing FabrixLLMWrapper fails
with pytest.raises(ImportError, match="requests"):
from ragas.llms import FabrixLLMWrapper

FabrixLLMWrapper(
base_url="http://localhost:8001",
llm_id=19,
x_openapi_token="test_token",
x_generative_ai_client="test_client"
x_generative_ai_client="test_client",
)
Loading