kaxil commented on code in PR #76864:
URL: https://github.com/apache/airflow/pull/76864#discussion_r4537982342
##########
providers/common/ai/src/airflow/providers/common/ai/durable/capability.py:
##########
@@ -99,8 +101,33 @@
# types have changed since, so replaying it would fail on every retry.
_UNLOADABLE = "the recorded result no longer loads, so it was written by
another version"
-_NO_CONFIG: RoleBasedOperationConfig[None] = RoleBasedOperationConfig(
- model=None, event=None, capability=None, tool=None
+# How an operation's step is run: looked up in the journal and recorded, or
always run live.
+_StepMode: TypeAlias = Literal["journal", "live"]
+
+
+def _journals_tool(tool_def: ToolDefinition) -> bool:
+ """Whether calls of a tool are journaled; ``metadata={"airflow": False}``
runs them live on every attempt."""
+ setting = (tool_def.metadata or {}).get(TOOL_CONFIG_KEY)
+ if setting is None:
+ return True
+ if isinstance(setting, bool):
+ return setting
+ raise UserError(
+ f"Tool {tool_def.name!r} has invalid {TOOL_CONFIG_KEY!r} metadata:
expected True or False, "
+ f"got {type(setting).__name__}."
+ )
+
+
+def _tool_step_mode(operation_id: DurableOperationId, tool: object | None,
tool_name: str) -> _StepMode:
Review Comment:
Done in 8d16f14d129.
##########
providers/common/ai/docs/decision_models.rst:
##########
@@ -55,8 +54,8 @@ model, so a model id is the whole integration.
it. `pydantic-ai's System One page
<https://pydantic.dev/docs/ai/models/system-one/>`__
lists more.
-Both prefixes need a newer ``pydantic-ai-slim`` than the floor the provider's
other extras
-set, so check the release you have installed.
+``system-one:`` needs a newer ``pydantic-ai-slim`` than the provider's
minimum, so check the
Review Comment:
Yes, it now says 2.53.0, the first pydantic-ai-slim release with the
`system-one:` model (8d16f14d129).
##########
providers/common/ai/src/airflow/providers/common/ai/durable/capability.py:
##########
@@ -99,8 +101,33 @@
# types have changed since, so replaying it would fail on every retry.
_UNLOADABLE = "the recorded result no longer loads, so it was written by
another version"
-_NO_CONFIG: RoleBasedOperationConfig[None] = RoleBasedOperationConfig(
- model=None, event=None, capability=None, tool=None
+# How an operation's step is run: looked up in the journal and recorded, or
always run live.
+_StepMode: TypeAlias = Literal["journal", "live"]
+
+
+def _journals_tool(tool_def: ToolDefinition) -> bool:
Review Comment:
Renamed to `_is_tool_journaled` in 8d16f14d129. Kept the underscore since
nothing outside the module uses it.
##########
providers/common/ai/tests/unit/common/ai/durable/test_capability.py:
##########
@@ -460,6 +460,15 @@ def query(sql: str) -> Any:
return toolset
+def _dynamic_toolset(calls: Calls, result: Any) -> DynamicToolset[None]:
Review Comment:
Done in 8d16f14d129.
##########
providers/common/ai/tests/unit/common/ai/durable/test_capability.py:
##########
@@ -870,6 +879,175 @@ def build() -> Agent[None, str]:
assert calls["model"] == 3
+def _ops_toolset(calls: Calls, *, clock_metadata: dict[str, Any] | None =
None, clock_changes: bool = False):
Review Comment:
Done in 8d16f14d129, and it now returns `FunctionToolset[None]`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]