Skip to content

Commit 9cb38ce

Browse files
committed
Improvements based on code feedback
1 parent d7bf13d commit 9cb38ce

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

.github/workflows/run_evals.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
BATCH_SIZE: "20"
109109
RANDOMIZE: "True"
110110
KHOJ_URL: "http://localhost:42110"
111-
KHOJ_CHAT_MODEL: ${{ github.event_name == 'workflow_dispatch' && inputs.chat_model || 'gemini-2.0-flash' }}
111+
KHOJ_DEFAULT_CHAT_MODEL: ${{ github.event_name == 'workflow_dispatch' && inputs.chat_model || 'gemini-2.0-flash' }}
112112
KHOJ_LLM_SEED: "42"
113113
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
114114
SERPER_DEV_API_KEY: ${{ matrix.dataset != 'math500' && secrets.SERPER_DEV_API_KEY }}

src/khoj/processor/conversation/prompts.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@
10511051
10521052
Example 3:
10531053
---
1054-
Q: Plot the world ppulation growth over the years, given this year, world population world tuples: [(2000, 6), (2001, 7), (2002, 8), (2003, 9), (2004, 10)].
1054+
Q: Plot the world population growth over the years, given this year, world population world tuples: [(2000, 6), (2001, 7), (2002, 8), (2003, 9), (2004, 10)].
10551055
A: Absolutely! We can utilize the Pandas and Matplotlib libraries (as both are available in the sandbox) to create the world population growth plot.
10561056
```python
10571057
import pandas as pd

src/khoj/processor/tools/run_code.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141

4242
SANDBOX_URL = os.getenv("KHOJ_TERRARIUM_URL", "http://localhost:8080")
43+
DEFAULT_E2B_TEMPLATE = "pmt2o0ghpang8gbiys57"
4344

4445

4546
class GeneratedCode(NamedTuple):
@@ -219,7 +220,7 @@ async def execute_e2b(code: str, input_files: list[dict]) -> dict[str, Any]:
219220

220221
sandbox = await AsyncSandbox.create(
221222
api_key=os.getenv("E2B_API_KEY"),
222-
template=os.getenv("E2B_TEMPLATE", "pmt2o0ghpang8gbiys57"),
223+
template=os.getenv("E2B_TEMPLATE", DEFAULT_E2B_TEMPLATE),
223224
timeout=120,
224225
request_timeout=30,
225226
)
@@ -232,7 +233,7 @@ async def execute_e2b(code: str, input_files: list[dict]) -> dict[str, Any]:
232233
]
233234
await asyncio.gather(*upload_tasks)
234235

235-
# Note stored files before execution
236+
# Note stored files before execution to identify new files created during execution
236237
E2bFile = NamedTuple("E2bFile", [("name", str), ("path", str)])
237238
original_files = {E2bFile(f.name, f.path) for f in await sandbox.files.list("~")}
238239

@@ -258,7 +259,7 @@ async def execute_e2b(code: str, input_files: list[dict]) -> dict[str, Any]:
258259

259260
# Collect output files from execution results
260261
for idx, result in enumerate(execution.results):
261-
for result_type in ["png", "jpeg", "svg", "text", "markdown", "json"]:
262+
for result_type in {"png", "jpeg", "svg", "text", "markdown", "json"}:
262263
if b64_data := getattr(result, result_type, None):
263264
output_files.append({"filename": f"{idx}.{result_type}", "b64_data": b64_data})
264265
break

src/khoj/utils/initialization.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def _update_chat_model_options():
309309

310310
# Update the default chat model if it doesn't match
311311
chat_config = ConversationAdapters.get_default_chat_model()
312-
env_default_chat_model = os.getenv("KHOJ_CHAT_MODEL")
312+
env_default_chat_model = os.getenv("KHOJ_DEFAULT_CHAT_MODEL")
313313
if not chat_config or not env_default_chat_model:
314314
return
315315
if chat_config.name != env_default_chat_model:

0 commit comments

Comments
 (0)