Skip to content

LLMAssistantAggregator: preserve non-ASCII characters in JSON output#3536

Merged
markbackman merged 1 commit intopipecat-ai:mainfrom
surapuramakhil:main
Jan 26, 2026
Merged

LLMAssistantAggregator: preserve non-ASCII characters in JSON output#3536
markbackman merged 1 commit intopipecat-ai:mainfrom
surapuramakhil:main

Conversation

@surapuramakhil
Copy link
Copy Markdown
Contributor

Add ensure_ascii=False to json.dumps() calls for tool call arguments and function call results to prevent unnecessary unicode escaping.

Please describe the changes in your PR. If it is addressing an issue, please reference that as well.

solves #3535

Add ensure_ascii=False to json.dumps() calls for tool call arguments
and function call results to prevent unnecessary unicode escaping.
Copilot AI review requested due to automatic review settings January 22, 2026 21:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue where non-ASCII characters (e.g., Japanese, Chinese, etc.) were being unnecessarily escaped to Unicode sequences in LLM context, making it difficult for LLMs to understand conversations in non-English languages. The fix adds ensure_ascii=False parameter to json.dumps() calls to preserve the original character encoding.

Changes:

  • Added ensure_ascii=False to json.dumps() for function call arguments serialization
  • Added ensure_ascii=False to json.dumps() for function call result serialization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@markbackman markbackman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Nice catch.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
...t/processors/aggregators/llm_response_universal.py 79.68% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@markbackman markbackman merged commit ecf2e69 into pipecat-ai:main Jan 26, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants