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:
Debanjum 2024-11-19 13:49:27 -08:00
parent 0e7d611a80
commit 7bdc9590dd
2 changed files with 2 additions and 2 deletions

View file

@ -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):

View file

@ -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 (