初学者掌握 AI 开发所需的 7 个开源工具🧙‍♂️🪄

2025-06-09

初学者掌握 AI 开发所需的 7 个开源工具🧙‍♂️🪄

人工智能正在蚕食软件,做好人工智能的准备可以让你在未来拥有更大的优势。你可以加入新兴公司,也可以构建尖端应用程序。
然而,选择构建应用程序的工具可能颇具挑战性。它应该

  • 积极发展
  • 很棒的社区
  • 大力支持

因此,我列出了一些这样的工具,它们可以使您的 AI 开发之旅顺利且有益。

家庭男人跳舞


1. Composio 👑 - 用于构建生产级 AI 代理的综合工具包

我一直在努力将 GitHub 和 Linear 与我的代理集成,以便将工单转换为拉取请求,但处理身份验证流程太繁琐,耗时太长。我想要一个简单的解决方案,而 Composio 是唯一一个脱颖而出的解决方案。它拥有超过 250 个这样的集成,并支持 LangChain、LlamaIndex 以及所有这些框架。

开始使用它非常容易。

npm install composio-core openai
Enter fullscreen mode Exit fullscreen mode

连接你的 GitHub 帐户

import { Composio } from "composio-core";

const client = new Composio({ apiKey: "<your-api-key>" });

const entity = await client.getEntity("Jessica");
const connection = await entity.initiateConnection({appName: 'github'});

console.log(`Open this URL to authenticate: ${connection.redirectUrl}`);
Initialize Composio and OpenAI

import { OpenAI } from "openai";
import { OpenAIToolSet } from "composio-core";

const openai_client = new OpenAI();
const composio_toolset = new OpenAIToolSet();
Fetch GitHub actions and pass them to the LLM

const tools = await composio_toolset.getTools({
actions: ["github_star_a_repository_for_the_authenticated_user"]
});

const instruction = "Star the repo composiohq/composio on GitHub";

const response = await openai_client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: instruction }],
tools: tools,
tool_choice: "auto",
});
Execute the tool calls.

const result = await composio_toolset.handleToolCall(response);
console.log(result);
Enter fullscreen mode Exit fullscreen mode

该文档提供了有关 Composio、其工作以及制作可用于生产的代理的重要概念的更多信息。

借助 Composio,您可以专注于构建出色的 AI 体验,同时它可以处理工具集成和安全性的复杂性。

康波西奥

为 Composio 代码库加星标 ⭐


2. E2B——在安全沙箱中执行AI生成代码的开源运行时

E2B 是您的 AI 代理值得信赖的代码执行伙伴。它在云端提供安全隔离的沙盒,AI 生成的代码可以在其中安全运行,并支持任何 LLM 和多种 AI 框架。非常适合构建需要分析数据、执行代码或执行复杂推理任务的 AI 代理。安装:

npm i @e2b/code-interpreter @anthropic-ai/sdk dotenv
Enter fullscreen mode Exit fullscreen mode

用法:

import { Sandbox } from '@e2b/sdk'

async function runCode() {
  // Create a new sandbox
  const sandbox = await Sandbox.create()

  // Execute code in the sandbox
  const result = await sandbox.run(`
    const data = require('fs').readFileSync('data.csv', 'utf8')
    console.log(data)
  `)

  // Close the sandbox when done
  await sandbox.close()
}

runCode()
Enter fullscreen mode Exit fullscreen mode

E2B 的沙盒环境最多可运行 24 小时,非常适合长时间运行的 AI 代理任务和复杂的数据分析工作流程。

E2B 图像

为 E2B 代码库加星标 ⭐


3. Vercel AI SDK——用于构建 AI 驱动的用户界面的全栈 AI SDK

Vercel AI SDK 简化了 AI 驱动的流式文本和聊天 UI 的构建。它提供了一组钩子和实用程序,让您可以轻松地将各种 AI 模型集成到您的 Next.js 应用程序中。

npm install ai
Enter fullscreen mode Exit fullscreen mode
import { useChat } from 'ai/react'

export default function Chat() {
  const { messages, input, handleInputChange, handleSubmit } = useChat()

  return (
    <div>
      <ul>
        {messages.map((m, i) => (
          <li key={i}>{m.content}</li>
        ))}
      </ul>
      <form onSubmit={handleSubmit}>
        <input
          value={input}
          onChange={handleInputChange}
          placeholder="Say something..."
        />
      </form>
    </div>
  )
}
Enter fullscreen mode Exit fullscreen mode

Vercel AI SDK 简化了 AI 集成,内置了对流媒体、速率限制和各种 AI 提供商的支持。

Vercel AI SDK

为 Vercel AI SDK 存储库加星标⭐


4. LangGraph——构建并执行有状态的LLM代理和流程

LangGraph 和 LangSmith 提供了强大的工具包,可用于创建复杂的 AI 工作流。它使您能够构建有状态的代理,这些代理能够维护上下文并执行多步骤推理任务,并具有内置的监控和调试功能。

npm install langgraph langsmith
Enter fullscreen mode Exit fullscreen mode
import { LangGraph, StateManager } from 'langgraph'
import { LangSmith } from 'langsmith'

const workflow = new LangGraph({
  nodes: {
    start: async (state) => {
      const response = await llm.chat("Process this request: " + state.input)
      return { output: response }
    },
    analyze: async (state) => {
      return { analysis: await processResponse(state.output) }
    }
  },
  edges: {
    start: ['analyze'],
    analyze: ['end']
  }
})

const result = await workflow.invoke({ input: "User query" })
Enter fullscreen mode Exit fullscreen mode

LangGraph 和 LangSmith 共同为构建和监控生产级 AI 应用程序提供了坚实的基础。

语言图

为 LangGraph 代码库加星标 ⭐


5. ChromaDB ——AI 原生开源嵌入数据库

ChromaDB 是一款专为 AI 应用构建的现代数据库,提供高效的嵌入存储和检索功能。它非常适合语义搜索、推荐系统和其他基于向量的 AI 应用。

npm install chromadb
Enter fullscreen mode Exit fullscreen mode
import { ChromaClient } from 'chromadb'

async function searchDocuments() {
  const client = new ChromaClient()

  *// Create a collection*
  const collection = await client.createCollection('documents')

  *// Add documents with embeddings*
  await collection.add({
    ids: ["id1", "id2"],
    embeddings: [[1.1, 2.3, 3.2], [4.5, 6.9, 7.2]],
    documents: ["first document", "second document"]
  })

  *// Query similar documents*
  const results = await collection.query({
    queryEmbeddings: [1.1, 2.3, 3.2],
    nResults: 2
  })
}
Enter fullscreen mode Exit fullscreen mode

ChromaDB 凭借其简单的 API 和强大的功能,让构建和扩展向量搜索应用程序变得简单。

ChromaDB

为 ChromaDB 存储库加星标⭐


6. LiteLLM ——LLM调用的通用API

LiteLLM 提供统一的接口来调用多个 LLM 提供商,让您能够在应用程序中轻松切换或组合不同的 AI 模型。它支持 OpenAI、Anthropic、Google 以及许多其他提供商。

npm install litellm
Enter fullscreen mode Exit fullscreen mode
import { LiteLLM } from 'litellm'

async function callMultipleModels() {
  const llm = new LiteLLM({
    api_key: process.env.OPENAI_API_KEY
  })

  *// Call different models with the same interface*
  const gpt4Response = await llm.complete({
    model: "gpt-4",
    messages: [{ role: "user", content: "Hello!" }]
  })

  const claudeResponse = await llm.complete({
    model: "claude-2",
    messages: [{ role: "user", content: "Hello!" }]
  })
}
Enter fullscreen mode Exit fullscreen mode

LiteLLM 简化了模型管理并为不同的 LLM 提供商提供了一致的错误处理。

LiteLLM 图像

为 LiteLLM 代码库加星标⭐


7. LlamaIndex ——LLM 应用程序的数据框架

LlamaIndex 可帮助您将自定义数据源连接到 LLM。它提供用于数据提取、结构化和查询优化的工具,让您能够更轻松地构建能够推理私有数据的 LLM 应用程序。

npm install llamaindex
Enter fullscreen mode Exit fullscreen mode
import { Document, VectorStoreIndex } from 'llamaindex'

async function queryDocuments() {
  *// Create documents*
  const documents = [
    new Document({ text: "Sample document content" }),
    new Document({ text: "Another document here" })
  ]

  *// Create and query index*
  const index = await VectorStoreIndex.fromDocuments(documents)
  const queryEngine = index.asQueryEngine()

  const response = await queryEngine.query(
    "What are the main topics in the documents?"
  )

  console.log(response.toString())
}
Enter fullscreen mode Exit fullscreen mode

LlamaIndex 弥合了您的数据和 LLM 之间的差距,使您更容易利用自定义知识构建强大的 AI 应用程序。

骆驼指数

为 LlamaIndex 仓库加星标 ⭐


感谢您的阅读,请告诉我您发现哪些工具真正有用。

鏂囩珷鏉ユ簮锛�https://dev.to/johncook1122/7-open-source-tools-you-need-to-master-ai-development-as-a-beginner-ja4
PREV
我已担任专业开发人员 31 年,现在我 53 岁了,问我任何事情!
NEXT
How to share Firebase Authentication across subdomains