설치
python3 -m pip install schift-cli
schift auth login
schift upload ./docs/refund-policy.pdf --bucket support-docs First Agent
업로드, 검색, Agent 실행이 한 파일 안에서 이어집니다.
import { Schift, RAG, Agent } from "@schift-io/sdk";
import { readFile } from "node:fs/promises";
const schift = new Schift({
apiKey: process.env.SCHIFT_API_KEY,
});
// 1. 문서 넣기
const pdf = await readFile("./docs/refund-policy.pdf");
await schift.db.upload("support-docs", {
files: [
new File([pdf], "refund-policy.pdf"),
],
});
// 2. 검색 준비
const rag = new RAG(
{
bucket: "support-docs",
topK: 5,
},
schift.transport,
);
const evidence = await rag.search(
"환불 정책 최신 기준은?",
);
console.log(evidence[0]?.text);
// 3. Agent에 연결
const agent = new Agent({
name: "Support Agent",
instructions: "문서 근거가 있을 때만 답하세요.",
rag,
model: "gpt-4o-mini",
transport: schift.transport,
});
const result = await agent.run(
"고객에게 환불 기준을 설명해줘",
);
console.log(result.output); Run path
프로젝트 생성 후 `first-agent.ts`만 실행하면 업로드, 검색, Agent 응답까지 이어집니다.
설치
python3 -m pip install schift-cli
schift auth login
schift upload ./docs/refund-policy.pdf --bucket support-docs 실행
SCHIFT_API_KEY=sch_... node first-agent.ts Done when
업로드 요청이 완료되고 bucket ID가 코드에 남아야 합니다.
검색 결과에 원문 조각, 점수, metadata가 보여야 합니다.
agent.run() 중 rag_search 호출이 발생해야 합니다.