mirror of
https://github.com/ollama/ollama-python.git
synced 2026-07-21 09:05:23 -04:00
New Tool Calling issues. #169
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AssassinUKG on GitHub (Nov 26, 2024).
What is the issue?
In my image below you can see me using the code functions provided by the ollama python examples on GitHub, specifically the tools.py example (added client for local ollama)
Sometimes the values are treated as strings and other times as integer, although the function definition is an int type.
How to resolve this as other tools will likely suffer the same issue.
OS
Windows
GPU
Nvidia
CPU
AMD
Ollama version
ollama version is 0.4.5
@ParthSareen commented on GitHub (Nov 26, 2024):
So since function calling from the model doesn't check types (and python is not strongly typed) - that's something the user has to do unfortunately. Based on my testing small models often return correctly typed data just wrapped within a string. I'd recommend typechecking/pulling the data into your desired format.
You can either structure that in your function calling code.
E.g.
Or within the function:
IMO the first option is better as you can make helper type checking functions. Appreciate you bringing this up though! Probably helpful for new users!
@AssassinUKG commented on GitHub (Nov 26, 2024):
Many Thanks @ParthSareen Appriciate the example and reply 👍