[GH-ISSUE #5687] /api/chat role Enum became case sensitive. #3543

Closed
opened 2026-04-12 14:15:40 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @wkr1337 on GitHub (Jul 14, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/5687

What is the issue?

I updated from version 0.1.48 to version 0.2.5.

After the update, the /api/chat endpoint changed. The role object inside the messages object became case sensitive.

Here is an example request that used to work before the update:

{ "model": "llama3", "messages": [ { "role": "USER", "content": "Why is the sky blue?" } ], "options": {}, "stream": false }

But when I run the request now I get what looks like a random response:

{ "model": "llama3", "created_at": "2024-07-14T07:41:45.0417467Z", "message": { "role": "assistant", "content": "I'd be happy to help you with your question. Can you please provide more context or clarify what you mean by \"What is the most effective way to learn English\"? Are you looking for tips on how to improve your grammar, vocabulary, listening, speaking, reading, or writing skills? Or are you wondering about language learning apps, courses, or resources that can help you achieve your goals?\n\nHere are some general tips that might be helpful:\n\n1. **Set specific goals**: Identify what you want to achieve in English, whether it's for personal or professional reasons.\n2. **Practice consistently**: Make time each day to practice speaking, listening, reading, and writing in English.\n3. **Focus on grammar and vocabulary**: Understanding the rules of grammar and building your vocabulary are essential for effective communication.\n4. **Immerse yourself in the language**: Listen to podcasts, watch TV shows or movies, read books or articles, and engage with native speakers to improve your listening and speaking skills.\n5. **Use language learning apps and resources**: There are many great apps, websites, and courses that can help you learn English, such as Duolingo, Coursera, or edX.\n\nLet me know if you have any specific questions or areas of concern, and I'll do my best to assist you!" }, "done_reason": "stop", "done": true, "total_duration": 2718834100, "load_duration": 10797100, "prompt_eval_count": 5, "prompt_eval_duration": 95640000, "eval_count": 266, "eval_duration": 2611441000 }

Then when I change the role "USER" to: "user" it works again.

I was unable to find the change in the release notes.
I'm using langChain4j to communicate with Ollama, and the langChain4j library sends the request with all capital case letters.

If this is not an issue in Ollama, I will create an issue for the langChain4j library.

OS

Windows

GPU

Nvidia

CPU

Intel

Ollama version

0.2.5

Originally created by @wkr1337 on GitHub (Jul 14, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/5687 ### What is the issue? I updated from version 0.1.48 to version 0.2.5. After the update, the /api/chat endpoint changed. The `role` object inside the `messages `object became case **sensitive**. Here is an example request that used to work before the update: `{ "model": "llama3", "messages": [ { "role": "USER", "content": "Why is the sky blue?" } ], "options": {}, "stream": false }` But when I run the request now I get what looks like a random response: `{ "model": "llama3", "created_at": "2024-07-14T07:41:45.0417467Z", "message": { "role": "assistant", "content": "I'd be happy to help you with your question. Can you please provide more context or clarify what you mean by \"What is the most effective way to learn English\"? Are you looking for tips on how to improve your grammar, vocabulary, listening, speaking, reading, or writing skills? Or are you wondering about language learning apps, courses, or resources that can help you achieve your goals?\n\nHere are some general tips that might be helpful:\n\n1. **Set specific goals**: Identify what you want to achieve in English, whether it's for personal or professional reasons.\n2. **Practice consistently**: Make time each day to practice speaking, listening, reading, and writing in English.\n3. **Focus on grammar and vocabulary**: Understanding the rules of grammar and building your vocabulary are essential for effective communication.\n4. **Immerse yourself in the language**: Listen to podcasts, watch TV shows or movies, read books or articles, and engage with native speakers to improve your listening and speaking skills.\n5. **Use language learning apps and resources**: There are many great apps, websites, and courses that can help you learn English, such as Duolingo, Coursera, or edX.\n\nLet me know if you have any specific questions or areas of concern, and I'll do my best to assist you!" }, "done_reason": "stop", "done": true, "total_duration": 2718834100, "load_duration": 10797100, "prompt_eval_count": 5, "prompt_eval_duration": 95640000, "eval_count": 266, "eval_duration": 2611441000 }` Then when I change the `role` "`USER`" to: "`user`" it works again. I was unable to find the change in the release notes. I'm using langChain4j to communicate with Ollama, and the langChain4j library sends the request with all capital case letters. If this is not an issue in Ollama, I will create an issue for the langChain4j library. ### OS Windows ### GPU Nvidia ### CPU Intel ### Ollama version 0.2.5
GiteaMirror added the bug label 2026-04-12 14:15:40 -05:00
Author
Owner

@jmorganca commented on GitHub (Jul 15, 2024):

Hi there, thanks for the issue. We'll take a look at this! That said it is definitely better to request with lowercase if possible

<!-- gh-comment-id:2227733722 --> @jmorganca commented on GitHub (Jul 15, 2024): Hi there, thanks for the issue. We'll take a look at this! That said it is definitely better to request with lowercase if possible
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#3543