You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the Ollama.chat method to interact with the llama3 model, responses containing special characters (e.g., accented characters like á, é, í, ó, ú, ü and punctuation like ¿, ¡) are improperly encoded. While standard ASCII characters work fine, non-ASCII characters are returned with encoding artifacts, making them unreadable.
This issue persists across attempts to decode or process the responses within the client code, suggesting the issue might be related to how the library or server processes UTF-8 encoding.
Observed Behavior
The following responses were received when interacting with the llama3 model via Ollama.chat:
What version of Ollama are you running? There were some Unicode issues on earlier versions but we have tests to verify this now and it seemed to work fine when I just tried it:
ollama % ./ollama run llama3
>>> ¡Hola! ¿Cómo estás?
¡Hola! Como soy un modelo de lenguaje artificial, no tengo sentimientos ni emociones como los seres humanos, por
lo que no estoy realmente "bien" o "mal". Estoy aquí para ayudarte en cualquier cosa que necesites, responder a
tus preguntas y tener una conversación con vosotros. ¿En qué puedo ayudarte hoy?
Hi @jasp402 as Jesse demonstrated the server seems to correctly encode the response, I have also tested on my system (using MacOS and Bun) and the content is encoded correctly.
❯ bun run chat.ts
¡Hola! Estoy bien, gracias. ¿Y tú cómo estáis? Es un placer tenerte aquí. ¿En qué puedo ayudarte hoy?
Estoy bien, gracias. ¿En qué puedo ayudarte hoy? ¿Necesitas ayuda con algo en particular o simplemente quieres charlar un rato? Estoy aquí para escucharte y responder a tus preguntas.%
Would you be able to try the sample code I have here? I'm wondering if its a Windows specific issue or a middleware/proxy causing the issue.
Description
When using the Ollama.chat method to interact with the llama3 model, responses containing special characters (e.g., accented characters like á, é, í, ó, ú, ü and punctuation like ¿, ¡) are improperly encoded. While standard ASCII characters work fine, non-ASCII characters are returned with encoding artifacts, making them unreadable.
This issue persists across attempts to decode or process the responses within the client code, suggesting the issue might be related to how the library or server processes UTF-8 encoding.
Observed Behavior
The following responses were received when interacting with the llama3 model via Ollama.chat:
This was expected to be:
Additional Context
Direct API Output
Testing with curl shows that responses from the server are returned in fragments:
Response
This suggests the fragments are being returned correctly in terms of structure but not properly encoded.
Attempts to Resolve
UTF-8 Decoding Using Buffer: Tried decoding the response as UTF-8:
Result:
Environment Details
OS: Windows 11
Node.js Version: 20.x
Library Version: Latest (installed via npm)
Model Used: llama3
API Host: http://127.0.0.1:11434
Request
Thank you for addressing this issue. If more information or debugging steps are needed, feel free to reach out!
The text was updated successfully, but these errors were encountered: