generative-ai-python
generative-ai-python copied to clipboard
Model response to another function call
Description of the feature request:
With Vertex API when you catch a function call you can deal with that and then return the information back to the AI in a response to the function call for it to fulfill the initial message of the user
response = self.model.generate_content(
[
GeminiService()._build_user_prompt_content(message), # User prompt
response_function_call_content, # Function call response
Content(
role="function",
parts=[
Part.from_function_response(
name="get_current_weather",
response={
"content": api_response, # Return the API response to Gemini
},
)
],
),
],
tools=[self.weather_tool],
)
What problem are you trying to solve with this feature?
can this be done with this library if so how.
Any other information you'd like to share?
i tried converting it using some objects form here
from google.ai.generativelanguage import (
Content,
FunctionDeclaration,
Part,
Tool,
)
its not working though Im wondering if its supported
type object 'Part' has no attribute 'from_function_response'