Update user message format for temperature query (#13256)

This commit is contained in:
Nathan Hook 2025-12-02 16:08:39 -07:00 committed by GitHub
parent 20aee96706
commit cc9555aff0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 6 deletions

View File

@ -15,7 +15,7 @@ Also known as "single-shot" tool calling.
```shell ```shell
curl -s http://localhost:11434/api/chat -H "Content-Type: application/json" -d '{ curl -s http://localhost:11434/api/chat -H "Content-Type: application/json" -d '{
"model": "qwen3", "model": "qwen3",
"messages": [{"role": "user", "content": "What's the temperature in New York?"}], "messages": [{"role": "user", "content": "What is the temperature in New York?"}],
"stream": false, "stream": false,
"tools": [ "tools": [
{ {
@ -41,7 +41,7 @@ Also known as "single-shot" tool calling.
curl -s http://localhost:11434/api/chat -H "Content-Type: application/json" -d '{ curl -s http://localhost:11434/api/chat -H "Content-Type: application/json" -d '{
"model": "qwen3", "model": "qwen3",
"messages": [ "messages": [
{"role": "user", "content": "What's the temperature in New York?"}, {"role": "user", "content": "What is the temperature in New York?"},
{ {
"role": "assistant", "role": "assistant",
"tool_calls": [ "tool_calls": [
@ -90,7 +90,7 @@ Also known as "single-shot" tool calling.
} }
return temperatures.get(city, "Unknown") return temperatures.get(city, "Unknown")
messages = [{"role": "user", "content": "What's the temperature in New York?"}] messages = [{"role": "user", "content": "What is the temperature in New York?"}]
# pass functions directly as tools in the tools list or as a JSON schema # pass functions directly as tools in the tools list or as a JSON schema
response = chat(model="qwen3", messages=messages, tools=[get_temperature], think=True) response = chat(model="qwen3", messages=messages, tools=[get_temperature], think=True)
@ -146,7 +146,7 @@ Also known as "single-shot" tool calling.
}, },
] ]
const messages = [{ role: 'user', content: "What's the temperature in New York?" }] const messages = [{ role: 'user', content: "What is the temperature in New York?" }]
const response = await ollama.chat({ const response = await ollama.chat({
model: 'qwen3', model: 'qwen3',
@ -609,7 +609,7 @@ def get_temperature(city: str) -> str:
return temperatures.get(city, 'Unknown') return temperatures.get(city, 'Unknown')
messages = [{'role': 'user', 'content': "What's the temperature in New York?"}] messages = [{'role': 'user', 'content': "What is the temperature in New York?"}]
while True: while True:
stream = chat( stream = chat(
@ -684,7 +684,7 @@ const getTemperatureTool = {
} }
async function agentLoop() { async function agentLoop() {
const messages = [{ role: 'user', content: "What's the temperature in New York?" }] const messages = [{ role: 'user', content: "What is the temperature in New York?" }]
while (true) { while (true) {
const stream = await ollama.chat({ const stream = await ollama.chat({