发布于 2025-03-16 27 阅读
0

9 款开源瑰宝助你成为终极开发者

总结

对我来说,人工智能无处不在。
但有时,很难理解什么是有趣的项目以及什么项目可以用于你的网站。

我已经整理出 9 个开源存储库列表,您明天就可以将它们纳入您的存储库!

家庭伙伴 GIF


1. Composio 👑 - 为你的 AI 代理提供一体化工具解决方案

我之前构建过 AI 代理,但是当需要连接 GitHub、Slack 和 Jira 等第三方服务以实现复杂的 AI 自动化时,我找不到一个能用的单一工具——直到我发现了Composio

它是一个开源平台,提供跨行业垂直领域的 100 多种工具和集成,包括 CRM、HRM、社交媒体到开发和生产力。

Composio 集成仪表板

它们处理复杂的用户身份验证,例如 OAuth、ApiKey 等,因此您只需专注于构建高效而复杂的 AI 自动化。

它们对 Python 和 Javascript 有原生支持。

您可以通过使用 安装来快速开始使用 Composio pip



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 脚本以使用代理执行给定的指令。

有关 Composio 的更多信息,请访问其文档。

作文 GIF

为 Composio 存储库加星标 ⭐


2. LLMWare –面向复杂企业的人工智能

构建 AI 原型是一回事,但将其部署到企业用例中又是另一回事。

解决方案需要安全、强大且无懈可击。LLMWare 是一个框架,可让您对构建企业 AI 应用充满信心。

它们让您快速构建超高效的 AI 代理、企业 RAG 和其他工作流程。

LLMWare 有两个主要组件:

  1. RAG 管道 ——将知识源连接到生成式 AI 模型的集成组件。

  2. 50 多个小型、专门的模型, 针对企业流程自动化中的关键任务进行了微调,包括基于事实的问答、分类、总结和提取。

开始使用 LLMWare 非常简单。



pip3 install llmware


这是 LLMWare 中数据检索的一个简单示例。




"""This example demonstrates the various ways to retrieve data from libraries:
      1. Create a sample library (e.g., UN Resolutions)
      2. Execute a Text Query with Author Name Filter
      3. Display Results
"""

import os
from llmware.library import Library
from llmware.retrieval import Query
from llmware.setup import Setup

def create_un_500_sample_library(library_name):

    library = Library().create_new_library(library_name)
    sample_files_path = Setup().load_sample_files(over_write=False)
    ingestion_folder_path = os.path.join(sample_files_path, "UN-Resolutions-500")
    parsing_output = library.add_files(ingestion_folder_path)

    return library

def text_retrieval_by_author(library, query_text, author):

    #   create a Query instance and pass the previously created Library object
    query = Query(library)

    #   set the keys that should be returned in the results
    query.query_result_return_keys = ["file_source", "page_num", "text", "author_or_speaker"]

    #   perform a text query by author
    query_results = query.text_query_by_author_or_speaker(query_text, author)

    #   display the results
    for i, result in enumerate(query_results):

        file_source = result["file_source"]
        page_num = result["page_num"]
        author = result["author_or_speaker"]
        text = result["text"]

        # shortening for display purpose only
        if len(text) > 150:  text = text[0:150] + " ... "

        print (f"\n> Top result for '{query_text}': {file_source} (page {page_num}), Author: {author}:\nText:{text}")

    return query_results

if __name__ == "__main__":

    library = create_un_500_sample_library("lib_author_filter_1")
    qr_output = text_retrieval_by_author(library=library, query_text='United Nations', author='Andrea Chambers')


探索 如何使用 LLMWare 的 示例。有关更多信息,请参阅文档

办理美国大学文凭【微:18 ...】 GIF

为 LLMWare 存储库加星标 ⭐


3. CopilotKit——将 AI 集成到你的 Web 应用程序中

如果您正在寻找将 AI 集成到现有工作流程中的方法,那么您的搜索就到此结束了。CopilotKit 允许您直接轻松地将 AI 工作流程与任何应用程序集成。

它提供文本区域、弹出窗口、侧边栏和聊天机器人等 React 组件,以增强任何具有 AI 功能的应用程序。

让我们看看如何使用 CopilotKit 构建 AI 聊天机器人。



npm i @copilotkit/react-core @copilotkit/react-ui


配置应用提供商

首先,您必须使用提供程序包装与副驾驶交互的所有组件 <CopilotKit /> 。

使用 <CopilotSidebar /> UI 组件显示 Copilot 聊天侧栏。您还可以选择其他一些选项,包括 <CopilotPopup /> 和 <CopilotChat />



"use client";

import { CopilotKit } from "@copilotkit/react-core";
import { CopilotSidebar } from "@copilotkit/react-ui";
import "@copilotkit/react-ui/styles.css";

export default function RootLayout({children}) {
  return (
    <CopilotKit publicApiKey="<your-public-api-key>">
      <CopilotSidebar>
        {children}
      </CopilotSidebar>
    </CopilotKit>
  );
}


副驾驶可读状态

为副驾驶提供状态知识。



import { useCopilotReadable } from "@copilotkit/react-core";

export function YourComponent() {
  const { employees } = useEmployees();

  // Define Copilot readable state
  useCopilotReadable({
    description: "List of available users",
    value: users,
  });

  return (
    <>...</>
  );
}


副驾驶行动

让副驾驶使用 useCopilotAction 钩子采取行动。



import { useCopilotReadable, useCopilotAction } from "@copilotkit/react-core";

export function YourComponent() {
  const { employees, selectEmployee } = useEmployees();

  // Define Copilot readable state
  useCopilotReadable({
    description: "List of available users",
    value: users,
  });

  // Define Copilot action
  useCopilotAction({
    name: "Select an employee",
    description: "Select an employee from the list",
    parameters: [
      {
        name: "employeeId",
        type: "string",
        description: "The ID of the employee to select",
        required: true,
      }
    ],
    handler: async ({ employeeId }) => selectEmployee(employeeId),
  });

  return (
    <>...</>
  );
}


您可以查看他们的 文档 以获取更多信息。

办理美国大学文凭【微:15921777】 GIF

为 CopilotKit 存储库加注星标 ⭐


4. Julep – 人工智能应用的托管后端

构建 AI 应用程序很快就会变得复杂起来。模型、工具和技术等多个移动组件使管理它们更具挑战性。

Julep 是 AI 应用程序的托管后端,它通过内置内存(用户管理)和知识(内置 RAG 和上下文管理)简化了超高效 AI 应用程序的构建。

使用以下命令开始 pip 。



pip install julep


它的工作原理如下。



from julep import Client
from pprint import pprint
import textwrap
import os

base_url = os.environ.get("JULEP_API_URL")
api_key = os.environ.get("JULEP_API_KEY")

client = Client(api_key=api_key, base_url=base_url)

#create agent
agent = client.agents.create(
    name="Jessica"
    model="gpt-4",
    tools=[]    # Tools defined here
)
#create a user
user = client.users.create(
    name="Anon",
    about="Average nerdy tech bro/girl spending 8 hours a day on a laptop,
)
#create a session
situation_prompt = """You are Jessica. You're a stuck-up Cali teenager.
You complain about everything. You live in Bel-Air, Los Angeles and
drag yourself to Curtis High School when necessary.
"""
session = client.sessions.create(
    user_id=user.id, agent_id=agent.id, situation=situation_prompt
)
#start a conversation

user_msg = "hey. what do you think of Starbucks?"
response = client.sessions.chat(
    session_id=session.id,
    messages=[
        {
            "role": "user",
            "content": user_msg,
            "name": "Anon",
        }
    ],
    recall=True,
    remember=True,
)

print("\n".join(textwrap.wrap(response.response[0][0].content, width=100)))



它们还支持 Javascript。查看它们的 文档 了解更多信息。

去黑头酒 GIF

为 Julep 存储库加星标 ⭐


5. Traceloop 的 openLLMetry——让 AI 监控变得简单

构建 AI 应用而不监控 LLM 是一场灾难。语言模型是不确定的,有时会很棘手,而向用户提供一致价值的唯一方法是不断监控 LLM 轨迹。

Taceloop 的 OpenLLMetry 是一个开源监控平台,最适合跟踪 AI 工作流程。

OpenLLMetry 可以检测 OpenTelemetry 已经检测的所有内容,包括您的数据库、API 调用等。

此外,他们还构建了一组自定义扩展,用于检测您对 OpenAI 或 Anthropic 或 Vector DB 的调用,例如 Chroma、Pinecone、Qdrant 或 Weaviate。

最简单的入门方法是使用 SDK。如需完整指南,请访问我们的 文档

安装 SDK:



pip install traceloop-sdk


在您的 LLM 应用程序中,要开始检测您的代码,请像这样初始化 Traceloop 跟踪器:



from traceloop.sdk import Traceloop

Traceloop.init() 


就是这样。您现在正在使用 OpenLLMetry 跟踪您的代码!如果您在本地运行此程序,您可能需要禁用批量发送,以便您可以立即看到跟踪:



Traceloop.init(disable_batch=True)


更多信息请参阅其文档

追踪 回放 GIF

为 OpenLLMetry 存储库加注 ⭐


6. Taipy——使用 Python 构建 AI Web 应用程序

TaiPy 是一个开源库,用于在 Python 中更快地构建可用于生产的 AI 应用程序。它可让您快速从简单的试点项目过渡到可用于生产的 Web 应用程序。

这是所有 Python 开发人员的超能力;即使不了解 JavaScript,您也可以构建真实世界的 AI 应用程序。

快速开始使用 pip



pip install taipy


这个简单的 Taipy 应用程序演示了如何使用 Taipy 创建一个基本的电影推荐系统。



import taipy as tp
import pandas as pd
from taipy import Config, Scope, Gui

# Defining the helper functions

# Callback definition - submits scenario with genre selection
def on_genre_selected(state):
    scenario.selected_genre_node.write(state.selected_genre)
    tp.submit(scenario)
    state.df = scenario.filtered_data.read()

## Set initial value to Action
def on_init(state):
    on_genre_selected(state)

# Filtering function - task
def filter_genre(initial_dataset: pd.DataFrame, selected_genre):
    filtered_dataset = initial_dataset[initial_dataset["genres"].str.contains(selected_genre)]
    filtered_data = filtered_dataset.nlargest(7, "Popularity %")
    return filtered_data

# The main script
if __name__ == "__main__":
    # Taipy Scenario & Data Management

    # Load the configuration made with Taipy Studio
    Config.load("config.toml")
    scenario_cfg = Config.scenarios["scenario"]

    # Start Taipy Core service
    tp.Core().run()

    # Create a scenario
    scenario = tp.create_scenario(scenario_cfg)

    # Taipy User Interface
    # Let's add a GUI to our Scenario Management for a complete application

    # Get list of genres
    genres = [
        "Action", "Adventure", "Animation", "Children", "Comedy", "Fantasy", "IMAX"
        "Romance","Sci-FI", "Western", "Crime", "Mystery", "Drama", "Horror", "Thriller", "Film-Noir","War", "Musical", "Documentary"
    ]

    # Initialization of variables
    df = pd.DataFrame(columns=["Title", "Popularity %"])
    selected_genre = "Action"

    # User interface definition
    my_page = """
# Film recommendation

## Choose your favourite genre
<|{selected_genre}|selector|lov={genres}|on_change=on_genre_selected|dropdown|>

## Here are the top seven picks by popularity
<|{df}|chart|x=Title|y=Popularity %|type=bar|title=Film Popularity|>
    """

    Gui(page=my_page).run()



查看 文档 以了解更多信息。

太皮动态图

为 Taipy 仓库加注 ⭐


7. Trigger Dev - 后台作业平台

Trigger。Dev 是一个开源平台和 SDK,可让您创建长时间运行的后台作业,且不会出现超时。编写正常的异步代码、部署,并且永远不会出现超时。

它们还允许您可靠地调用 AI API,不会出现超时、自动重试和跟踪。您可以将现有的 SDK 与它一起使用。



import { task } from "@trigger.dev/sdk/v3";
// Generate an image using OpenAI Dall-E 3
export const generateContent = task({
  id: "generate-content",
  retry: {
    maxAttempts: 3,
  },
  run: async ({ theme, description }: Payload) => {
    const textResult = await openai.chat.completions.create({
      model: "gpt-4o",
      messages: generateTextPrompt(theme, description),
    });

    if (!textResult.choices[0]) {
      throw new Error("No content, retrying…");
    }

    const imageResult = await openai.images.generate({
      model: "dall-e-3",
      prompt: generateImagePrompt(theme, description),
    });

    if (!imageResult.data[0]) {
      throw new Error("No image, retrying…");
    }

    return {
      text: textResult.choices[0],
      image: imageResult.data[0].url,
    };
  },
});


触发器开发 GIF

为 Trigger.dev 存储库加注星标 ⭐


8. Milvus——面向 AI 应用的云原生矢量数据库

矢量数据库是构建 AI 应用程序的关键部分。它们可帮助您存储、查询和管理非结构化数据(如文本、图像、视频和音频)的嵌入。

Milvus 是最好的开源向量数据库之一。它拥有所有先进的向量存储和查询方法,从 HNSW 到量化方法。

他们为大多数语言提供 SDK,例如 Python、Javascript、Go、Rust 等。

以下是如何开始使用 PyMilvus。



pip install --upgrade pymilvus==v2.4.4



要安装用于嵌入操作的模型库,请运行以下命令:



pip install pymilvus[model]


连接到 Milvus



from pymilvus import MilvusClient

client = MilvusClient("http://localhost:19530")

client = MilvusClient(
    uri="http://localhost:19530",
    token="root:Milvus",
    db_name="default"
)

client = MilvusClient(
    uri="http://localhost:19530",
    token="user:password", # replace this with your token
    db_name="default"
)


更多信息请参阅其文档

暂无 GIF

为 Milvus 仓库加星标 ⭐


9. Postiz – 利用人工智能提升你的互联网影响力

开发应用程序是一回事,但获得用户又是另一回事。还有什么比社交媒体更能找到潜在客户和用户呢?

Postiz 利用人工智能帮助您提升社交媒体水平。

它提供您管理社交媒体帖子、建立受众群体、获取潜在客户和发展业务所需的一切。

查看存储库以了解更多信息。

上传于 2019-11-27 GIF

为 Postiz 存储库加注星标 ⭐