-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use tool config for gemini pro function calling #3086
Comments
https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/function-calling#curl_2 tried using this locally with Considering we should just move to making http calls (like we do for anthropic models) - will allow everyone to use the latest gemini features without needing to upgrade litellm + vertex ai |
picking this up today. got pushed back due to refactoring work over the weekend. |
@krrishdholakia thanks. Not sure if you know this, but Google Gemini is capable of automatically calling the function for you. In the list of tools, you can pass an instance of
In this example, Then, when you start the chat, you can pass something like this: Please let us know your thoughts |
that looks pretty similar to how openai's function calling works right @guiramos with btw - this should already be live in v https://docs.litellm.ai/docs/providers/gemini#tool-calling rom litellm import completion
import os
# set env
os.environ["GEMINI_API_KEY"] = ".."
tools = [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA",
},
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
},
"required": ["location"],
},
},
}
]
messages = [{"role": "user", "content": "What's the weather like in Boston today?"}]
response = completion(
model="gemini/gemini-1.5-flash",
messages=messages,
tools=tools,
tool_choice="auto"
) |
@krrishdholakia well, not reallly. Google gemini will actually make the call to your function, openai api won't do that. You have to parse the response, build the call to the function yourself. |
that's interesting - can you point me to docs on this @guiramos i'll see how to add it we can probably create a separate issue for tracking that |
@krrishdholakia
Again, pay attention to the You can use
The This is my method I have the custom call for the
This |
what is |
In my implementations is an array of function points that matches the one I am passing to gemini.
The |
Did you give up? |
hi @guiramos, dealing with some p0s. Would welcome a PR for this. |
No description provided.
The text was updated successfully, but these errors were encountered: