Skip to content

kurusugawa-computer/ace-ts

Repository files navigation

ace-ts

概要

ace-ts は来栖川電算の CLI 型 AI エージェント ACE を TypeScript/JavaScript から簡単に利用するためのラッパーライブラリです。

インストール

リポジトリ名は ace-ts ですが、npm上のパッケージ名は ace-client です。インストール時はパッケージ名にご注意ください。

npm install ace-client

使用例

簡単な使用例です。環境変数 OPENAI_API_KEY に API キーを入れて実行します。

import { Ace } from "ace-client";

interface Response {
  answer: string;
}

async function main(): Promise<void> {
  const apiKey = process.env.OPENAI_API_KEY;
  if (!apiKey) {
    console.error("環境変数 OPENAI_API_KEY を設定してください");
    process.exit(1);
  }

  const ace = new Ace({ apiKey });

  try {
    const result = await ace.invoke("example/simple.yaml", "root", {
      question: "今日の名古屋の天気は?",
    });

    const response = result.unmarshal<Response>();
    console.log(response.answer);
  } catch (error) {
    console.error(`エラーが発生しました: ${error}`);
    process.exit(1);
  }
}

main();

ライセンス

MIT License

About

ACE の TypeScript ライブラリ

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors