Skip to content

Examples: add automatic function calling helper#621

Open
XinyueZ wants to merge 6 commits intoollama:mainfrom
XinyueZ:main
Open

Examples: add automatic function calling helper#621
XinyueZ wants to merge 6 commits intoollama:mainfrom
XinyueZ:main

Conversation

@XinyueZ
Copy link

@XinyueZ XinyueZ commented Feb 16, 2026

Consider making the automatic function calling helper idea official.

- Rename `ollama_automatic_function_calling` to `ollama_chat_automatic_function_calling`
- Add `options` parameter with default None
- Pass `options` to client function call
- Update docstring to clarify client_fn parameter
- Remove duplicate import statement
- 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
- Remove duplicate `from ollama import ChatResponse, chat` import
- Initialize `messages` as empty list instead of getting from kwargs
- Remove `reserved` set and `chat_kwargs` filtering logic
- Add `think` parameter to client function call
- Reformat client_fn call with explicit parameters on separate lines
- Add `messages` as explicit parameter instead of initializing empty list
- Extract `tools` from kwargs for conditional tool_map initialization
- Only initialize tool_map when both tool_map is None and tools exist
- Add reserved parameters set and filter chat_kwargs
- Remove hardcoded `think` parameter from client call
- Add null check for tool_map before accessing in tool execution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant