Skip to content

Commit 7439b1b

Browse files
up
1 parent dfebad3 commit 7439b1b

File tree

2 files changed

+42
-29
lines changed

2 files changed

+42
-29
lines changed

.github/workflows/integration-test-workflow-debian.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,14 @@ jobs:
8181
poetry run python tests/integration/harness_cli.py test_ingest_sample_file_cli
8282
poetry run python tests/integration/harness_cli.py test_document_overview_sample_file_cli
8383
poetry run python tests/integration/harness_cli.py test_vector_search_sample_file_filter_cli
84+
poetry run python tests/integration/harness_cli.py test_rag_response_sample_file_cli
85+
poetry run python tests/integration/harness_cli.py test_rag_response_stream_sample_file_cli
8486
85-
poetry run python tests/integration/harness_cli.py test_ingest_sample_file_sdk
86-
poetry run python tests/integration/harness_cli.py test_reingest_sample_file_sdk
87+
poetry run python tests/integration/harness_sdk.py test_ingest_sample_file_sdk
88+
poetry run python tests/integration/harness_sdk.py test_reingest_sample_file_sdk
89+
poetry run python tests/integration/harness_sdk.py test_document_overview_sample_file_sdk
90+
poetry run python tests/integration/harness_cli.py test_vector_search_sample_file_filter_sdk
91+
poetry run python tests/integration/harness_cli.py test_hybrid_search_sample_file_filter_sdk
8792
8893
- name: Stop R2R server
8994
if: always()

py/tests/integration/harness_sdk.py

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,25 @@ def test_reingest_sample_file_sdk():
6262

6363

6464
def test_document_overview_sample_file_sdk():
65-
print("Testing: Document overview contains 'uber.txt'")
66-
documents_overview = client.documents_overview()
65+
documents_overview = client.documents_overview()["results"]
6766

68-
aristotle_document = {
69-
"title": "aristotle.txt",
70-
"type": "txt",
67+
uber_document = {
68+
"id": "3e157b3a-8469-51db-90d9-52e7d896b49b",
69+
"title": "uber_2021.pdf",
70+
"type": "pdf",
7171
"ingestion_status": "success",
7272
"kg_extraction_status": "pending",
73-
"version": "v0",
74-
"metadata": {"title": "aristotle.txt", "version": "v0"},
73+
"collection_ids": ["122fdf6a-e116-546b-a8f6-e4cb2e2c0a09"],
74+
# "version": "v0",
75+
# "metadata": {"title": "uber_2021.pdf"},
7576
}
7677

7778
if not any(
78-
all(doc.get(k) == v for k, v in aristotle_document.items())
79+
all(doc.get(k) == v for k, v in uber_document.items())
7980
for doc in documents_overview
8081
):
8182
print("Document overview test failed")
82-
print("Aristotle document not found in the overview")
83+
print("Uber document not found in the overview")
8384
sys.exit(1)
8485
print("Document overview test passed")
8586
print("~" * 100)
@@ -88,23 +89,25 @@ def test_document_overview_sample_file_sdk():
8889
def test_vector_search_sample_file_filter_sdk():
8990
print("Testing: Vector search")
9091
results = client.search(
91-
query="Who was aristotle?",
92-
filters={
93-
"document_id": {"$eq": "9fbe403b-c11c-5aae-8ade-ef22980c3ad1"}
92+
query="What was Uber's recent profit??",
93+
vector_search_settings={
94+
"search_filters": {
95+
"document_id": {"$eq": "3e157b3a-8469-51db-90d9-52e7d896b49b"}
96+
}
9497
},
95-
)
98+
)["results"]["vector_search_results"]
9699

97100
if not results:
98101
print("Vector search test failed: No results returned")
99102
sys.exit(1)
100103

101104
lead_result = results[0]
102105
expected_lead_search_result = {
103-
"text": "Aristotle[A] (Greek: Ἀριστοτέλης Aristotélēs, pronounced [aristotélɛːs]; 384–322 BC) was an Ancient Greek philosopher and polymath. His writings cover a broad range of subjects spanning the natural sciences, philosophy, linguistics, economics, politics, psychology, and the arts. As the founder of the Peripatetic school of philosophy in the Lyceum in Athens, he began the wider Aristotelian tradition that followed, which set the groundwork for the development of modern science.",
104-
"extraction_id": "ff8accdb-791e-5b6d-a83a-5adc32c4222c",
105-
"document_id": "9fbe403b-c11c-5aae-8ade-ef22980c3ad1",
106+
"text": "was $17.5 billion, or up 57% year-over-year, reflecting the overall growth in our Delivery business and an increase in Freight revenue attributable tothe\n acquisition of Transplace in the fourth quarter of 2021 as well as growth in the number of shippers and carriers on the network combined with an increase involumes with our top shippers.\nNet\n loss attributable to Uber Technologies, Inc. was $496 million, a 93% improvement year-over-year, driven by a $1.6 billion pre-tax gain on the sale of ourATG\n Business to Aurora, a $1.6 billion pre-tax net benefit relating to Ubers equity investments, as well as reductions in our fixed cost structure and increasedvariable cost effi\nciencies. Net loss attributable to Uber Technologies, Inc. also included $1.2 billion of stock-based compensation expense.Adjusted\n EBITDA loss was $774 million, improving $1.8 billion from 2020 with Mobility Adjusted EBITDA profit of $1.6 billion. Additionally, DeliveryAdjusted",
107+
"extraction_id": "6b4cdb93-f6f5-5ff4-8a89-7a4b1b7cd034",
108+
"document_id": "3e157b3a-8469-51db-90d9-52e7d896b49b",
106109
"user_id": "2acb499e-8428-543b-bd85-0d9098718220",
107-
"score": lambda x: 0.77 <= x <= 0.79,
110+
"score": lambda x: 0.71 <= x <= 0.73,
108111
}
109112
compare_result_fields(lead_result, expected_lead_search_result)
110113

@@ -114,25 +117,30 @@ def test_vector_search_sample_file_filter_sdk():
114117

115118
def test_hybrid_search_sample_file_filter_sdk():
116119
print("Testing: Hybrid search")
120+
117121
results = client.search(
118-
query="Who was aristotle?",
119-
vector_search_settings={"use_hybrid_search": True},
120-
filters={
121-
"document_id": {"$eq": "9fbe403b-c11c-5aae-8ade-ef22980c3ad1"}
122+
query="What was Uber's recent profit??",
123+
vector_search_settings={
124+
"use_hybrid_search": True,
125+
"search_filters": {
126+
"document_id": {"$eq": "3e157b3a-8469-51db-90d9-52e7d896b49b"}
127+
}
122128
},
123-
)
129+
)["results"]["vector_search_results"]
124130

125131
if not results:
126-
print("Hybrid search test failed: No results returned")
132+
print("Vector search test failed: No results returned")
127133
sys.exit(1)
128134

129135
lead_result = results[0]
130136
expected_lead_search_result = {
131-
"text": "Aristotle[A] (Greek: Ἀριστοτέλης Aristotélēs, pronounced [aristotélɛːs]; 384–322 BC) was an Ancient Greek philosopher and polymath. His writings cover a broad range of subjects spanning the natural sciences, philosophy, linguistics, economics, politics, psychology, and the arts. As the founder of the Peripatetic school of philosophy in the Lyceum in Athens, he began the wider Aristotelian tradition that followed, which set the groundwork for the development of modern science.",
132-
"extraction_id": "ff8accdb-791e-5b6d-a83a-5adc32c4222c",
133-
"document_id": "9fbe403b-c11c-5aae-8ade-ef22980c3ad1",
137+
"text": "was $17.5 billion, or up 57% year-over-year, reflecting the overall growth in our Delivery business and an increase in Freight revenue attributable tothe\n acquisition of Transplace in the fourth quarter of 2021 as well as growth in the number of shippers and carriers on the network combined with an increase involumes with our top shippers.\nNet\n loss attributable to Uber Technologies, Inc. was $496 million, a 93% improvement year-over-year, driven by a $1.6 billion pre-tax gain on the sale of ourATG\n Business to Aurora, a $1.6 billion pre-tax net benefit relating to Ubers equity investments, as well as reductions in our fixed cost structure and increasedvariable cost effi\nciencies. Net loss attributable to Uber Technologies, Inc. also included $1.2 billion of stock-based compensation expense.Adjusted\n EBITDA loss was $774 million, improving $1.8 billion from 2020 with Mobility Adjusted EBITDA profit of $1.6 billion. Additionally, DeliveryAdjusted",
138+
"extraction_id": "6b4cdb93-f6f5-5ff4-8a89-7a4b1b7cd034",
139+
"document_id": "3e157b3a-8469-51db-90d9-52e7d896b49b",
134140
"user_id": "2acb499e-8428-543b-bd85-0d9098718220",
135-
"score": lambda x: 0.77 <= x <= 0.79,
141+
"score": lambda x: 0.016 <= x <= 0.017,
142+
"semantic_rank": 1,
143+
"full_text_rank": 200
136144
}
137145
compare_result_fields(lead_result, expected_lead_search_result)
138146

0 commit comments

Comments
 (0)