Repository navigation
refactor(py/amazon-bedrock, py/ollama)!: trim plugin surfaces - #6706
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request removes the reranking feature from the Amazon Bedrock plugin and simplifies model registration across both the Bedrock and Ollama plugins by replacing custom classes and enums (like ModelDefinition and OllamaAPITypes) with plain string lists and literal types. It also removes local CHANGELOG.md files in favor of GitHub releases. The review feedback points out that removing the cache_type parameter from cache_point_part is a breaking change for existing callers and suggests keeping it as a deprecated optional parameter to maintain backward compatibility.
huangjeff5
force-pushed
the
chore/py-plugin-trim
branch
2 times, most recently
from
October 9, 2026 02:56
87e14c8 to
cfbc0f8
Compare
huangjeff5
force-pushed
the
chore/py-plugin-trim
branch
from
October 9, 2026 03:47
cfbc0f8 to
8c47951
Compare
huangjeff5
force-pushed
the
chore/py-plugin-trim
branch
from
October 9, 2026 04:14
8c47951 to
11c0a1a
Compare
huangjeff5
force-pushed
the
chore/py-plugin-trim
branch
from
October 9, 2026 04:49
11c0a1a to
c8bce2f
Compare
huangjeff5
force-pushed
the
chore/py-plugin-trim
branch
from
October 9, 2026 05:40
c8bce2f to
3c7e9d5
Compare
huangjeff5
force-pushed
the
chore/py-plugin-trim
branch
from
October 9, 2026 05:57
3c7e9d5 to
fd2b368
Compare
huangjeff5
force-pushed
the
chore/py-plugin-trim
branch
from
October 9, 2026 06:32
fd2b368 to
e5840f9
Compare
huangjeff5
force-pushed
the
chore/py-plugin-trim
branch
from
October 9, 2026 06:49
e5840f9 to
9c44d7d
Compare
Every module except each package's top-level __init__.py (and the exp namespaces) is now underscore-prefixed in genkit-amazon-bedrock, genkit-ollama, genkit-flask, genkit-django, genkit-fastapi, genkit-evaluators, genkit-google-cloud, and genkit-vertexai. Import from the package root.
Private subpackages (_model_garden, _models, _evaluators, _telemetry, _context_caching) re-exported their internals through __init__.py, a second import path nobody outside the package should use. Drop the files, matching core's _ai and _core, and import from the defining module.
built_in_formats moves to _formats/_builtin.py; imports point at defining modules.
- Bedrock: drop RerankerRequest, RerankerResponse, RankedDocumentData, RankedDocumentMetadata, and BedrockImageConfig from the root. Genkit has no reranker primitive, so public copies would collide with future core types; the image config schema is empty and callers pass a dict. - Ollama: drop RequestHeaderFunction and RequestHeaders (they only name what request_headers= accepts). ModelDefinition.api_type is Literal['chat', 'generate'], matching JS ApiType, replacing the OllamaAPITypes enum that this PR would otherwise have hidden.
apascal07
approved these changes
Oct 9, 2026
…_plugin.py Co-authored-by: Alex Pascal <apascal07@gmail.com>
# Conflicts: # py/packages/genkit-amazon-bedrock/src/genkit_amazon_bedrock/__init__.py # py/packages/genkit-amazon-bedrock/tests/plugin_test.py # py/packages/genkit-ollama/tests/plugin_api_test.py
…route-to-schema helper - models= and embedders= raise TypeError on a str instead of listing one model per character. - _config_schema(model_type) picks the config schema for resolve and list_actions; the route is computed once per ID. - bedrock_name becomes a private _action_name. - Pin that a rerank ID fails as GenkitError NOT_FOUND before any AWS call.
huangjeff5
added a commit
that referenced
this pull request
Oct 10, 2026
A missing bracket (models='llama3.2') iterated the string and listed one model per character. Same guard as Bedrock in #6706.
cabljac
added a commit
that referenced
this pull request
Oct 12, 2026
…lic surface The Python plugins on main export only what a caller needs, take flat keyword arguments instead of nested option objects (#6706), and report failures as GenkitError with a status rather than plugin error classes (#6710). The MCP client follows the same rules. define_mcp_client takes command, args, env and cwd as keyword arguments. McpStdioServerConfig stays as the internal model those arguments build. The provider name is also the tool name prefix, as in the Go plugin, so tool_prefix goes away. disabled goes away too: not calling define_mcp_client does the same. The error classes become private GenkitError subclasses: a closed client is FAILED_PRECONDITION, a server that cannot start or dies is UNAVAILABLE, and a protocol violation is INTERNAL.
cabljac
added a commit
that referenced
this pull request
Oct 12, 2026
…lic surface The Python plugins on main export only what a caller needs and take flat keyword arguments instead of nested option objects (#6671, #6706). The client now does the same. define_mcp_client and McpClient take command, args, env and cwd as keyword arguments and build the stdio config internally. The provider name is also the tool name prefix, as in the Go plugin, so tool_prefix and the tool_prefix property go away, and the name has to satisfy the tool name rule as well as the selector rule. disabled goes away: not calling define_mcp_client does the same. create_mcp_client goes away. An unregistered client has no use on its own while generate(tools=) takes names rather than actions, and McpClient is still there for the host to build clients without registering each. dynamic_action_provider becomes private: no caller outside the package needs it. The package exports McpClient and define_mcp_client. Errors are GenkitError with a status, as for the other plugins after #6710, so the error classes are no longer exported. A test pins the exported names, replacing the smoke test main deleted.
cabljac
added a commit
that referenced
this pull request
Oct 12, 2026
…ping The host follows the same surface rules as the client: no exported nested config, flat keyword arguments, and only names a caller needs (#6671, #6706). define_mcp_host and McpHost take mcp_servers=, a mapping in the shape of the mcpServers block Claude Desktop and Cursor read, so a block loaded from one of those files passes straight through. Each entry is validated into the internal stdio config, so a misspelt key still fails without echoing values. connect takes command, args, env and cwd as keyword arguments, as define_mcp_client does. The mapping key is the server name and its tool name prefix, as in the Go plugin. Keys are unique, so the shared-prefix check and tool_prefix go away. McpHostServer and create_mcp_host go away, server_names goes (tests read the host's clients), and dynamic_action_provider becomes private. The package now exports McpClient, McpHost, define_mcp_client and define_mcp_host, which the exports test pins.
cabljac
added a commit
that referenced
this pull request
Oct 13, 2026
…ping The host follows the same surface rules as the client: no exported nested config, flat keyword arguments, and only names a caller needs (#6671, #6706). define_mcp_host and McpHost take mcp_servers=, a mapping in the shape of the mcpServers block Claude Desktop and Cursor read, so a block loaded from one of those files passes straight through. Each entry is validated into the internal stdio config, so a misspelt key still fails without echoing values. connect takes command, args, env and cwd as keyword arguments, as define_mcp_client does. The mapping key is the server name and its tool name prefix, as in the Go plugin. Keys are unique, so the shared-prefix check and tool_prefix go away. McpHostServer and create_mcp_host go away, server_names goes (tests read the host's clients), and dynamic_action_provider becomes private. The package now exports McpClient, McpHost, define_mcp_client and define_mcp_host, which the exports test pins.
hilariie
pushed a commit
that referenced
this pull request
Oct 16, 2026
…lic surface The Python plugins on main export only what a caller needs, take flat keyword arguments instead of nested option objects (#6706), and report failures as GenkitError with a status rather than plugin error classes (#6710). The MCP client follows the same rules. define_mcp_client takes command, args, env and cwd as keyword arguments. McpStdioServerConfig stays as the internal model those arguments build. The provider name is also the tool name prefix, as in the Go plugin, so tool_prefix goes away. disabled goes away too: not calling define_mcp_client does the same. The error classes become private GenkitError subclasses: a closed client is FAILED_PRECONDITION, a server that cannot start or dies is UNAVAILABLE, and a protocol violation is INTERNAL.
hilariie
pushed a commit
that referenced
this pull request
Oct 16, 2026
…lic surface The Python plugins on main export only what a caller needs and take flat keyword arguments instead of nested option objects (#6671, #6706). The client now does the same. define_mcp_client and McpClient take command, args, env and cwd as keyword arguments and build the stdio config internally. The provider name is also the tool name prefix, as in the Go plugin, so tool_prefix and the tool_prefix property go away, and the name has to satisfy the tool name rule as well as the selector rule. disabled goes away: not calling define_mcp_client does the same. create_mcp_client goes away. An unregistered client has no use on its own while generate(tools=) takes names rather than actions, and McpClient is still there for the host to build clients without registering each. dynamic_action_provider becomes private: no caller outside the package needs it. The package exports McpClient and define_mcp_client. Errors are GenkitError with a status, as for the other plugins after #6710, so the error classes are no longer exported. A test pins the exported names, replacing the smoke test main deleted.
cabljac
added a commit
that referenced
this pull request
Oct 19, 2026
…ping The host follows the same surface rules as the client: no exported nested config, flat keyword arguments, and only names a caller needs (#6671, #6706). define_mcp_host and McpHost take mcp_servers=, a mapping in the shape of the mcpServers block Claude Desktop and Cursor read, so a block loaded from one of those files passes straight through. Each entry is validated into the internal stdio config, so a misspelt key still fails without echoing values. connect takes command, args, env and cwd as keyword arguments, as define_mcp_client does. The mapping key is the server name and its tool name prefix, as in the Go plugin. Keys are unique, so the shared-prefix check and tool_prefix go away. McpHostServer and create_mcp_host go away, server_names goes (tests read the host's clients), and dynamic_action_provider becomes private. The package now exports McpClient, McpHost, define_mcp_client and define_mcp_host, which the exports test pins.
cabljac
added a commit
that referenced
this pull request
Oct 19, 2026
…ping The host follows the same surface rules as the client: no exported nested config, flat keyword arguments, and only names a caller needs (#6671, #6706). define_mcp_host and McpHost take mcp_servers=, a mapping in the shape of the mcpServers block Claude Desktop and Cursor read, so a block loaded from one of those files passes straight through. Each entry is validated into the internal stdio config, so a misspelt key still fails without echoing values. connect takes command, args, env and cwd as keyword arguments, as define_mcp_client does. The mapping key is the server name and its tool name prefix, as in the Go plugin. Keys are unique, so the shared-prefix check and tool_prefix go away. McpHostServer and create_mcp_host go away, server_names goes (tests read the host's clients), and dynamic_action_provider becomes private. The package now exports McpClient, McpHost, define_mcp_client and define_mcp_host, which the exports test pins.
cabljac
added a commit
that referenced
this pull request
Oct 19, 2026
…ping The host follows the same surface rules as the client: no exported nested config, flat keyword arguments, and only names a caller needs (#6671, #6706). define_mcp_host and McpHost take mcp_servers=, a mapping in the shape of the mcpServers block Claude Desktop and Cursor read, so a block loaded from one of those files passes straight through. Each entry is validated into the internal stdio config, so a misspelt key still fails without echoing values. connect takes command, args, env and cwd as keyword arguments, as define_mcp_client does. The mapping key is the server name and its tool name prefix, as in the Go plugin. Keys are unique, so the shared-prefix check and tool_prefix go away. McpHostServer and create_mcp_host go away, server_names goes (tests read the host's clients), and dynamic_action_provider becomes private. The package now exports McpClient, McpHost, define_mcp_client and define_mcp_host, which the exports test pins.
cabljac
added a commit
that referenced
this pull request
Oct 20, 2026
…ping The host follows the same surface rules as the client: no exported nested config, flat keyword arguments, and only names a caller needs (#6671, #6706). define_mcp_host and McpHost take mcp_servers=, a mapping in the shape of the mcpServers block Claude Desktop and Cursor read, so a block loaded from one of those files passes straight through. Each entry is validated into the internal stdio config, so a misspelt key still fails without echoing values. connect takes command, args, env and cwd as keyword arguments, as define_mcp_client does. The mapping key is the server name and its tool name prefix, as in the Go plugin. Keys are unique, so the shared-prefix check and tool_prefix go away. McpHostServer and create_mcp_host go away, server_names goes (tests read the host's clients), and dynamic_action_provider becomes private. The package now exports McpClient, McpHost, define_mcp_client and define_mcp_host, which the exports test pins.
cabljac
added a commit
that referenced
this pull request
Oct 22, 2026
…ping The host follows the same surface rules as the client: no exported nested config, flat keyword arguments, and only names a caller needs (#6671, #6706). define_mcp_host and McpHost take mcp_servers=, a mapping in the shape of the mcpServers block Claude Desktop and Cursor read, so a block loaded from one of those files passes straight through. Each entry is validated into the internal stdio config, so a misspelt key still fails without echoing values. connect takes command, args, env and cwd as keyword arguments, as define_mcp_client does. The mapping key is the server name and its tool name prefix, as in the Go plugin. Keys are unique, so the shared-prefix check and tool_prefix go away. McpHostServer and create_mcp_host go away, server_names goes (tests read the host's clients), and dynamic_action_provider becomes private. The package now exports McpClient, McpHost, define_mcp_client and define_mcp_host, which the exports test pins.
cabljac
added a commit
that referenced
this pull request
Oct 22, 2026
…ping The host follows the same surface rules as the client: no exported nested config, flat keyword arguments, and only names a caller needs (#6671, #6706). define_mcp_host and McpHost take mcp_servers=, a mapping in the shape of the mcpServers block Claude Desktop and Cursor read, so a block loaded from one of those files passes straight through. Each entry is validated into the internal stdio config, so a misspelt key still fails without echoing values. connect takes command, args, env and cwd as keyword arguments, as define_mcp_client does. The mapping key is the server name and its tool name prefix, as in the Go plugin. Keys are unique, so the shared-prefix check and tool_prefix go away. McpHostServer and create_mcp_host go away, server_names goes (tests read the host's clients), and dynamic_action_provider becomes private. The package now exports McpClient, McpHost, define_mcp_client and define_mcp_host, which the exports test pins.
hilariie
pushed a commit
that referenced
this pull request
Oct 29, 2026
…lic surface The Python plugins on main export only what a caller needs, take flat keyword arguments instead of nested option objects (#6706), and report failures as GenkitError with a status rather than plugin error classes (#6710). The MCP client follows the same rules. define_mcp_client takes command, args, env and cwd as keyword arguments. McpStdioServerConfig stays as the internal model those arguments build. The provider name is also the tool name prefix, as in the Go plugin, so tool_prefix goes away. disabled goes away too: not calling define_mcp_client does the same. The error classes become private GenkitError subclasses: a closed client is FAILED_PRECONDITION, a server that cannot start or dies is UNAVAILABLE, and a protocol violation is INTERNAL.
hilariie
pushed a commit
that referenced
this pull request
Oct 29, 2026
…lic surface The Python plugins on main export only what a caller needs and take flat keyword arguments instead of nested option objects (#6671, #6706). The client now does the same. define_mcp_client and McpClient take command, args, env and cwd as keyword arguments and build the stdio config internally. The provider name is also the tool name prefix, as in the Go plugin, so tool_prefix and the tool_prefix property go away, and the name has to satisfy the tool name rule as well as the selector rule. disabled goes away: not calling define_mcp_client does the same. create_mcp_client goes away. An unregistered client has no use on its own while generate(tools=) takes names rather than actions, and McpClient is still there for the host to build clients without registering each. dynamic_action_provider becomes private: no caller outside the package needs it. The package exports McpClient and define_mcp_client. Errors are GenkitError with a status, as for the other plugins after #6710, so the error classes are no longer exported. A test pins the exported names, replacing the smoke test main deleted.
hilariie
pushed a commit
that referenced
this pull request
Oct 29, 2026
…ping The host follows the same surface rules as the client: no exported nested config, flat keyword arguments, and only names a caller needs (#6671, #6706). define_mcp_host and McpHost take mcp_servers=, a mapping in the shape of the mcpServers block Claude Desktop and Cursor read, so a block loaded from one of those files passes straight through. Each entry is validated into the internal stdio config, so a misspelt key still fails without echoing values. connect takes command, args, env and cwd as keyword arguments, as define_mcp_client does. The mapping key is the server name and its tool name prefix, as in the Go plugin. Keys are unique, so the shared-prefix check and tool_prefix go away. McpHostServer and create_mcp_host go away, server_names goes (tests read the host's clients), and dynamic_action_provider becomes private. The package now exports McpClient, McpHost, define_mcp_client and define_mcp_host, which the exports test pins.
hilariie
pushed a commit
that referenced
this pull request
Oct 30, 2026
…ping The host follows the same surface rules as the client: no exported nested config, flat keyword arguments, and only names a caller needs (#6671, #6706). define_mcp_host and McpHost take mcp_servers=, a mapping in the shape of the mcpServers block Claude Desktop and Cursor read, so a block loaded from one of those files passes straight through. Each entry is validated into the internal stdio config, so a misspelt key still fails without echoing values. connect takes command, args, env and cwd as keyword arguments, as define_mcp_client does. The mapping key is the server name and its tool name prefix, as in the Go plugin. Keys are unique, so the shared-prefix check and tool_prefix go away. McpHostServer and create_mcp_host go away, server_names goes (tests read the host's clients), and dynamic_action_provider becomes private. The package now exports McpClient, McpHost, define_mcp_client and define_mcp_host, which the exports test pins.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trims the Bedrock and Ollama public surfaces down to what callers use.
Bedrock
models=takes plain model IDs, the same shapeembedders=already had. The plugin routes each ID the wayresolvealready did for unlisted ones:cache_point_part()takes no arguments. Bedrock has one cache-point type (default), so the free-formcache_typestr was either redundant or a 400 from the service. Passing it now raisesTypeError; drop the argument:These root names now raise
ImportError:genkit_amazon_bedrock.{BedrockRerankOptions, RerankerRequest, RerankerResponse, RankedDocumentData, RankedDocumentMetadata, BedrockImageConfig, ModelDefinition}genkit_ollama.{RequestHeaderFunction, RequestHeaders}OllamaAPITypesis gone;ModelDefinition.api_typetakes'chat'or'generate', matching JSApiType.Decisions
Bedrock.rerank()is removed, along with its request/response/options types. It was a method on the plugin instance, not a Genkit action, so callers had to hold the plugin and await it outsideai.*. Genkit Python has no reranker primitive; reranking comes back when core has one. Rerank model IDs still never resolve as chat or embedder models.type='text'was identical to'chat', so nothing is lost.models=now only adds Dev UI rows; [Python] Bedrock: list the model catalog like Google GenAI so Bedrock() needs no models= genkit-python#208 tracks listing the catalog instead.BedrockImageConfigdeclares no fields and accepts anything, so it adds nothing over a dict. It stays as the image models' internal config schema.cache_point_part()dropscache_type. A keyword can come back without breaking callers if Bedrock adds a second type.RequestHeaderFunction/RequestHeadersonly name whatrequest_headers=already accepts. Pass a dict, or a callback typed withRequestHeaderParams.ChangelogURL now points at GitHub Releases like every other package, since all 15 packages version and ship together. chore(py): release from a merged PR, with checks before tagging #6702 fixes the release scripts that referencedpy/CHANGELOG.md.bedrock_name/ollama_namestay on the roots here; feat(py)!: stop exporting bedrock_name, anthropic_name, ollama_name #6662 removes them independently.