Skip to content

【开源自荐】AStack - 🤖 一个用于构建 AI 应用的可组合框架 #233

Open
@qddegtya

Description

@qddegtya

项目地址

https://github.com/astack-tech/astack

类别

Typescript/Python[WIP]

项目标题

AStack - 🤖 一个用于构建 AI 应用的可组合框架

项目描述

Image

AStack 是一个可组合框架,通过"一切皆组件"的理念简化 AI 应用的开发。它提供零适配层设计,实现各种 AI 模型、工具和自定义业务逻辑之间的无缝集成。

AStack 是一个具有独立技术架构和生态系统的技术框架,构建在 Hlang 之上。Hlang 是一种高度语义化的第四代编程语言(4GL),受到流程基础编程(Flow-Based Programming)范式启发,特别适用于作为计算模型以及被 AI 生成。正是这种基于 Hlang 的基础赋予了 AStack 强大的能力。该框架强调极简主义和性能,允许开发者使用最少的样板代码创建复杂系统,同时保持完全的技术自主性。

亮点

  • 基于组件的架构:通过组合简单、可复用的组件构建复杂 AI 系统
  • 零适配层设计:组件之间无需中间适配层即可协同工作
  • 管道执行模型:支持独立和管道两种执行模式
  • 可扩展的工具系统:通过统一的工具接口轻松集成新功能
  • 多模型支持:与各种 LLM 提供商无缝集成
  • 声明式工作流:用最少的代码定义复杂的 AI 工作流
  • 极简 API 设计:专注于简洁性和表达能力

底层计算模型抽象

Image

示例代码

import { Pipeline } from "@astack-tech/core";
import { Agent } from "@astack-tech/components";
import { Deepseek } from "@astack-tech/integrations/model-provider";
import { PromptTemplate } from "@astack-tech/components";

// Create a simple pipeline with components
const pipeline = new Pipeline();

// Add components to the pipeline
pipeline.addComponent('template', new PromptTemplate({
  template: "Answer this question: {{question}}"
}));
pipeline.addComponent('model', new Deepseek({
  apiKey: process.env.DEEPSEEK_API_KEY,
  model: "deepseek-chat"
}));
pipeline.addComponent('agent', new Agent());

// Run the pipeline
const response = await pipeline.run('template.input', {
  question: "What is functional programming?"
});

console.log(response);

截图或演示视频

此示例演示了一个复杂的研究管道,它可以自动搜索信息、分析内容并使用 AI 生成全面的研究报告。它展示了 AStack 协调多个组件之间复杂工作流的能力。

flowchart TB
    %% 主要组件
    Gateway["网关组件"]
    WebDriver["网页驱动器"]
    DataRelay["数据中继"]
    ContentAnalyzer["内容分析器"]
    ReportEnhancer["报告增强器"]
    LLM["LLM 模型提供者"]
    Output(("最终报告"))
    
    %% 网关连接
    Gateway -->|topicOut| ContentAnalyzer
    Gateway -->|searchQueryOut| WebDriver
    ContentAnalyzer -->|ready| Gateway
    ReportEnhancer -->|enhancedReport| Gateway
    
    %% WebDriver 连接
    WebDriver -->|searchResults| DataRelay
    DataRelay -->|dataOut| ContentAnalyzer
    ContentAnalyzer -->|relevantUrls| WebDriver
    WebDriver -->|pageContent| ContentAnalyzer
    
    %% 内容处理
    ContentAnalyzer -->|report| ReportEnhancer
    ReportEnhancer -->|promptMessages| LLM
    LLM -->|message| ReportEnhancer
    
    %% 输出
    Gateway -->|"研究报告<br/>(HTML + JSON)"| Output
    
    %% 样式
    style Gateway fill:#e1f5fe,stroke:#0277bd,stroke-width:1px
    style WebDriver fill:#e1f5fe,stroke:#0277bd,stroke-width:1px
    style DataRelay fill:#e1f5fe,stroke:#0277bd,stroke-width:1px
    style ContentAnalyzer fill:#e1f5fe,stroke:#0277bd,stroke-width:1px
    style ReportEnhancer fill:#e1f5fe,stroke:#0277bd,stroke-width:1px
    style LLM fill:#e1f5fe,stroke:#0277bd,stroke-width:1px
    style Output fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px
Loading

该管道智能地协调网络搜索、内容提取和 AI 驱动的分析,以生成关于任何主题的深入研究报告,包括适当的引用和结构化部分。

官网/了解更多

https://astack.tech

感谢/欢迎贡献

AStack 正在积极开发中,但已经可以为构建 AI 应用程序提供显著价值,欢迎全球开发者参与贡献。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions