From a775bbfdf2be51b208474a71b6f9c7c3dd4ad9a8 Mon Sep 17 00:00:00 2001 From: cthomas Date: Wed, 7 Jan 2026 11:58:51 -0800 Subject: [PATCH] feat: offload llama index init logic (#8387) --- letta/services/file_processor/file_processor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/letta/services/file_processor/file_processor.py b/letta/services/file_processor/file_processor.py index ed4e0c5b..81ca5513 100644 --- a/letta/services/file_processor/file_processor.py +++ b/letta/services/file_processor/file_processor.py @@ -50,8 +50,10 @@ class FileProcessor: """Chunk text and generate embeddings with fallback to default chunker if needed""" filename = file_metadata.file_name - # Create file-type-specific chunker - text_chunker = LlamaIndexChunker(file_type=file_metadata.file_type, chunk_size=self.embedder.embedding_config.embedding_chunk_size) + # Create file-type-specific chunker in thread pool to avoid blocking event loop + text_chunker = await asyncio.to_thread( + LlamaIndexChunker, file_type=file_metadata.file_type, chunk_size=self.embedder.embedding_config.embedding_chunk_size + ) # First attempt with file-specific chunker try: