We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
run without error, as the code below is from vertexai documentation: https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/control-generated-output
returns the error : TypeError: GenerationConfig.init() got an unexpected keyword argument 'response_schema'
just run this code with your credentials
import vertexai from dotenv import load_dotenv import os from vertexai.generative_models import GenerationConfig, GenerativeModel # Load environment variables load_dotenv() # Set Google Application Credentials os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = ... # Initialize Vertex AI project_id = "..." vertexai.init(project=project_id, location="us-central1") response_schema = { "type": "array", "items": { "type": "object", "properties": { "recipe_name": { "type": "string", }, }, "required": ["recipe_name"], }, } model = GenerativeModel("gemini-1.5-pro-001") response = model.generate_content( "List a few popular cookie recipes", generation_config=GenerationConfig( response_mime_type="application/json", response_schema=response_schema ), ) print(response.text)
The text was updated successfully, but these errors were encountered:
@tytung2020 , were you able to overcome this?
Sorry, something went wrong.
have u tried to upgrade vertex AI version pip3 install --upgrade "google-cloud-aiplatform" pip install --upgrade "google-cloud-aiplatform"
No branches or pull requests
Expected Behavior
run without error, as the code below is from vertexai documentation: https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/control-generated-output
Actual Behavior
returns the error :
TypeError: GenerationConfig.init() got an unexpected keyword argument 'response_schema'
Steps to Reproduce the Problem
just run this code with your credentials
Specifications
The text was updated successfully, but these errors were encountered: