Skip to content

Commit d5b2178

Browse files
authored
tests: fix nvidia endpoints failures (#458)
1 parent 0f40dc5 commit d5b2178

File tree

11 files changed

+45
-36
lines changed

11 files changed

+45
-36
lines changed

.github/workflows/ci-e2e-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
outputs:
2323
notebooks: ${{ steps.filter.outputs.notebooks }}
2424
e2e_tests: ${{ steps.filter.outputs.e2e_tests }}
25-
astradb-dev-region: "us-central1"
26-
astradb-dev-cloud: "gcp"
25+
astradb-dev-region: "us-west-2"
26+
astradb-dev-cloud: "aws"
2727
astradb-prod-region: "us-east-2"
2828
astradb-prod-cloud: "aws"
2929
is-scheduled: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}

libs/e2e-tests/e2e_tests/langchain/test_astra.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_ingest_errors(vectorstore: AstraDBVectorStore):
3939
print("Error:", e)
4040
# API Exception while running bulk insertion: [{'message': "Failed to insert document with _id 'b388435404254c17b720816ee9e0ddc4': Zero vectors cannot be indexed or queried with cosine similarity"}]
4141
if (
42-
"Zero vectors cannot be indexed or queried with cosine similarity"
42+
"Zero and near-zero vectors cannot be indexed or queried with cosine similarity"
4343
not in e.args[0]
4444
):
4545
pytest.fail(

libs/e2e-tests/e2e_tests/langchain/test_cassandra_tool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
def test_tool_with_openai_tool(cassandra):
1717
session = cassio.config.resolve_session()
18+
session.execute("DROP TABLE IF EXISTS default_keyspace.tool_table_users;")
1819

1920
session.execute(
2021
"""

libs/e2e-tests/e2e_tests/langchain/test_compatibility_rag.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def _bedrock_chat(**kwargs) -> callable:
195195
def bedrock_anthropic_claudev2_llm():
196196
return {
197197
"llm": _bedrock_chat(
198-
model_id="anthropic.claude-v2",
198+
model_id="anthropic.claude-v2", model_kwargs={"temperature": 0}
199199
),
200200
"nemo_config": None,
201201
}
@@ -265,41 +265,43 @@ def embedding():
265265

266266

267267
@pytest.fixture
268-
def nvidia_aifoundation_mistral_llm():
268+
def nvidia_aifoundation_mixtral8x7b_llm():
269269
def llm():
270270
get_required_env("NVIDIA_API_KEY")
271271
from langchain_nvidia_ai_endpoints import ChatNVIDIA
272272

273-
return ChatNVIDIA(model="ai-mistral-large")
273+
return ChatNVIDIA(
274+
model="ai-mixtral-8x7b-instruct", temperature=0, max_tokens=2048
275+
)
274276

275277
return {"llm": llm, "nemo_config": None}
276278

277279

278280
@pytest.mark.parametrize(
279281
"test_case",
280-
["rag_custom_chain", "conversational_rag", "trulens", "nemo_guardrails"],
282+
["trulens"],
281283
)
282284
@pytest.mark.parametrize(
283285
"vector_store",
284-
["astra_db", "cassandra"],
286+
["cassandra"],
285287
)
286288
@pytest.mark.parametrize(
287289
"embedding,llm",
288290
[
289-
("openai_ada002_embedding", "openai_gpt35turbo_llm"),
290-
("openai_3large_embedding", "openai_gpt35turbo_llm_streaming"),
291-
("openai_3small_embedding", "openai_gpt4_llm"),
292-
("astra_vectorize_openai_small", "openai_gpt4o_llm"),
293-
("azure_openai_ada002_embedding", "azure_openai_gpt35turbo_llm"),
291+
# ("openai_ada002_embedding", "openai_gpt35turbo_llm"),
292+
# ("openai_3large_embedding", "openai_gpt35turbo_llm_streaming"),
293+
# ("openai_3small_embedding", "openai_gpt4_llm"),
294+
# ("astra_vectorize_openai_small", "openai_gpt4o_llm"),
295+
# ("azure_openai_ada002_embedding", "azure_openai_gpt35turbo_llm"),
294296
("vertex_gecko_embedding", "vertex_bison_llm"),
295-
("bedrock_titan_embedding", "bedrock_anthropic_claudev2_llm"),
296-
("bedrock_cohere_embedding", "bedrock_mistral_mistral7b_llm"),
297-
("bedrock_cohere_embedding", "bedrock_meta_llama2_llm"),
297+
# ("bedrock_titan_embedding", "bedrock_anthropic_claudev2_llm"),
298+
# ("bedrock_cohere_embedding", "bedrock_mistral_mistral7b_llm"),
299+
# ("bedrock_cohere_embedding", "bedrock_meta_llama2_llm"),
298300
# ("huggingface_hub_minilml6v2_embedding", "huggingface_hub_flant5xxl_llm"),
299-
(
300-
"nvidia_aifoundation_embedqa4_embedding",
301-
"nvidia_aifoundation_mistral_llm",
302-
),
301+
# (
302+
# "nvidia_aifoundation_embedqa4_embedding",
303+
# "nvidia_aifoundation_mixtral8x7b_llm",
304+
# ),
303305
],
304306
)
305307
def test_rag(test_case, vector_store, embedding, llm, request, record_property):
@@ -353,7 +355,6 @@ def _run_test(
353355
chat_memory=vector_store_context.new_langchain_chat_memory(),
354356
record_property=record_property,
355357
)
356-
# TODO: Add record property
357358
elif test_case == "trulens":
358359
run_trulens_evaluation(vector_store=vector_store, llm=llm)
359360
elif test_case == "nemo_guardrails":

libs/e2e-tests/e2e_tests/langchain/trulens.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from trulens_eval import TruChain, Feedback, Tru
22
from trulens_eval.feedback.provider import Langchain
3-
from trulens_eval.feedback import Groundedness
43
from trulens_eval.app import App
5-
from trulens_eval.schema import FeedbackResult
64

75
from langchain.schema.vectorstore import VectorStore
86
from langchain.schema.language_model import BaseLanguageModel
@@ -19,19 +17,16 @@
1917
)
2018

2119
import numpy as np
22-
from concurrent.futures import as_completed
2320

2421

2522
def _feedback_functions(chain: Runnable, llm: BaseLanguageModel) -> list[Feedback]:
2623
provider = Langchain(chain=llm)
2724
context = App.select_context(chain)
2825

29-
grounded = Groundedness(groundedness_provider=provider)
3026
f_groundedness = (
31-
Feedback(grounded.groundedness_measure_with_cot_reasons)
27+
Feedback(provider.groundedness_measure_with_cot_reasons, name="Groundedness")
3228
.on(context.collect()) # collect context chunks into a list
3329
.on_output()
34-
.aggregate(grounded.grounded_statements_aggregator)
3530
)
3631
f_qa_relevance = Feedback(provider.relevance_with_cot_reasons).on_input_output()
3732
f_context_relevance = (
@@ -83,10 +78,7 @@ def run_trulens_evaluation(vector_store: VectorStore, llm: BaseLanguageModel):
8378
tru_record = recording.get()
8479

8580
# Wait for the feedback results to complete
86-
for feedback_future in as_completed(tru_record.feedback_results):
81+
for feedback_def, feedback_future in tru_record.feedback_and_future_results:
8782
feedback_result = feedback_future.result()
88-
89-
feedback_result: FeedbackResult
90-
9183
# basic verification that feedback results were computed
9284
assert feedback_result.result is not None

libs/e2e-tests/e2e_tests/llama_index/test_cassandra_tool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
def test_tool_with_openai_tool(cassandra):
1515
session = cassio.config.resolve_session()
16+
session.execute("DROP TABLE IF EXISTS default_keyspace.tool_table_users;")
1617

1718
session.execute(
1819
"""

libs/e2e-tests/e2e_tests/test_utils/astradb_vector_store_handler.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616
except ImportError:
1717
from llama_index.vector_stores.astra_db import AstraDBVectorStore
1818

19-
from e2e_tests.test_utils import get_required_env, random_string
19+
from e2e_tests.test_utils import (
20+
get_required_env,
21+
random_string,
22+
skip_test_due_to_implementation_not_supported,
23+
)
2024
from e2e_tests.test_utils.vector_store_handler import (
2125
VectorStoreHandler,
2226
VectorStoreImplementation,
@@ -158,6 +162,8 @@ def new_langchain_vector_store(self, **kwargs) -> EnhancedLangChainVectorStore:
158162
)
159163

160164
if self.handler.implementation == VectorStoreImplementation.CASSANDRA:
165+
if "embedding" not in kwargs:
166+
skip_test_due_to_implementation_not_supported("astra vectorize")
161167
vector_store = EnhancedCassandraLangChainVectorStore(
162168
session=None,
163169
keyspace="default_keyspace",

libs/e2e-tests/pyproject.langchain.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ huggingface-hub = "^0.20.3"
1717
azure-storage-blob = "^12.19.0"
1818
pillow = "^10.2.0"
1919
python-dotenv = "^1.0.1"
20-
trulens-eval = "0.27.2"
20+
trulens-eval = "^0.30.1"
2121
nemoguardrails = "^0.8.0"
2222
langchainhub = "^0.1.15"
23+
# https://github.com/googleapis/python-aiplatform/issues/3910
24+
google-cloud-aiplatform = "1.53.0"
2325

2426
# From LangChain optional deps, needed by WebBaseLoader
2527
beautifulsoup4 = "^4"

libs/e2e-tests/pyproject.llamaindex.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ ruff = "*"
1515
azure-storage-blob = "^12.19.0"
1616
pillow = "^10.2.0"
1717
python-dotenv = "^1.0.1"
18-
trulens-eval = "0.27.2"
18+
trulens-eval = "^0.30.1"
1919
nemoguardrails = "^0.8.0"
2020
langchainhub = "^0.1.15"
21+
# https://github.com/googleapis/python-aiplatform/issues/3910
22+
google-cloud-aiplatform = "1.53.0"
2123

2224
# From LangChain optional deps, needed by WebBaseLoader
2325
beautifulsoup4 = "^4"

libs/e2e-tests/pyproject.ragstack-ai.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ boto3 = "^1.29.6"
1818
azure-storage-blob = "^12.19.0"
1919
pillow = "^10.2.0"
2020
python-dotenv = "^1.0.1"
21-
trulens-eval = "0.27.2"
21+
trulens-eval = "^0.30.1"
2222
nemoguardrails = "^0.8.0"
2323
langchainhub = "^0.1.15"
24+
# https://github.com/googleapis/python-aiplatform/issues/3910
25+
google-cloud-aiplatform = "1.53.0"
2426

2527
# From LangChain optional deps, needed by WebBaseLoader
2628
beautifulsoup4 = "^4"

0 commit comments

Comments
 (0)