diff --git a/src/khoj/processor/conversation/utils.py b/src/khoj/processor/conversation/utils.py index f496583b..91ba3c72 100644 --- a/src/khoj/processor/conversation/utils.py +++ b/src/khoj/processor/conversation/utils.py @@ -528,7 +528,7 @@ def reciprocal_conversation_to_chatml(message_pair): def clean_json(response: str): """Remove any markdown json codeblock and newline formatting if present. Useful for non schema enforceable models""" - return response.strip().replace("\n", "").removeprefix("```json").removeprefix("```python").removesuffix("```") + return response.strip().replace("\n", "").removeprefix("```json").removesuffix("```") def clean_code_python(code: str): diff --git a/src/khoj/routers/helpers.py b/src/khoj/routers/helpers.py index 52d67c6e..b011106e 100644 --- a/src/khoj/routers/helpers.py +++ b/src/khoj/routers/helpers.py @@ -411,7 +411,7 @@ async def aget_data_sources_and_output_format( f"Invalid response for determining relevant tools: {selected_sources}. Raw Response: {response}" ) - result: Dict = {"sources": [], "output": None} if not is_task else {"output": ConversationCommand.AutomatedTask} + result: Dict = {"sources": [], "output": None if not is_task else ConversationCommand.AutomatedTask} for selected_source in selected_sources: # Add a double check to verify it's in the agent list, because the LLM sometimes gets confused by the tool options. if (