-
Notifications
You must be signed in to change notification settings - Fork 22
Support for latest Gemini thinking and generation config #266
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
base: main
Are you sure you want to change the base?
Conversation
| return result | ||
|
|
||
|
|
||
| class GenerationConfig: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like you've defined some classes that are effectively models (just for types). I'd use Pydantic for that, since you can drastically reduce the boilerplate:
import pydantic
class Person(pydantic.BaseModel):
age: int
car: str | None = None
name: str
person = Person(age=30, name="Alice")
person_dict = person.model_dump(mode="json")| model: str, | ||
| base_url: Optional[str] = None, | ||
| headers: Optional[dict[str, str]] = None, | ||
| generation_config: Optional[GenerationConfig] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for typing some configs but not others? For example, why type generation_config but not tool_config?
| from inngest.experimental.ai.gemini import ( | ||
| Adapter as GeminiAdapter, | ||
| ) | ||
| from inngest.experimental.ai.gemini import ( | ||
| GenerationConfig, | ||
| ThinkingConfig, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: renaming imports can hurt grepability of the codebase. Someone might see this and search for class GeminiAdapter and they'd get zero results. It might be a little easier to grok with an import like this:
from inngest.experimental.ai import geminiAnd then you could instantiate gemini.Adapter.
This approach also organizes the other classes in the module, so gemini.GenerationConfig and gemini.ThinkingConfig are visually grouped with gemini.Adapter
Description
This PR introduces several enhancements to the Inngest Python SDK - focusing on improving the dev experience with a new linting command, updating the Gemini AI adapter to support their latest thinking/generation config and restructuring our smoke tests.
Features
Makefile Enhancements for Linting: A new
lint-fixcommand has been added to the rootMakefileand all package-levelMakefiles. This allows developers to automatically fix linting issues across the entire project by runningmake lint-fixfrom the root, or within a specific package. This command leveragesruff check --fixto apply safe fixes.Gemini Adapter Upgrade: The Gemini AI adapter has been significantly refactored to support the latest capabilities of the Gemini API.
GenerationConfigandThinkingConfig: Introduced new configuration classes,GenerationConfigandThinkingConfig, to provide a structured and intuitive way to control generation parameters, including temperature, token limits, and the new "thinking" feature.on_call: Theon_callmethod now robustly handles various Gemini-specific parameters, including tools, safety settings, and system instructions. It also includes a utility to seamlessly convert OpenAI-style message formats to Gemini's nativecontentsformat.__init__method has been updated to accept the new configuration objectsRestructured and Expanded Smoke Tests: The smoke tests for our AI model adapters have been reorganized for clarity and expanded to provide more thorough coverage.
tests/smoke/models.