-
Notifications
You must be signed in to change notification settings - Fork 5k
Fixed JSON formatting #3475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fixed JSON formatting #3475
Conversation
agent_role = agent_role.partition("\n")[0] | ||
|
||
if isinstance(formatted_answer, AgentAction): | ||
thought = re.sub(r"\n+", "\n", formatted_answer.thought) | ||
formatted_json = json.dumps( | ||
formatted_answer.tool_input, | ||
json.loads(formatted_answer.tool_input), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only change done, rest are the linting changes
sources_branch = None | ||
|
||
# Try to find an existing "Sources Used" branch | ||
for sub_child in child.children: | ||
if "Sources Used" in str(sub_child.label): | ||
sources_branch = sub_child | ||
break | ||
else: | ||
sources_branch = child.add("Sources Used") | ||
sources_branch.add(f"✅ {memory_type} ({query_time_ms:.2f}ms)") | ||
break | ||
|
||
# If not found, create it under this child | ||
if sources_branch is None: | ||
sources_branch = child.add("🧠 Sources Used") | ||
|
||
sources_branch.add(f"✅ {memory_type} ({query_time_ms:.2f}ms)") | ||
break | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is was a logic change done, because of linter.
sources_branch = None | ||
|
||
# Try to find an existing "Sources Used" branch | ||
for sub_child in child.children: | ||
if "Sources Used" in str(sub_child.label): | ||
sources_branch = sub_child | ||
break | ||
else: | ||
|
||
# If not found, create it under this child | ||
if sources_branch is None: | ||
sources_branch = child.add("🧠 Sources Used") | ||
sources_branch.add(f"❌ {memory_type} - Error: {error}") | ||
break | ||
|
||
sources_branch.add(f"❌ {memory_type} - Error: {error}") | ||
break | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one as well
Requesting @lorenzejay for review |
This fixes the tool input console formatting
Fixes #3474