examples: reorder parameters and add options configuration in example

- Move `think` parameter after `messages` for better parameter ordering
- Add `options` dict with temperature, top_p, and top_k settings
- Add comment showing think parameter accepts "low", true, or false
This commit is contained in:
Xinyue 2026-02-16 17:05:06 +01:00
parent a3396e310a
commit e6c8210330

View File

@ -159,10 +159,15 @@ def div(a: float, b: float) -> float:
if __name__ == "__main__":
from ollama import chat
response, messages = ollama_automatic_function_calling(
response, messages = ollama_chat_automatic_function_calling(
chat,
model="glm-5:cloud",
think="low",
tools=[add, sub, mul, div],
messages=[{"role": "user", "content": "这个数学题4+7*9/6是多少?"}],
think="low", # or true, false
options={
"temperature": 1,
"top_p": 1.0,
"top_k": 60,
},
)