Providing too many actions can overwhelm the LLM’s decision-making process. It’s best to narrow down the action set to only the most relevant ones for your specific use case.
Specifying Actions
GITHUB_CREATE_AN_ISSUE and GITHUB_COMMIT_EVENT are action IDs for actions in the GitHub Tool
from composio_langchain import ComposioToolSet, Action
toolset = ComposioToolSet()
# can pass multiple actions
tools = toolset.get_tools(
actions=[Action.GITHUB_CREATE_AN_ISSUE]
)
Filtering Actions
Actions can be filtered by tags or use case.- Filtering Actions by Tags
- Filtering Actions by Use Case
Filter the Actions in an App based on tags.
For example, you can:
- Filter all user-related Actions using the “users” tag
- Retrieve metadata-related Actions using the “meta” tag
from composio_langchain import ComposioToolSet, App
tool_set = ComposioToolSet()
tools = tool_set.get_tools(apps=[App.GITHUB])
# Filter by tags
tag = "users"
action_enums = tool_set.find_actions_by_tags(
App.GITHUB,
tags=[tag],
)
tools = tool_set.get_tools(actions=action_enums)
Find relevant actions for your use case by describing your use case in natural language.
- Pass the use case as a string to the
use_caseparameter.
from composio_openai import ComposioToolSet, App
composio_toolset = ComposioToolSet()
use_case="Create an issue in Linear & send the issue URL on Slack to a slack channel"
action_enums=composio_toolset.find_actions_by_use_case(App.GITHUB, use_case=use_case, advanced=False)
tools = composio_toolset.get_tools(actions=action_enums)
print(tools)
Set the
advanced flag to True to get actions for complex use cases (Python)