Skip to content

Commit 211106a

Browse files
committed
fix(types): Normalize file content payloads to bytes for mypy compatibility.
Signed-off-by: Sébastien Han <seb@redhat.com>
1 parent f1ba430 commit 211106a

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/ogx/providers/remote/file_processor/docling_serve/docling_serve.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ async def process_file(
7070
content_response = await self.files_api.openai_retrieve_file_content(
7171
RetrieveFileContentRequest(file_id=file_id)
7272
)
73-
content = content_response.body
73+
# Normalize bytes/memoryview payloads to bytes for downstream file handling.
74+
content = bytes(content_response.body)
7475

7576
document_id = file_id if file_id else str(uuid.uuid4())
7677
document_metadata: dict[str, Any] = {"filename": filename}

src/ogx/providers/utils/memory/openai_vector_store_mixin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ async def openai_attach_file_to_vector_store(
13101310
content_response = await self.files_api.openai_retrieve_file_content(
13111311
RetrieveFileContentRequest(file_id=file_id)
13121312
)
1313-
full_content = content_from_data_and_mime_type(content_response.body, mime_type)
1313+
full_content = content_from_data_and_mime_type(bytes(content_response.body), mime_type)
13141314
await self._execute_contextual_chunk_transformation(chunks, full_content, chunking_strategy.contextual)
13151315
if not chunks:
13161316
vector_store_file_object.status = "failed"

0 commit comments

Comments
 (0)