Repository navigation
fix(py): drop published dev extras, move Firestore behind extras, packaging fixes - #7146
huangjeff5 wants to merge 6 commits into
Conversation
genkit-vertexai advertised Vertex AI but exported only ModelGarden, so 'from genkit_vertexai import VertexAI' failed and 'pip install genkit[vertexai]' gave users no Gemini plugin. Depend on genkit-google-genai and re-export its VertexAI (same class). README and description now state the split. (PR7-04)
ModelGarden imported genkit_openai._models._model.OpenAIModel and genkit_anthropic._models/_model_info, which forced exact ==X.Y.Z pins on the [openai]/[anthropic] extras. Add narrow public modules: - genkit_openai.plugin_api.openai_compatible_model(model, client, *, supports) - genkit_anthropic.plugin_api.anthropic_model(model, client) - genkit_anthropic.plugin_api.anthropic_model_info(model) Extras move to capped ranges (>=X.Y.Z,<2), which bump_version and check_consistency already handle. (PR7-05)
release_rc_python.yml rewrote only 'version = "CUR"' lines, leaving intra-repo floors and the genkit-vertexai extras at the old version. After #6947 that ships genkit-vertexai==1.0.0rc1 pinned to 0.13.0 siblings; before it, an uninstallable genkit-evaluators==1.0.0rc1. - bump_version accepts X.Y.Z-rc.N and moves floors, caps, and pins. - The workflow runs bump_version, then check_consistency, before commit or push, so a 1.0 RC with genkit-evaluators still present fails early. - Drop the uv 0.6.6 pin: it rewrites the revision 3 uv.lock as revision 1 (~5.8k-line diff). (PR7-07)
genkit-google-cloud hard-required google-cloud-firestore (plus gRPC) for every telemetry-only install, though only the experimental FirestoreSessionStore uses it. Move it to a 'firestore' extra. Importing FirestoreSessionStore without it raises ModuleNotFoundError naming uv add 'genkit-google-cloud[firestore]'. opentelemetry-exporter-gcp-trace 1.15 marks CloudTraceSpanExporter @deprecated, so subclassing it printed a DeprecationWarning on 'import genkit_google_cloud'. Silence that one message around the class statement; the OTLP migration upstream recommends is separate. (PR7-12)
…sample deps - genkit-middleware and genkit-a2ui shipped Provides-Extra: dev with pytest pins; move them to PEP 735 [dependency-groups]. - py/pyproject.toml listed the removed dynamic-tools sample as a workspace source; the sample is multipart-tools. - basic-flows, fastapi-bugbot, context, output-formats, tracing and otel-jaeger import fastapi/pydantic/opentelemetry-api directly; declare them instead of relying on transitive installs. - Guard test: no test-only extras on published packages, and every sample is a named workspace source. (PR7-13)
AnthropicConfig accepted any temperature/top_p, so out-of-range values reached the API as a 400. Declare common_field_bounds (both [0, 1]), which also puts minimum/maximum in the Dev UI schema. Model Garden's Claude models share the config. Cache reads and writes only appeared in usage.custom. Map them to cached_content_tokens and cache_write_tokens, the fields genkit-openai, genkit-google-genai and genkit-otel read; custom keeps the Anthropic keys. input_tokens is unchanged (Anthropic's count, excluding cache). (PR7-02)
There was a problem hiding this comment.
Code Review
This pull request introduces several architectural improvements and packaging updates across the Genkit Python packages. Key changes include the addition of public plugin_api modules in genkit-anthropic and genkit-openai to allow ModelGarden to call these models without importing private modules, and re-exporting VertexAI from genkit-google-genai within genkit-vertexai. Additionally, google-cloud-firestore has been made an optional dependency in genkit-google-cloud to support telemetry-only installations, and test dependencies have been migrated to PEP 735 dependency groups. Feedback on these changes suggests explicitly annotating common_field_bounds in AnthropicConfig as a ClassVar to ensure proper type safety and prevent Pydantic from misinterpreting it as a model field.
| CREATE_KWARGS: ClassVar[frozenset[str]] = frozenset({'temperature', 'top_k', 'top_p', 'stop_sequences'}) | ||
|
|
||
| # Anthropic's documented ranges; out-of-range values fail before the request. | ||
| common_field_bounds = {'temperature': (0.0, 1.0), 'top_p': (0.0, 1.0)} |
There was a problem hiding this comment.
To ensure proper type safety and prevent static analysis tools or Pydantic from misinterpreting common_field_bounds as a model field, it should be explicitly annotated as a ClassVar.
| common_field_bounds = {'temperature': (0.0, 1.0), 'top_p': (0.0, 1.0)} | |
| common_field_bounds: ClassVar[dict[str, tuple[float, float]]] = {'temperature': (0.0, 1.0), 'top_p': (0.0, 1.0)} |
|
Closing: migrated to standalone repository genkit-ai/genkit-python (PR #54): genkit-ai/genkit-python#54 |
Packaging and dependency manifest cleanups across satellite packages.
Main Changes
genkit-google-cloud[firestore]to avoid mandatory heavy dependencies.