-
Notifications
You must be signed in to change notification settings - Fork 16.6k
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
Granite 3.2 Thinking #30122
Comments
does Ollama actually support "control" message? i believe you need to use "system" message instead. or perhaps there is some other way to supply this param via a config? do you have any docs referencing this "control" message? |
Did you try a ChatMessage with the control type |
hmmm ok, you are right : I tried with ollama without langchain import ollama
ollama_client = ollama.Client(host="http://192.168.10.59:11434")
response = ollama_client.chat(
model=OLLAMA_CHAT_MODEL,
messages=[
{
"role": "control",
"content": "thinking",
},
{
"role": "user",
"content": query,
}
],
)
print(response) exception :
I don't understand as ollama 0.5.13 support all Granite3.2 models |
here is a reference message : ollama/ollama#8955 (comment) |
this is working : echo '{"model": "granite3.2:8b-instruct-q8_0",
"messages":[
{"role":"control","content":"thinking"},
{"role":"user","content":"how many times does the letter `r` occur in the word `strawberry`?"}
],
"stream":false}' | curl -s http://localhost:11434/api/chat -d @- | jq -r .message.content Answer:
|
with a patch from ollama, error is now from langchain_core see https://github.com/ollama/ollama-python/pull/462#issuecomment-2702926254 I updated traceback in first post |
Ollama server has no problem processing messages with the "control" role. However, both ollama-python (ollama python client) and langchain (specifcally langchain-core) raise an error if a message's 'role' field/attribute is not one of a set of accepted literals. The PR linked by @lemassykoi resolves the error raised by ollama-python, but it looks like similar changes would need to be made in both langchain-core and langchain-ollama. |
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
Description
I'm trying to use create_react_agent with Granite3.2 with Thinking
System Info
langchain_ollama version: 0.2.3
langchain_core version: 0.3.41
langchain_community version: 0.3.19
langchain_openai version: 0.2.12
langgraph version: 0.3.5
langsmith version: 0.3.11
The text was updated successfully, but these errors were encountered: