From 029bd3be56af686c76ac3f4eb9e5227f303a61a4 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Thu, 19 Jun 2025 16:35:14 -0700 Subject: [PATCH] Handle breaking change in write file to e2b code sandbox For some reason the function signature, kwargs are broken. Removing usage of keyword args resolves the file upload to sandbox error. --- src/khoj/database/models/__init__.py | 2 +- src/khoj/processor/tools/run_code.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/khoj/database/models/__init__.py b/src/khoj/database/models/__init__.py index 597310ab..4381c729 100644 --- a/src/khoj/database/models/__init__.py +++ b/src/khoj/database/models/__init__.py @@ -34,7 +34,7 @@ class CodeContextFile(PydanticBaseModel): class CodeContextResult(PydanticBaseModel): success: bool output_files: List[CodeContextFile] - std_out: str + std_out: Optional[str] = None std_err: str code_runtime: Optional[int] = None diff --git a/src/khoj/processor/tools/run_code.py b/src/khoj/processor/tools/run_code.py index 5b9c2d04..d9a80f71 100644 --- a/src/khoj/processor/tools/run_code.py +++ b/src/khoj/processor/tools/run_code.py @@ -232,8 +232,7 @@ async def execute_e2b(code: str, input_files: list[dict]) -> dict[str, Any]: try: # Upload input files in parallel upload_tasks = [ - sandbox.files.write(path=file["filename"], data=base64.b64decode(file["b64_data"]), request_timeout=30) - for file in input_files + sandbox.files.write(file["filename"], base64.b64decode(file["b64_data"])) for file in input_files ] await asyncio.gather(*upload_tasks)