对我自己来说,人工智能现在已经无处不在,而当今世界每个人都想做人工智能。
但有时,很难知道要掌握哪些工具才能成功地在你的应用中实现人工智能功能。缘由于此,我将在本文中整理了一个有用的存储库列表,相信各位可以在其中学习到并掌握 到 AI 的神奇魔法。
1. Composio :构建 AI 自动化速度提高 10 倍
工具和集成组成了构建 AI 代理的核心。我最近一直在构建 AI 工具和代理,但工具准确性一直是个问题,直到我遇到 Composio。
Composio 使 GitHub、Slack、Jira、Airtable 等流行应用程序与 AI 代理的集成变得更加容易,从而能够构建复杂的自动化。
它将代表你处理集成的用户身份验证和授权。因此可以安心地构建 AI 应用程序。特别要指出的,Composio 已通过 SOC2 认证。
我们可以按照以下方法开始使用它:
pip install composio-core
添加 GitHub 集成:
composio add github
Composio 代表您处理用户身份验证和授权。以下是如何使用 GitHub 集成来为存储库加注星标的方法。
from openai import OpenAI
from composio_openai import ComposioToolSet, App
openai_client = OpenAI(api_key="******OPENAIKEY******")
# Initialise the Composio Tool Set
composio_toolset = ComposioToolSet(api_key="**\*\***COMPOSIO_API_KEY**\*\***")
## Step 4
# Get GitHub tools that are pre-configured
actions = composio_toolset.get_actions(actions=[Action.GITHUB_ACTIVITY_STAR_REPO_FOR_AUTHENTICATED_USER])
## Step 5
my_task = "Star a repo ComposioHQ/composio on GitHub"
# Create a chat completion request to decide on the action
response = openai_client.chat.completions.create(
model="gpt-4-turbo",
tools=actions, # Passing actions we fetched earlier.
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": my_task}
]
)
运行此 Python 脚本以使用Agent执行给定的指令。Composio 与 LangChain、LlamaIndex、CrewAi 等著名框架可以非常好地协同合作。
2. Unsloth:更快地训练和微调人工智能模型
训练和微调大语言模型 (LLM) ,是人工智能工程的关键部分。
在许多情况下,专有模型可能无法满足需求。这可能是成本、个性化或隐私问题。在某些时候,您需要在自定义数据集上微调模型。目前,Unsloth 是用于微调和训练 LLM 的最佳库之一。
它支持流行 LLM(包括 Llama-3 和 Mistral)及其衍生产品(如 Yi、Open-hermes 等)的完整、LoRA 和 QLoRA 微调。它实现了自定义 triton 内核和手动反向传播引擎以提高模型训练的速度。
要开始使用 Unsloth,请使用 pip 安装,并确保您拥有torch 2.4 和 CUDA 12.1。
pip install --upgrade pip
pip install "unsloth[cu121-torch240] @ git+https://github.com/unslothai/unsloth.git"
这是一个使用 SFT(监督微调)在数据集上训练 Mistral 模型的简单脚本:
from unsloth import FastLanguageModel
<span style="-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline-style: in
Keyword: Hailuo