ArchGW 项目使用教程

ArchGW 项目使用教程

archgw AI-native (edge and LLM) proxy for agents. Engineered with fast ⚡️ LLMs for task (query) routing, rich observability, and the seamless integration of prompts with your APIs for agentic tasks. Built by the contributors of Envoy proxy. archgw 项目地址: https://gitcode.com/gh_mirrors/ar/archgw

1. 项目目录结构及介绍

ArchGW 项目采用模块化设计,其目录结构如下:

  • arch: 包含与 ArchGW 相关的代码。
  • crates: 存放项目的依赖包和模块。
  • demos: 包含演示应用程序的代码。
  • docs: 项目文档。
  • model_server: 模型服务器相关的代码。
  • tests: 测试代码。
  • www: 网页静态文件和服务器代码。
  • .dockerignore: Docker 构建时排除的文件列表。
  • .gitignore: Git 忽略文件列表。
  • .gitmodules: Git 子模块配置。
  • CONTRIBUTING.md: 贡献指南。
  • LICENSE: 项目许可证。
  • README.md: 项目说明文件。
  • archgw.code-workspace: Visual Studio Code 工作区配置。
  • build_filter_image.sh: 构建过滤镜像的脚本。

每个目录和文件都有其特定的作用,共同构成了 ArchGW 项目。

2. 项目的启动文件介绍

项目的启动主要通过 archgw 命令行工具进行。在项目根目录下,通过以下命令安装并启动 ArchGW:

pip install archgw==0.2.4
archgw up arch_config.yaml

安装命令会创建一个 Python 虚拟环境并安装 ArchGW 的 CLI 工具。archgw up 命令用于启动 ArchGW 服务,它需要一个配置文件(本例中为 arch_config.yaml)作为参数。

3. 项目的配置文件介绍

配置文件 arch_config.yaml 是一个 YAML 格式的文件,用于设置 ArchGW 的运行参数。以下是一个配置文件的示例:

version: v0.1
listener:
  address: 0.0.0.0
  port: 10000
message_format: huggingface
connect_timeout: 0.005s
llm_providers:
  - name: gpt-4o
    access_key: $OPENAI_API_KEY
    provider: openai
    model: gpt-4o
system_prompt: |
  You are a helpful assistant.
prompt_guards:
  input_guards:
    jailbreak:
      on_exception:
        message: "Looks like you're curious about my abilities, but I can only provide assistance for currency exchange."
prompt_targets:
  - name: currency_exchange
    description: Get currency exchange rate from USD to other currencies
    parameters:
      - name: currency_symbol
        description: the currency that needs conversion
        required: true
        type: str
        in_path: true
    endpoint:
      name: frankfurther_api
      path: /v1/latest?base=USD&symbols={currency_symbol}
    system_prompt: |
      You are a helpful assistant. Show me the currency symbol you want to convert from USD.
  - name: get_supported_currencies
    description: Get list of supported currencies for conversion
    endpoint:
      name: frankfurther_api
      path: /v1/currencies
endpoints:
  frankfurther_api:
    endpoint: api.frankfurter.dev:443
    protocol: https

配置文件包括以下部分:

  • version: 配置文件版本。
  • listener: 指定服务监听的地址和端口。
  • message_format: 消息格式,用于定义与 LLM 交互的消息结构。
  • connect_timeout: 连接超时时间。
  • llm_providers: LLM 提供商配置,包括名称、访问密钥、提供商类型、模型和系统提示。
  • prompt_guards: 输入守卫,用于防止不安全的用户输入。
  • prompt_targets: 定义与用户交互的目标,包括名称、描述、参数、端点和系统提示。
  • endpoints: 定义服务端点,包括端点名称、路径和协议。

通过修改这个配置文件,用户可以调整 ArchGW 的运行参数,以满足不同的使用场景。

archgw AI-native (edge and LLM) proxy for agents. Engineered with fast ⚡️ LLMs for task (query) routing, rich observability, and the seamless integration of prompts with your APIs for agentic tasks. Built by the contributors of Envoy proxy. archgw 项目地址: https://gitcode.com/gh_mirrors/ar/archgw

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

樊元隽

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

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

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

打赏作者

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

抵扣说明:

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

余额充值