콘텐츠로 이동

딥 리서치

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;
};
const agent = new Agent({
tools: [research.asTool()],
...
});

deep_research로 등록됩니다. 에이전트는 철저한 다중 소스 리서치가 필요한 질문에 이 도구를 호출합니다.

옵션타입기본값설명
maxIterationsnumber3최대 리서치 라운드
resultsPerSearchnumber5쿼리당 결과 수
queriesPerIterationnumber2라운드당 생성 쿼리 수
queryModelModelId | string"gpt-4o-mini"쿼리 생성용 모델
synthesisModelModelId | string"gpt-4o-mini"최종 리포트용 모델
webSearchWebSearchConfig웹 검색 제공자 설정