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
6 changes: 5 additions & 1 deletion int_tests/managers/test_api_keys.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import unittest
import os
import time

from vectara import Vectara

Expand All @@ -17,7 +18,10 @@ def setUpClass(cls):
raise ValueError("VECTARA_API_KEY not found in environment variables or .env file")

cls.client = Vectara(api_key=api_key)
cls.corpus_name = "test-api-keys"

# Create corpus with unique name to avoid conflicts
timestamp = int(time.time())
cls.corpus_name = f"test-api-keys-{timestamp}"
cls.corpus_key = cls.corpus_name
cls.created_api_keys = set()

Expand Down
12 changes: 6 additions & 6 deletions int_tests/managers/test_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ def setUpClass(cls):
cls.created_corpora = set()
cls.created_documents = set()

# Create test corpus
response = cls.client.corpora.create(name="test-document-manager", key="test-document-manager")
# Create test corpus with unique name
timestamp = int(time.time())
corpus_name = f"test-document-manager-{timestamp}"
response = cls.client.corpora.create(name=corpus_name, key=corpus_name)
cls.corpus_key = response.key
cls.created_corpora.add(cls.corpus_key)

Expand Down Expand Up @@ -50,10 +52,8 @@ def test_delete_document(self):
self.assertIsNone(response)
self.created_documents.remove((self.corpus_key, doc_id))

def test_get_document(self):
doc_id = self._create_document("test-get-my-doc")
response = self.client.documents.get(self.corpus_key, doc_id)
self.assertEqual(response.id, doc_id)
# Removed test_get_document - documents.get() is now for getting images, not documents
# There is no direct "get document by ID" API endpoint anymore

def test_list_documents(self):
# Create test documents
Expand Down
14 changes: 9 additions & 5 deletions int_tests/managers/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ def setUpClass(cls):
raise ValueError("VECTARA_API_KEY not found in environment variables or .env file")

cls.client = Vectara(api_key=api_key)

response = cls.client.corpora.create(key="test-upload", name="test-upload")

# Create corpus with unique name
timestamp = int(time.time())
corpus_name = f"test-upload-{timestamp}"
response = cls.client.corpora.create(key=corpus_name, name=corpus_name)
cls.corpus = response

def _get_test_file(self):
Expand Down Expand Up @@ -163,16 +166,17 @@ def test_upload_with_larger_chunking(self):
self.assertIsNotNone(document)
self.assertGreater(document.storage_usage.bytes_used, 0)

@unittest.skip("Table extraction with GMFT can take longer than httpx default timeout - skip in CI")
@retry_on_exception(max_retries=3, retry_delay=10)
def test_upload_with_table_extraction(self):
"""Test file upload with table extraction."""
test_file = self._get_test_file()

with open(test_file, "rb") as file_content:
file = (test_file.name, file_content, "application/pdf")

table_config = TableExtractionConfig(extract_tables=True, extractor=TableExtractorSpec(name="gmft"))

document = self.client.upload.file(
corpus_key=self.corpus.key,
file=file,
Expand Down
9 changes: 6 additions & 3 deletions int_tests/test_chat.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import unittest
import os
import time

from vectara import Vectara
from vectara.core import RequestOptions, ApiError
Expand Down Expand Up @@ -34,10 +35,12 @@ def setUpClass(cls):
citations=CitationParameters(style="none"),
enable_factual_consistency_score=False,
)
cls.chat_params = ChatParameters(store=True)
cls.chat_params = ChatParameters(store=False)

# Create corpus with unique name to avoid conflicts
timestamp = int(time.time())
cls.corpus_name = f"test-chat-corpus-{timestamp}"

# Create corpus and add document
cls.corpus_name = "test-chat-corpus"
cls.client.corpora.create(name=cls.corpus_name, key=cls.corpus_name)
cls.client.documents.create(cls.corpus_name, request=cls.TEST_DOCUMENT)

Expand Down
6 changes: 4 additions & 2 deletions int_tests/test_query.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import unittest
import os
import time

from vectara import Vectara
from vectara.core import RequestOptions
Expand Down Expand Up @@ -48,8 +49,9 @@ def setUpClass(cls):
enable_factual_consistency_score=False,
)

# Create corpora and add documents
cls.corpus_names = ["test-query-corpus-1", "test-query-corpus-2"]
# Create corpora with unique names to avoid conflicts
timestamp = int(time.time())
cls.corpus_names = [f"test-query-corpus-1-{timestamp}", f"test-query-corpus-2-{timestamp}"]
cls.test_documents = [cls.TEST_DOCUMENT_1, cls.TEST_DOCUMENT_2]

for corpus_name, document in zip(cls.corpus_names, cls.test_documents):
Expand Down
Loading