mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 13:23:15 +00:00
Fix handling sources, output in chat actor when is automated task
Remove unnecessary ```python prefix removal. It isn't being triggered in json deserialize path.
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user