Skip to content

Commit f589d7c

Browse files
authored
Bump LangChain to 0.0.350 and add Gemini tests (#153)
* Tests: add Google Gemini LLM * Bump LC * Fix * fix * fix * fix format * fo
1 parent e717795 commit f589d7c

File tree

11 files changed

+73
-10
lines changed

11 files changed

+73
-10
lines changed

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ astrapy = "~0.6.2"
1515
cassio = "~0.1.3"
1616
unstructured = "^0.10"
1717
llama-index = { version = "0.9.14", extras = ["langchain"] }
18-
langchain = { version = "0.0.349", extras = ["openai"] }
19-
langchain-core = "0.0.13"
20-
langchain-community = "0.0.1"
18+
langchain = { version = "0.0.350", extras = ["openai"] }
19+
langchain-core = "0.1.1"
20+
langchain-community = "0.0.3"
2121

2222
[tool.poetry.group.test.dependencies]
2323
pytest = "*"

ragstack-e2e-tests/e2e_tests/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,11 @@ def dump_report():
146146
+ str(tests_stats["skipped"])
147147
+ "\n"
148148
)
149+
all_report_lines.sort()
149150
with open("all-tests-report.txt", "w") as f:
150151
f.write(stats_str + "\n")
151152
f.write("\n".join(all_report_lines))
153+
failed_report_lines.sort()
152154
with open("failed-tests-report.txt", "w") as f:
153155
f.write(stats_str + "\n")
154156
f.write("\n".join(failed_report_lines))
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import pytest
2+
from e2e_tests.conftest import (
3+
set_current_test_info,
4+
)
5+
from langchain_community.chat_models import ChatVertexAI
6+
from langchain_core.prompts import ChatPromptTemplate
7+
8+
9+
def set_test_info(chat: str):
10+
set_current_test_info("langchain::chat", chat)
11+
12+
13+
@pytest.fixture
14+
def vertex_gemini():
15+
return ChatVertexAI(model_name="gemini-pro")
16+
17+
18+
@pytest.mark.parametrize(
19+
"chat",
20+
["vertex_gemini"],
21+
)
22+
def test_chat(chat, request):
23+
set_test_info(chat)
24+
chat_model = request.getfixturevalue(chat)
25+
prompt = ChatPromptTemplate.from_messages(
26+
[("human", "Hello! Where Archimede was born?")]
27+
)
28+
chain = prompt | chat_model
29+
response = chain.invoke({})
30+
assert "Syracuse" in response.content

ragstack-e2e-tests/e2e_tests/langchain/test_compatibility_matrix.py renamed to ragstack-e2e-tests/e2e_tests/langchain/test_compatibility_rag.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
delete_all_astra_collections_with_client,
1212
delete_astra_collection,
1313
)
14-
from e2e_tests.langchain.chat_application import (
14+
from e2e_tests.langchain.rag_application import (
1515
run_rag_custom_chain,
1616
run_conversational_rag,
1717
)
@@ -228,7 +228,7 @@ def _run_test(test_case: str, vector_store, embedding, llm):
228228
vector_store = vector_store(embedding)
229229
llm_name, llm = llm
230230
set_current_test_info(
231-
test_case,
231+
"langchain::" + test_case,
232232
f"{llm_name},{embedding_name},{vector_store_name}",
233233
)
234234
if test_case == "rag_custom_chain":

ragstack-e2e-tests/e2e_tests/langchain/test_document_loaders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
def set_current_test_info_document_loader(doc_loader: str):
11-
set_current_test_info("document_loader", doc_loader)
11+
set_current_test_info("langchain::document_loader", doc_loader)
1212

1313

1414
def test_csv_loader():
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import pytest
2+
from e2e_tests.conftest import (
3+
set_current_test_info,
4+
)
5+
6+
# from llama_index.llms import Gemini
7+
8+
9+
def set_test_info(chat: str):
10+
set_current_test_info("llama_index::chat", chat)
11+
12+
13+
# @pytest.fixture
14+
# def gemini():
15+
# return Gemini(model="models/gemini-pro")
16+
17+
18+
@pytest.mark.parametrize(
19+
"chat",
20+
[
21+
# "gemini",
22+
],
23+
)
24+
def test_chat(chat, request):
25+
set_test_info(chat)
26+
chat_model = request.getfixturevalue(chat)
27+
response = chat_model.complete("Hello! Where Archimede was born?")
28+
assert "Syracuse" in response.content

ragstack-e2e-tests/e2e_tests/llama_index/test_llama_index.py renamed to ragstack-e2e-tests/e2e_tests/llama_index/test_compatibility_rag.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def _run_test(vector_store, embedding, llm):
204204
vector_store = vector_store(embedding_dimensions)
205205
llm_name, llm = llm
206206
set_current_test_info(
207-
"llama_index_retrieve",
207+
"llama_index::rag",
208208
f"{llm_name},{embedding_name},{vector_store_name}",
209209
)
210210
storage_context = StorageContext.from_defaults(vector_store=vector_store)

ragstack-e2e-tests/pyproject.langchain.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pytest = "*"
1313
black = "*"
1414
ruff = "*"
1515
google-cloud-aiplatform = "^1.36.4"
16+
langchain-google-genai = "^0.0.4"
1617
boto3 = "^1.29.6"
1718
huggingface-hub = "^0.19.4"
1819

ragstack-e2e-tests/pyproject.llamaindex.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pytest = "*"
1313
black = "*"
1414
ruff = "*"
1515
google-cloud-aiplatform = "^1.36.4"
16+
langchain-google-genai = "^0.0.4"
1617
boto3 = "^1.29.6"
1718
huggingface-hub = "^0.19.4"
1819

@@ -21,9 +22,9 @@ beautifulsoup4 = "^4"
2122

2223
llama-index = { git = "https://github.com/run-llama/llama_index.git", branch = "main" }
2324

24-
langchain = { version = "0.0.349", extras = ["openai"] }
25-
langchain-core = "0.0.13"
26-
langchain-community = "0.0.1"
25+
langchain = { version = "0.0.350", extras = ["openai"] }
26+
langchain-core = "0.1.1"
27+
langchain-community = "0.0.3"
2728
astrapy = "^0.6"
2829
cassio = "^0.1"
2930

0 commit comments

Comments
 (0)