Set of tools for the crewAI framework (Chinese Version)
Project description
crewAI 工具
本文档全面介绍了如何为 crewAI 代理设置复杂的工具,方便创建定制工具以增强您的 AI 解决方案。
在 CrewAI 代理领域,工具对于增强功能至关重要。本指南概述了为您的代理配备一系列现成工具的步骤,以及创建您自己的工具的方法。
主页 | aipmAI - crewAI 中文解决方案 | 与文档聊天 | 示例 | Discord
目录
创建您的工具
工具始终应返回字符串,因为它们旨在供代理用于生成响应。
创建 crewAI 代理工具的方法有三种:
继承 BaseTool
from crewai_tools import BaseTool
class MyCustomTool(BaseTool):
name: str = "我的工具名称"
description: str = "对该工具用途的清晰描述,您的代理将需要此信息才能使用它。"
def _run(self, argument: str) -> str:
# 实现代码在此处
pass
定义一个继承自 BaseTool 的新类,指定 name、description 和用于操作逻辑的 _run 方法。
使用 tool 装饰器
对于更简单的方法,请直接使用所需的属性和功能逻辑创建 Tool 对象。
from crewai_tools import tool
@tool("我的工具名称")
def my_tool(question: str) -> str:
"""对该工具用途的清晰描述,您的代理将需要此信息才能使用它。"""
# 函数逻辑在此处
tool 装饰器简化了流程,以最小的开销将函数转换为工具。
贡献指南
我们热烈欢迎您为丰富此工具集做出贡献。要做出贡献:
- **Fork 仓库:**首先将仓库 fork 到您的 GitHub 帐户。
- **功能分支:**在您的 fork 中为功能或改进创建一个新分支。
- **实现您的功能:**将您的贡献添加到新分支中。
- **拉取请求:**从您的功能分支向主仓库提交拉取请求。
我们非常感谢您的贡献,这将有助于增强此项目。
开发设置
安装依赖项:
poetry install
激活虚拟环境:
poetry shell
设置预提交钩子:
pre-commit install
运行测试:
poetry run pytest
静态类型检查:
poetry run pyright
打包:
poetry build
本地安装:
pip install dist/*.tar.gz
感谢您有兴趣通过高级工具增强 AI 代理的功能。您的贡献将产生重大影响。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aipmai_tools-0.4.26.tar.gz.
File metadata
- Download URL: aipmai_tools-0.4.26.tar.gz
- Upload date:
- Size: 45.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a542639f83625402e404a7a5709db6b59ef807a7e3fc558525bce0afb00e9d26
|
|
| MD5 |
e4ef1346c7696262fe6ee7ff568c0531
|
|
| BLAKE2b-256 |
e4bfc565a2b41f392b8e136b4144281136e37c5ef077b4e150fcc24b7345b611
|
File details
Details for the file aipmai_tools-0.4.26-py3-none-any.whl.
File metadata
- Download URL: aipmai_tools-0.4.26-py3-none-any.whl
- Upload date:
- Size: 91.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
732a51275662a01d341152877d128628fe0e9149c2c67f71d8aa6936ca8425bf
|
|
| MD5 |
6f09f814c1eb252062422bcc480f90c8
|
|
| BLAKE2b-256 |
be54ff835e1bc51ef84b3d1054fbe2e0bde99e3949225f582b5b9801a7555144
|