[OpenSearch] Add chunks specific to an app_id if present (#765)
This commit is contained in:
@@ -17,14 +17,15 @@ class TestImageChunker(unittest.TestCase):
|
||||
chunker.set_data_type(DataType.IMAGES)
|
||||
|
||||
image_path = "./tmp/image.jpeg"
|
||||
result = chunker.create_chunks(MockLoader(), image_path)
|
||||
app_id = "app1"
|
||||
result = chunker.create_chunks(MockLoader(), image_path, app_id=app_id)
|
||||
|
||||
expected_chunks = {
|
||||
"doc_id": "123",
|
||||
"doc_id": f"{app_id}--123",
|
||||
"documents": [image_path],
|
||||
"embeddings": ["embedding"],
|
||||
"ids": ["140bedbf9c3f6d56a9846d2ba7088798683f4da0c248231336e6a05679e4fdfe"],
|
||||
"metadatas": [{"data_type": "images", "doc_id": "123", "url": "none"}],
|
||||
"metadatas": [{"data_type": "images", "doc_id": f"{app_id}--123", "url": "none"}],
|
||||
}
|
||||
self.assertEqual(expected_chunks, result)
|
||||
|
||||
@@ -37,14 +38,15 @@ class TestImageChunker(unittest.TestCase):
|
||||
chunker.set_data_type(DataType.IMAGES)
|
||||
|
||||
image_path = "./tmp/image.jpeg"
|
||||
result = chunker.create_chunks(MockLoader(), image_path)
|
||||
app_id = "app1"
|
||||
result = chunker.create_chunks(MockLoader(), image_path, app_id=app_id)
|
||||
|
||||
expected_chunks = {
|
||||
"doc_id": "123",
|
||||
"doc_id": f"{app_id}--123",
|
||||
"documents": [image_path],
|
||||
"embeddings": ["embedding"],
|
||||
"ids": ["140bedbf9c3f6d56a9846d2ba7088798683f4da0c248231336e6a05679e4fdfe"],
|
||||
"metadatas": [{"data_type": "images", "doc_id": "123", "url": "none"}],
|
||||
"metadatas": [{"data_type": "images", "doc_id": f"{app_id}--123", "url": "none"}],
|
||||
}
|
||||
self.assertEqual(expected_chunks, result)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user