|
25 | 25 | )
|
26 | 26 |
|
27 | 27 | import semver
|
28 |
| -from pydantic import BaseModel, ConfigDict, Field, TypeAdapter, create_model |
| 28 | +from pydantic import BaseModel, ConfigDict, Field, JsonValue, TypeAdapter, create_model |
29 | 29 | from pydantic.fields import FieldInfo
|
30 | 30 | from pydantic_core import PydanticUndefined
|
31 | 31 |
|
@@ -100,6 +100,12 @@ class BaseInvocationOutput(BaseModel):
|
100 | 100 | All invocation outputs must use the `@invocation_output` decorator to provide their unique type.
|
101 | 101 | """
|
102 | 102 |
|
| 103 | + output_meta: Optional[dict[str, JsonValue]] = Field( |
| 104 | + default=None, |
| 105 | + description="Optional dictionary of metadata for the invocation output, unrelated to the invocation's actual output value. This is not exposed as an output field.", |
| 106 | + json_schema_extra={"field_kind": FieldKind.NodeAttribute}, |
| 107 | + ) |
| 108 | + |
103 | 109 | @staticmethod
|
104 | 110 | def json_schema_extra(schema: dict[str, Any], model_class: Type[BaseInvocationOutput]) -> None:
|
105 | 111 | """Adds various UI-facing attributes to the invocation output's OpenAPI schema."""
|
@@ -235,12 +241,6 @@ def invoke_internal(self, context: InvocationContext, services: "InvocationServi
|
235 | 241 | json_schema_extra={"field_kind": FieldKind.NodeAttribute},
|
236 | 242 | )
|
237 | 243 |
|
238 |
| - output_metadata: Optional[dict[str, Any]] = Field( |
239 |
| - default=None, |
240 |
| - description="Optional metadata dictionary for the invocation", |
241 |
| - json_schema_extra={"field_kind": FieldKind.NodeAttribute}, |
242 |
| - ) |
243 |
| - |
244 | 244 | UIConfig: ClassVar[UIConfigBase]
|
245 | 245 |
|
246 | 246 | model_config = ConfigDict(
|
@@ -360,12 +360,11 @@ def get_output_types(cls) -> Iterable[str]:
|
360 | 360 | "use_cache",
|
361 | 361 | "type",
|
362 | 362 | "workflow",
|
363 |
| - "output_metadata", |
364 | 363 | }
|
365 | 364 |
|
366 | 365 | RESERVED_INPUT_FIELD_NAMES = {"metadata", "board"}
|
367 | 366 |
|
368 |
| -RESERVED_OUTPUT_FIELD_NAMES = {"type"} |
| 367 | +RESERVED_OUTPUT_FIELD_NAMES = {"type", "output_meta"} |
369 | 368 |
|
370 | 369 |
|
371 | 370 | class _Model(BaseModel):
|
|
0 commit comments