# Patch the GenAI client for Instructor
client = instructor.from_genai(
    gemini_client, mode=instructor.Mode.GENAI_STRUCTURED_OUTPUTS
)

user_info = client.chat.completions.create(
    model="gemini-2.0-flash-001",
    response_model=UserInfo,
    messages=[{"role": "user", "content": "John Doe is 30 years old."}],
)

print(user_info)
```

You can read more about how to use the Instructor library in [their documentation](https://python.useinstructor.com/).