Skip to content

feat(py)!: drop unused and string-helper exports before 1.0 - #6669

Merged
huangjeff5 merged 2 commits into
mainfrom
chore/py-export-cut
Oct 9, 2026
Merged

huangjeff5 merged 2 commits into
mainfrom
chore/py-export-cut

Conversation

@huangjeff5

@huangjeff5 huangjeff5 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

A handful of exports that duplicated other APIs or were never meant for apps
are gone or moved. These imports now raise ImportError:

  • from genkit import Flow
  • from genkit import EvalFnResponse (use genkit.evaluator)
  • from genkit import BaseDataPoint (use genkit.evaluator)
  • from genkit.plugin_api import get_callable_json
  • from genkit_openai import openai_model
  • from genkit_evaluators import genkit_eval_name
  • package_name from genkit_flask, genkit_django, genkit_ollama, and genkit_google_cloud
# before
from genkit import BaseDataPoint, EvalFnResponse
from genkit_openai import openai_model

response = await ai.generate(model=openai_model('gpt-4o'), prompt='hi')

# after
from genkit.evaluator import BaseDataPoint, EvalFnResponse
from genkit_openai import OpenAI

response = await ai.generate(model=OpenAI.gpt_model('gpt-4o'), prompt='hi')
# typed ref, config checked against OpenAIConfig

# or just the string:
response = await ai.generate(model='openai/gpt-4o', prompt='hi')

OpenAI.gpt_model('dall-e-3') (a non-chat model) still raises
INVALID_ARGUMENT; the message now tells you to pass the string
'openai/dall-e-3' instead.

evaluator_action_metadata stays in genkit.evaluator and now emits the same
evaluator block define_evaluator registers (display name, definition,
isBilled, label, customOptions). VertexAI.list_actions uses it, so a listed
Vertex evaluator shows the same name and definition in the Dev UI as the
resolved one.

Decisions

  • Model refs: Model references come from the typed classmethods on each plugin class (OpenAI.gpt_model, Anthropic.claude_model, GoogleAI.gemini_model, ...) or a plain 'provider/model' string. The string-building helpers did the same thing with less type safety, so they're gone.
  • Evaluator types live in genkit.evaluator: Everything you need to call or write an evaluator (BaseDataPoint, EvalFnResponse, Score, ...) imports from one module. BaseEvalDataPoint stays internal; the runner fills test_case_id before calling your fn, so BaseDataPoint is the right input type.
  • evaluator_action_metadata kept: Plugins that list actions lazily need it, same as model_action_metadata and embedder_action_metadata. It shares one builder with define_evaluator so the two shapes can't drift.
  • Error redaction stays internal: Turning an error into an HTTP response body is a detail of the served-flow handlers. Exporting it from plugin_api later is additive.
  • No Flow: Nothing annotates it. @ai.flow() returns an inferred Action[...]. Adding Flow back as an alias is additive if app code needs the name.
  • Docsite: The openai_model() and evaluator import snippets get updated in the pre-1.0 docsite pass that ships with this release.

@github-actions github-actions Bot added docs Improvements or additions to documentation python Python config chore labels Oct 8, 2026
@huangjeff5
huangjeff5 added this pull request to stack #6670 October 8, 2026 06:11

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request cleans up the public API across several packages by removing deprecated or internal helper functions, including package_name, openai_model, evaluator_action_metadata, get_callable_json, and the Flow alias, while updating the corresponding documentation and tests. The feedback suggests refining the error message in _openai_plugin.py to clarify that embedders should be used with ai.embed instead of being passed as a string to gpt_model.

@apascal07 apascal07 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two leftovers outside the diff: genkit_eval_name is still importable from genkit_evaluators.plugin (that module has no __all__), and genkit._ai._formats.package_name() has no callers.

@huangjeff5
huangjeff5 removed this pull request from stack #6670 October 9, 2026 01:23
@huangjeff5
huangjeff5 changed the base branch from chore/py-unexport-name-helpers to main October 9, 2026 01:23
@huangjeff5
huangjeff5 force-pushed the chore/py-export-cut branch from 27cb569 to db28f7d Compare October 9, 2026 01:23
@huangjeff5
huangjeff5 added this pull request to stack #6705 October 9, 2026 01:23
Removes Flow and EvalFnResponse from the root genkit package,
get_callable_json from genkit.plugin_api, evaluator_action_metadata from
genkit.evaluator, openai_model from genkit_openai, genkit_eval_name from
genkit_evaluators, and package_name from genkit_flask, genkit_django,
genkit_ollama, and genkit_google_cloud.
@huangjeff5
huangjeff5 force-pushed the chore/py-export-cut branch from bfd61ec to 3a59fe7 Compare October 9, 2026 02:54
…_action_metadata

- BaseDataPoint moves from the root genkit package to genkit.evaluator.
  Everything needed to call or write an evaluator lives there.
- evaluator_action_metadata is back in genkit.evaluator. It emits the same
  evaluator block define_evaluator registers (display name, definition,
  isBilled, label, customOptions), so a listed evaluator matches the
  resolved one. VertexAI.list_actions uses it.
@huangjeff5
huangjeff5 force-pushed the chore/py-export-cut branch from 3a59fe7 to 2c084c4 Compare October 9, 2026 02:56
@huangjeff5

Copy link
Copy Markdown
Contributor Author

both are fixed by #6671 in the stack: genkit_evaluators.plugin becomes private _plugin, and _formats/__init__.py (with package_name()) is deleted.

@huangjeff5
huangjeff5 merged commit a5153e8 into main Oct 9, 2026
26 checks passed
@huangjeff5
huangjeff5 deleted the chore/py-export-cut branch October 9, 2026 03:46
huangjeff5 added a commit that referenced this pull request Oct 11, 2026
… METRIC_CONFIGS directly

define_batch_evaluator uses _evaluator_metadata again instead of the
pre-#6669 block that wrote into the caller's nested evaluator dict, and
the builder keeps main's private name and config_schema type. Vertex
builds one evaluator per metric with no None path, and the duplicate
listing test folds its enum check into the existing one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore config docs Improvements or additions to documentation python Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants