Repository navigation
feat(py)!: drop unused and string-helper exports before 1.0 - #6669
Conversation
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
27cb569 to
db28f7d
Compare
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.
bfd61ec to
3a59fe7
Compare
…_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.
3a59fe7 to
2c084c4
Compare
|
both are fixed by #6671 in the stack: |
… 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.
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 Flowfrom genkit import EvalFnResponse(usegenkit.evaluator)from genkit import BaseDataPoint(usegenkit.evaluator)from genkit.plugin_api import get_callable_jsonfrom genkit_openai import openai_modelfrom genkit_evaluators import genkit_eval_namepackage_namefromgenkit_flask,genkit_django,genkit_ollama, andgenkit_google_cloudOpenAI.gpt_model('dall-e-3')(a non-chat model) still raisesINVALID_ARGUMENT; the message now tells you to pass the string'openai/dall-e-3'instead.evaluator_action_metadatastays ingenkit.evaluatorand now emits the sameevaluatorblockdefine_evaluatorregisters (display name, definition,isBilled, label, customOptions).
VertexAI.list_actionsuses it, so a listedVertex evaluator shows the same name and definition in the Dev UI as the
resolved one.
Decisions
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.genkit.evaluator: Everything you need to call or write an evaluator (BaseDataPoint,EvalFnResponse,Score, ...) imports from one module.BaseEvalDataPointstays internal; the runner fillstest_case_idbefore calling your fn, soBaseDataPointis the right input type.evaluator_action_metadatakept: Plugins that list actions lazily need it, same asmodel_action_metadataandembedder_action_metadata. It shares one builder withdefine_evaluatorso the two shapes can't drift.plugin_apilater is additive.Flow: Nothing annotates it.@ai.flow()returns an inferredAction[...]. AddingFlowback as an alias is additive if app code needs the name.openai_model()and evaluator import snippets get updated in the pre-1.0 docsite pass that ships with this release.