딥 리서치
DeepResearch는 다중 라운드 웹 검색을 수행합니다. 쿼리를 생성하고, 검색하고, 충분한 정보가 있는지 평가한 다음, 쿼리를 정제하고 만족할 때까지 반복합니다. 그 후 리포트를 합성합니다.
질문 -> 쿼리 생성 -> 검색 -> 충분한가? | 아니오 -> 쿼리 정제 -> 검색 -> ... 예 -> 리포트 합성사용법
섹션 제목: “사용법”import { 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 파라미터는 chat completions 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;};Agent 도구로 사용
섹션 제목: “Agent 도구로 사용”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 | — | 웹 검색 제공자 설정 |