Skip to content

Commit 257aa2b

Browse files
committed
fix
1 parent c7b7eeb commit 257aa2b

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

langchain/tests/conftest.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import json
22
import logging
33
import os
4+
import time
45
from collections.abc import Iterator
56
from pathlib import Path
67
from typing import Literal
78

89
import pytest
910
import urllib3
1011
import vectorize_client as v
11-
from vectorize_client import ApiClient
12+
from vectorize_client import ApiClient, RetrieveDocumentsRequest
1213

1314

1415
@pytest.fixture(scope="session")
@@ -147,6 +148,24 @@ def pipeline_id(api_client: v.ApiClient, org_id: str) -> Iterator[str]:
147148
pipeline_id = pipeline_response.data.id
148149
logging.info("Created pipeline %s", pipeline_id)
149150

151+
# Wait for the pipeline to be created
152+
request = RetrieveDocumentsRequest(
153+
question="query",
154+
num_results=2,
155+
)
156+
start = time.time()
157+
while True:
158+
response = pipelines.retrieve_documents(
159+
org_id, pipeline_id, request
160+
)
161+
docs = response.documents
162+
if len(docs) == 2:
163+
break
164+
if time.time() - start > 180:
165+
msg = "Docs not retrieved in time"
166+
raise RuntimeError(msg)
167+
time.sleep(1)
168+
150169
yield pipeline_id
151170

152171
try:

langchain/tests/test_langchain_integration_tests.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import time
12
from typing import Literal
23

34
import pytest
@@ -20,6 +21,7 @@ def setup(
2021
cls.api_token = api_token
2122
cls.org_id = org_id
2223
cls.pipeline_id = pipeline_id
24+
time.sleep()
2325

2426
@property
2527
def retriever_constructor(self) -> type[VectorizeRetriever]:

0 commit comments

Comments
 (0)