Files
dify-plugin-sdks/python/dify_plugin/protocol/dynamic_select.py
T
Yeuoly 24c77fafae feat: implement dynamic parameter fetching functionality
- Added DynamicParameterFetchParameterOptionsRequest class for dynamic parameter requests.
- Introduced DynamicParameterActions enum for action types related to dynamic parameters.
- Enhanced PluginExecutor with methods to handle dynamic parameter fetching.
- Updated Tool interface to include a method for fetching parameter options.
- Documented the DynamicSelectProtocol for clarity on its usage.
2025-06-23 20:56:04 +08:00

22 lines
720 B
Python

from typing import Protocol
from dify_plugin.entities import ParameterOption
class DynamicSelectProtocol(Protocol):
def fetch_parameter_options(self, parameter: str) -> list[ParameterOption]:
"""
Fetch the parameter options.
Classes that implement this protocol should have at least one parameter with type `dynamic-select`.
At some scenarios, we don't know the available options,
it could not be defined in the plugin directly.
But we can fetch the options from the external service such as Slack,
by providing the access token of the user, we could fetch the channel list of the user.
That's what this protocol is for.
"""
...