Skip to content

fix(py): prefix listed plugin action keys, hydrate unannotated model requests, and add OutputConfig.schema - #87

Merged
huangjeff5 merged 5 commits into
mainfrom
fix/py-1.0-pr6c-plugin-abi-output-schema
Nov 12, 2026
Merged

huangjeff5 merged 5 commits into
mainfrom
fix/py-1.0-pr6c-plugin-abi-output-schema

Conversation

@huangjeff5

@huangjeff5 huangjeff5 commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Four plugin-author bugs that made models and tools show up but not run.

  • A plugin that lists bare model IDs (vLLM / Hugging Face style, meta-llama/Llama-3.3-70B) showed rows in the Dev UI that returned 404 Action not found when run.
  • A custom model with an unannotated request (async def my_model(req, ctx: ModelContext)) got a raw dict when run from the Dev UI or CLI.
  • request.output.schema returned Pydantic's deprecated BaseModel.schema method instead of the output schema.
  • genkit-openai sent scalar tool inputs as a non-object schema, which OpenAI rejects.
# A plugin that lists bare slash-separated model IDs
ai = Genkit(plugins=[Vllm()])

# --- BEFORE ---
# Dev UI catalog key => /model/meta-llama/Llama-3.3-70B
# Run from Dev UI    => 404 Action not found ("meta-llama" is read as the plugin name)
# Inside a custom model:
req.output.schema
# => <bound method BaseModel.schema of <class 'OutputConfig'>>

# --- AFTER ---
# Dev UI catalog key => /model/vllm/meta-llama/Llama-3.3-70B, resolves through Vllm.resolve
req.output.schema
# => {'type': 'object', 'properties': {...}}   (None for plain-text requests)

Changes

  • Listed plugin actions get the plugin prefix: init() and resolve_action key plugin actions as <plugin>/<id>, but list_actions() advertised a bare ID as-is, so the Dev UI key pointed nowhere. list_actions() now applies the same rule and adds <plugin>/ unless the name already starts with it.
  • Unannotated model handlers get a ModelRequest: a Dev UI or CLI run sends JSON, and with no type hint on the request parameter nothing converted it. Model now converts the input to ModelRequest for unannotated handlers, as Embedder already does. With a Pydantic config_schema, it's ModelRequest[Config], so request.config is the config model.
  • DynamicActionProvider returned from init() is listed: the provider is now attached to its own action at construction. A dap.action returned from Plugin.init() shows up as a provider in the catalog, not only one registered through define_dynamic_action_provider.
  • OutputConfig.schema returns the schema: it is now a read-only property returning json_schema (dict[str, Any] | None). It shadows Pydantic's deprecated schema() classmethod and matches the wire key schema.
  • genkit-openai wraps scalar tool inputs: OpenAI function calling requires "type": "object" at the schema root, so a tool like async def current_weather(city: str) failed. Non-object input schemas are now sent as {"type": "object", "properties": {"input": ...}, "required": ["input"]}. A root $ref (Pydantic's shape for an Enum input) is judged by its target, and $defs stay at the wrapper root so refs still resolve. The plugin unwraps input before calling the tool, sends streamed tool-call chunks with the bare value, and wraps earlier calls when replaying history, as genkit-google-genai already does.

Breaking changes

None. The old catalog keys for bare IDs couldn't be run, and an OpenAI request with a scalar tool schema was rejected. OutputConfig.schema() as a Pydantic classmethod was deprecated; use OutputConfig.model_json_schema().

Cross-SDK

Reflection /api/actions keys for Python plugins that list bare IDs change from /<kind>/<id> to /<kind>/<plugin>/<id>. This is the key init() and resolve_action already use, and the same format JS and Go use:

// before
{"/model/meta-llama/Llama-3.3-70B": {"key": "/model/meta-llama/Llama-3.3-70B", "name": "meta-llama/Llama-3.3-70B"}}
// after
{"/model/vllm/meta-llama/Llama-3.3-70B": {"key": "/model/vllm/meta-llama/Llama-3.3-70B", "name": "vllm/meta-llama/Llama-3.3-70B"}}

JS, Go, Dart, and the Dev UI need no changes.

@huangjeff5
huangjeff5 added this pull request to stack #88 November 11, 2026 02:37
@huangjeff5
huangjeff5 removed this pull request from stack #88 November 11, 2026 06:22
@huangjeff5
huangjeff5 force-pushed the fix/py-1.0-pr6b-middleware-instances-resilience branch from 47719f5 to be59650 Compare November 11, 2026 06:22
@huangjeff5
huangjeff5 force-pushed the fix/py-1.0-pr6c-plugin-abi-output-schema branch from ae5ca93 to 53054a5 Compare November 11, 2026 06:22
@huangjeff5
huangjeff5 added this pull request to stack #89 November 11, 2026 06:23
@huangjeff5
huangjeff5 force-pushed the fix/py-1.0-pr6b-middleware-instances-resilience branch from be59650 to 3a3b6df Compare November 11, 2026 16:21
@huangjeff5
huangjeff5 force-pushed the fix/py-1.0-pr6c-plugin-abi-output-schema branch from 53054a5 to 263f69e Compare November 11, 2026 16:21
@huangjeff5
huangjeff5 force-pushed the fix/py-1.0-pr6b-middleware-instances-resilience branch from 3a3b6df to 9bd4843 Compare November 11, 2026 17:31
@huangjeff5
huangjeff5 force-pushed the fix/py-1.0-pr6c-plugin-abi-output-schema branch from 263f69e to f4a7b55 Compare November 11, 2026 17:31
@huangjeff5
huangjeff5 removed this pull request from stack #89 November 11, 2026 18:06
Registry.list_actions() advertised /model/org/name for a plugin returning
an unprefixed slash id, which 404s on /api/runAction. Apply the same
prefix rule as init().
…chemas

- Model wraps an unannotated request parameter as ModelRequest, like
  Embedder, so Dev UI / CLI runs pass a ModelRequest, not a dict.
- DynamicActionProvider stamps itself on its action, so one returned
  from Plugin.init() is recoverable from the registry.
- genkit-openai wraps non-object tool input schemas under 'input' and
  unwraps tool requests, matching genkit-google-genai.
@huangjeff5
huangjeff5 changed the base branch from fix/py-1.0-pr6b-middleware-instances-resilience to main November 11, 2026 18:37
@huangjeff5
huangjeff5 force-pushed the fix/py-1.0-pr6c-plugin-abi-output-schema branch from f4a7b55 to f07e4b6 Compare November 11, 2026 18:38
…put, type unannotated model config

- genkit-openai: a root $ref is judged by its target, so an Enum input is
  wrapped; $defs stay at the wrapper root so refs still resolve
  (list[Enum], Optional[Enum]).
- genkit-openai: stream chunks for a wrapped tool carry the bare value,
  matching response.message, instead of '{"input": ...}' fragments.
- Model: an unannotated handler with a Pydantic config_schema gets
  ModelRequest[Config], so request.config is the config model.
- Drop the now-dead setattr in define_dynamic_action_provider.
@huangjeff5
huangjeff5 merged commit 5503319 into main Nov 12, 2026
21 checks passed
@huangjeff5
huangjeff5 deleted the fix/py-1.0-pr6c-plugin-abi-output-schema branch November 12, 2026 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants