GPTAgent.js は、TypeScript/JavaScript を使用して AI エージェントを作成するための構成可能で拡張可能なフレームワークです
)AI エージェントの成長には、さまざまな実験が必要です。 GPTAgent.js はエージェントの構成を明示的にするため、エージェントが何をしているかを認識して規制する必要がなく、さらに可能性があります.
npm セットup @gptagent/agent 力を入れてエージェントを忍び寄る小さなプリントの例を見てみましょう.エージェント: 確率的にステップを識別し、アクションを取得できるエージェント (役割と指示ごと) ツール : ファイルを教えて、ファイルを書き、描写を忍び寄り、プログラム可能な検索エンジンを使い、トピックごとにネット サイトをまとめますエージェント/エグゼキュータの分離 (オプション): エグゼキュータを正確にインチングします。環境 (Docker コンテナーなど) のセットは、おそらく描画行を消費し、ライブラリをセットアップし、その他をヒープします トラッキング設定 インスタンスエージェント定義 、フォーマット: new $.action.format.JsonActionFormat(), }), textGenerator, }), });” dir=”auto”>輸入 $, { ActionRegistry
側面
, エージェント, runAgent } から “@gptagent/エージェント”
; const textGenerator
({ apiKey: プロセス .env . OPENAI_API_KEY, }); runAgent ({ エージェント: コンテンポラリー エージェント
: 「あなたは、ウィキペディアの使用に関する質問を解決する記録担当者である可能性が高いでしょう。」 , 制約: `すべての事実を具体的に答えてくださいウィキペディアの記事から、おそらくあなたが教えられた可能性があることがわかります.`, actionRegistry: コンテンポラリー ActionRegistryGPT-4は ノード 18 pnpm
({ 行動
: [ new $.action.tool.ProgrammableGoogleSearchEngineAction({ type: “tool.search-wikipedia”, description: “Search wikipedia using a search term. Returns a list of pages.”, executor: new $.action.tool.ProgrammableGoogleSearchEngineExecutor({ key: process.env.WIKIPEDIA_SEARCH_KEY, cx: process.env.WIKIPEDIA_SEARCH_CX, }), }), new $.action.tool.SummarizeWebpageAction({ type: “tool.read-wikipedia-article”, description: “Read a wikipedia article and summarize it considering the query.”, inputExample: { url: “https://en.wikipedia.org/wiki/Artificial_intelligence”, topic: “{query that you are answering}”, }, executor: new $.action.tool.SummarizeWebpageExecutor({ webpageTextExtractor: new $.component.webpageTextExtractor.BasicWebpageTextExtractor(), summarizer: new $.component.textSummarizer.SingleLevelSplitSummarizer({ splitter: new $.component.splitter.RecursiveCharacterSplitter({ maxCharactersByChunk: 4096 * 4, }), summarizer: new $.component.textSummarizer.ChatTextSummarizer({ chatTextGenerator: textGenerator, }), }), }), }), ], 構造: コンテンポラリー $ .循環.構造. JsonActionFormat(), }), textGenerator
, }), } );