Skip to content

Commit d424353

Browse files
committed
✨add_image_retrieval
1 parent c1b6acb commit d424353

4 files changed

Lines changed: 20 additions & 7 deletions

File tree

test/backend/database/test_attachment_db.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
# Mock consts module
1818
consts_mock = MagicMock()
1919
consts_mock.const = MagicMock()
20+
# Ensure constants are real strings to avoid startswith TypeError
21+
consts_mock.const.S3_URL_PREFIX = "s3://"
2022
# Environment variables are now configured in conftest.py
2123

2224
sys.modules['consts'] = consts_mock

test/backend/services/test_data_process_service.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,14 +1667,18 @@ async def async_test_create_batch_tasks_impl_success(self, mock_process, mock_fo
16671667
'source_type': 'url',
16681668
'chunking_strategy': 'semantic',
16691669
'index_name': 'test_index_1',
1670-
'original_filename': 'doc1.pdf'
1670+
'original_filename': 'doc1.pdf',
1671+
'embedding_model_id': None,
1672+
'tenant_id': None
16711673
},
16721674
{
16731675
'source': 'http://example.com/doc2.pdf',
16741676
'source_type': 'url',
16751677
'chunking_strategy': 'fixed',
16761678
'index_name': 'test_index_2',
1677-
'original_filename': 'doc2.pdf'
1679+
'original_filename': 'doc2.pdf',
1680+
'embedding_model_id': None,
1681+
'tenant_id': None
16781682
}
16791683
]
16801684
actual_process_calls = [kwargs for args,

test/backend/services/test_vectordatabase_service.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,9 @@ def test_create_knowledge_base_with_embedding_model_name(self, mock_get_embeddin
512512
self.assertEqual(result["knowledge_id"], 10)
513513

514514
# Verify get_embedding_model was called with the model name
515-
mock_get_embedding.assert_called_once_with("tenant-1", "text-embedding-3-small")
515+
mock_get_embedding.assert_called_once_with(
516+
"tenant-1", is_multimodal=False, model_name="text-embedding-3-small"
517+
)
516518

517519
# Verify knowledge record was created with the embedding model name
518520
mock_create_knowledge.assert_called_once()
@@ -559,7 +561,7 @@ def test_create_knowledge_base_without_embedding_model_name_uses_default(self, m
559561
self.assertEqual(result["status"], "success")
560562

561563
# Verify get_embedding_model was called with None (no specific model)
562-
mock_get_embedding.assert_called_once_with("tenant-1", None)
564+
mock_get_embedding.assert_called_once_with("tenant-1", is_multimodal=False)
563565

564566
# Verify knowledge record was created with the model's display name
565567
mock_create_knowledge.assert_called_once()

test/sdk/data_process/test_core.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ def test_validate_parameters_invalid_processor(self, core):
207207
)
208208
def test_select_processor_by_filename(self, core, filename, expected_processor, expected_extractor):
209209
"""Test processor selection based on filename"""
210-
processor_name, extractor = core._select_processor_by_filename(filename)
210+
params = {"model_type": "multi_embedding"} if expected_extractor else {}
211+
processor_name, extractor = core._select_processor_by_filename(filename, params)
211212
assert processor_name == expected_processor
212213
assert extractor == expected_extractor
213214

@@ -349,7 +350,7 @@ def test_file_process_returns_images_when_extractor_available(self, core, mocker
349350
core.processors["UniversalImageExtractor"] = mock_extractor
350351

351352
result = core.file_process(
352-
b"data", "sample.pdf", chunking_strategy="basic"
353+
b"data", "sample.pdf", chunking_strategy="basic", model_type="multi_embedding"
353354
)
354355

355356
chunks = _unpack_chunks(result)
@@ -366,7 +367,11 @@ def test_file_process_with_explicit_processor_still_extracts_images(self, core):
366367
)
367368

368369
result = core.file_process(
369-
b"data", "report.pdf", chunking_strategy="basic", processor="Unstructured"
370+
b"data",
371+
"report.pdf",
372+
chunking_strategy="basic",
373+
processor="Unstructured",
374+
model_type="multi_embedding",
370375
)
371376

372377
chunks = _unpack_chunks(result)

0 commit comments

Comments
 (0)