Visitar URL original
examples: add current time tool example by luffyIGL010 · Pull Request #798 · ollama/ollama-python · GitHub
Skip to content

examples: add current time tool example - #798

Open
luffyIGL010 wants to merge 1 commit into
ollama:mainfrom
luffyIGL010:add-current-time-tool-example
Open

luffyIGL010 wants to merge 1 commit into
ollama:mainfrom
luffyIGL010:add-current-time-tool-example

Conversation

@luffyIGL010

Copy link
Copy Markdown

What

Adds examples/tools-current-time.py, an example showing how to give a model a
get_current_time tool, plus a unit test covering tool schema generation for a
function with a defaulted str argument.

Why

Models have no clock, so questions like "what time is it?" get guessed or wrong
answers. Tool calling is the correct fix, and there is currently no example
showing this common use case.

How I tested

  • Ran the example against llama3.1 locally; the model called the tool with a
    timezone and answered correctly from the tool output.
  • Added a test in tests/test_utils.py; pytest and ruff pass.

This branch has not been deployed

No deployments
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