ディープリサーチ
DeepResearch は、複数回のウェブ検索を実行します。クエリを生成し、検索し、十分な情報が得られたかを評価し、クエリを洗練し、満足するまで繰り返します。その後、レポートを統合します。
Question -> Generate queries -> Search -> Sufficient? | No -> Refine queries -> Search -> ... Yes -> Synthesize reportimport { DeepResearch } from "@schift-io/sdk";
const research = new DeepResearch( { maxIterations: 5, resultsPerSearch: 10, queriesPerIteration: 3, synthesisModel: "gpt-4o", webSearch: { provider: "tavily", providerApiKey: "tvly-xxx", }, }, llmFn,);
const report = await research.run("AI agent framework trends 2026");
console.log(report.answer); // 統合されたレポートconsole.log(report.sources.length); // ソースの数console.log(report.iterations); // 使用された反復回数console.log(report.totalQueries); // 実行された総クエリ数llmFn パラメータは、任意のチャット完了APIを呼び出す関数です:
const llmFn = async (messages: Array<{ role: string; content: string }>) => { const resp = await fetch("https://api.openai.com/v1/chat/completions", { method: "POST", headers: { Authorization: `Bearer ${process.env.OPENAI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ model: "gpt-4o-mini", messages }), }); const data = await resp.json(); return data.choices[0].message.content;};エージェントツールとして
Section titled “エージェントツールとして”const agent = new Agent({ tools: [research.asTool()], ...});deep_research として登録されます。エージェントは、徹底的なマルチソースリサーチが必要な質問に対してこれを呼び出します。
| オプション | 型 | デフォルト | 説明 |
|---|---|---|---|
maxIterations | number | 3 | 最大リサーチラウンド |
resultsPerSearch | number | 5 | クエリごとの結果数 |
queriesPerIteration | number | 2 | ラウンドごとに生成されるクエリ |
queryModel | ModelId | string | "gpt-4o-mini" | クエリ生成用モデル |
synthesisModel | ModelId | string | "gpt-4o-mini" | 最終レポート用モデル |
webSearch | WebSearchConfig | — | ウェブ検索プロバイダー設定 |