Closed soundkprz closed 2 months ago
@soundkprz,
Thank you reporting this issue. This looks like an intermittent error and should work now. This repository is for issues related to website(https://ai.google.dev/) like documentation bugs or improvements. For issues related to Gemini, we would suggest you to use "Send Feedback" option in Gemini docs. Ref: Screenshot below.
@soundkprz,
Thank you reporting this issue. This looks like an intermittent error and should work now. This repository is for issues related to website(https://ai.google.dev/) like documentation bugs or improvements. For issues related to Gemini, we would suggest you to use "Send Feedback" option in Gemini docs. Ref: Screenshot below.
Oh I'm sorry then, my bad!
Sadly the issue isn't fixed as of right now and I've consistently had the same error since last week Thursday :/
Can I still send feedback the way you described when I'm using VertexAI?
+1. I'm not able to reproduce this, are you using google.generativeai or vertex?
This code works fine:
import google.generativeai as genai
import google.ai.generativelanguage as glm
google_search_query = glm.FunctionDeclaration(
name="search_and_scrape",
description="Get results from a Google Search",
parameters={
"type_": "OBJECT",
"properties": {
"query": {"type_": "STRING", "description": "Search query"}
},
},
)
search_tools = glm.Tool(
function_declarations=[google_search_query]
)
model = genai.GenerativeModel(
"gemini-1.5-pro-latest",
generation_config=genai.GenerationConfig(
temperature=0.6,
max_output_tokens=2048
),
tools=[search_tools])
# User prompt
prompt = "What are the latest news for Paris?"
response = model.generate_content([img, prompt], tools=[search_tools])
print(response)
+1. I'm not able to reproduce this, are you using google.generativeai or vertex?
This code works fine:
import google.generativeai as genai import google.ai.generativelanguage as glm google_search_query = glm.FunctionDeclaration( name="search_and_scrape", description="Get results from a Google Search", parameters={ "type_": "OBJECT", "properties": { "query": {"type_": "STRING", "description": "Search query"} }, }, ) search_tools = glm.Tool( function_declarations=[google_search_query] ) model = genai.GenerativeModel( "gemini-1.5-pro-latest", generation_config=genai.GenerationConfig( temperature=0.6, max_output_tokens=2048 ), tools=[search_tools]) # User prompt prompt = "What are the latest news for Paris?" response = model.generate_content([img, prompt], tools=[search_tools]) print(response)
I'm having the error with both Vertex and generativeai. Your code works fine for me too, because it isn't multimodal. Can you try adding an actual image to your prompt as well? If I do that I get the error again.
Edit: I know you send "[IMG, prompt]" to the model but there's no "IMG" defined. If I actually define one and send the image to the model as well then I get the error.
model.generate_content([img, prompt], tools=[search_tools])
I was passing an PIL.Image here (it would have been a name error otherwise).
model.generate_content([img, prompt], tools=[search_tools])
I was passing an PIL.Image here (it would have been a name error otherwise).
Oh? That is very very weird then. I've had this error since last week Thursday, on 2 seperate PC's, with both vertexai and generativeai, in every project I've tried it in (even made a new project with new code just to try it)
I don't understand why I get this error then :(
model.generate_content([img, prompt], tools=[search_tools])
I was passing an PIL.Image here (it would have been a name error otherwise).
Now your code works for me, but VertexAI still has the same issue even when using the same code but with vertexai instead of genai
Description of the bug:
When sending a multimodal request to the model via the Python SDK while also defining tools / function declarations I consistently receive an internal error 500. If I take away the tools OR the image and keep the other it works again. I haven't changed anything about the code and it has worked before just fine, but now I suddenly get this error.
Actual vs expected behavior:
Actual: I receive an error 500
Expected: The modal should handle the request and respond without error
Any other information you'd like to share?
google_search_query = FunctionDeclaration( name="search_and_scrape", description="Get results from a Google Search", parameters={ "type": "object", "properties": { "query": {"type": "string", "description": "Search query"} }, }, )
search_tools = Tool( function_declarations=[google_search_query] )
model = GenerativeModel( "gemini-1.5-pro-preview-0409", generation_config=GenerationConfig( temperature=0.6, max_output_tokens=2048 ), tools=[search_tools])
async def main():
User prompt