Chidori 开源项目教程

Chidori 开源项目教程

chidori A reactive runtime for building durable AI agents chidori 项目地址: https://gitcode.com/gh_mirrors/ch/chidori

1. 项目介绍

Chidori 是一个开源的反应式运行时,专门用于构建持久的 AI 代理。它提供了一个运行时环境,支持 Python 和 JavaScript 代码执行,旨在解决 AI 代理在长期运行工作流中的复杂性问题。Chidori 的核心功能包括行为缓存、时间旅行调试、可视化调试环境以及创建和导航树搜索代码执行工作流。

2. 项目快速启动

安装

Chidori 可以通过 cargo 安装,以下是安装步骤:

xcode-select --install
brew install cmake protobuf libiconv python@3.12 uv
cargo install chidori-debugger

设置运行时环境

Chidori 默认使用 http://localhost:4000 与 LiteLLM 的代理进行交互。如果需要使用 gpt-3.5-turbo,可以按照以下步骤设置:

pip install litellm[proxy]
uv sync
export OPENAI_API_KEY=your_openai_api_key
uv run litellm --config /litellm_config.yaml

示例代码

以下是一个简单的 Chidori 代理示例,该代理从 Hacker News 获取热门文章,并使用 OpenAI API 过滤出与 AI 相关的新项目,然后将其格式化为 Markdown:

const axios = require('https://deno.land/x/axiod/mod.ts');
const HN_URL_TOP_STORIES = "https://hacker-news.firebaseio.com/v0/topstories.json";

function fetchStory(id) {
  return axios.get(`https://hacker-news.firebaseio.com/v0/item/${id}.json?print=pretty`)
    .then(response => response.data);
}

async function fetchHN() {
  const stories = await axios.get(HN_URL_TOP_STORIES);
  const storyIds = stories.data;
  const tasks = storyIds.slice(0, 30).map(id => fetchStory(id));
  return Promise.all(tasks)
    .then(stories => {
      return stories.map(story => {
        const [title, url, score] = story;
        return [title, url, score];
      });
    });
}
(interpret_the_group)
Based on the following list of HackerNews threads, filter this list to only launches of new AI projects: [[fetched_articles]]
(format_and_rank)
Format this list of new AI projects in markdown, ranking the most interesting projects from most interesting to least: [[interpret_the_group]]
articles = await fetchHN()
format_and_rank(articles=articles)

3. 应用案例和最佳实践

Chidori 适用于需要复杂状态管理和调试的 AI 代理项目。例如,在开发一个需要与多个 AI 模型交互的代理时,Chidori 可以帮助开发者理解和控制代理的状态变化,通过时间旅行调试功能,开发者可以回溯和修正代理的行为。

4. 典型生态项目

Chidori 作为一个运行时环境,可以与其他 AI 工具和框架集成。例如,它可以与 LiteLLM 代理一起使用,通过 HTTP 代理与 OpenAI 的 GPT 模型进行交互。此外,Chidori 还支持与 Python 和 JavaScript 生态系统的其他工具和库集成,如 NumPy、Pandas 等。

chidori A reactive runtime for building durable AI agents chidori 项目地址: https://gitcode.com/gh_mirrors/ch/chidori

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

柯晶辰Godfrey

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值