8000 Encoding Support for Emojis in save_response_to_file Method for Makrdown · Issue #2690 · agno-agi/agno · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Encoding Support for Emojis in save_response_to_file Method for Makrdown #2690

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

Closed
statisticalplumber opened this issue Apr 5, 2025 · 2 comments
Assignees
Labels

Comments

@statisticalplumber
Copy link
statisticalplumber commented Apr 5, 2025

https://github.com/agno-agi/agno/blame/62ae18304c4d74375df273478fb0beff04e2a718/libs/agno/agno/agent/agent.py#L2877

Hi Team,

First, I want to express my appreciation for your excellent library—I've been using it extensively in my product development, and it's been a great help!

However, I’ve encountered an issue when saving responses in markdown format that contain emojis. The file doesn't get saved due to an encoding issue when using the save_response_to_file method.

Here’s the code I am using:

research_scholar = Agent(
    model=OpenAILike(id="gpt-4o", base_url='http://localhost:1234/v1' ,api_key='lm'),
    save_response_to_file="tmp/{message}.md",
    instructions= """Write response using emojis """,
    stream=True,
    markdown=True
)

The issue seems to stem from the encoding used when writing the response content to the file. The problem was resolved on my end when I modified this line: fn_path.write_text(self.run_response.content) to fn_path.write_text(self.run_response.content, encoding="utf-8")

After adding UTF-8 encoding, the emojis were saved correctly. I would like to suggest that you consider providing built-in support for encoding options in the save_response_to_file method, as this would resolve the issue for all users who deal with non-ASCII characters such as emojis.

Thank you for your consideration, and I look forward to any updates or fixes to address this

Note: Also let me know in case you guys want me to raise the pull request with this fix, though this is small.

@Ayush0054
Copy link
Contributor

Hey @statisticalplumber,
Thanks for pointing out this issue! We’d really appreciate it if you could raise a PR with the fix — we’ll test it and get it merged.
Thanks again! 🙌

Copy link

This issue has been automatically marked as stale due to 30 days of inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
0