Lee-W commented on code in PR #74447:
URL: https://github.com/apache/airflow/pull/74447#discussion_r4241108279
##########
providers/common/ai/src/airflow/providers/common/ai/toolsets/hook.py:
##########
@@ -95,10 +101,30 @@ def __init__(
hook: BaseHook,
*,
allowed_methods: list[str],
- tool_name_prefix: str = "",
+ tool_prefix: str = "",
+ tool_name_prefix: str | None = None,
pinned_arguments: dict[str, Any] | None = None,
max_retries: int | None = None,
) -> None:
+ if tool_prefix and not tool_prefix.isidentifier():
+ # The prefixed names are rendered as Python function signatures
under
+ # code mode, so a name that is not an identifier breaks there.
+ raise ValueError(f"tool_prefix must be a valid Python identifier,
got {tool_prefix!r}.")
+ if tool_name_prefix is not None:
+ if tool_prefix and f"{tool_prefix}_" != tool_name_prefix:
+ raise ValueError(
+ f"tool_prefix={tool_prefix!r} and
tool_name_prefix={tool_name_prefix!r} conflict. "
+ f"Pass only tool_prefix; tool_name_prefix is its
deprecated alias and must equal "
+ f"{tool_prefix + '_'!r} when both are given."
+ )
+ warnings.warn(
+ "Parameter `tool_name_prefix` is deprecated. Use the parameter
`tool_prefix` instead.",
Review Comment:
Done. The warning now shows the migrated value, `tool_name_prefix="s3_"` ->
`tool_prefix='s3'`, and says HookToolset adds the `_` itself.
--
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]