1
2
문서 작성
첫 번째 쓰기가 네임스페이스
docs를 만듭니다.curl https://api.conare.ai/namespaces/docs/documents \
-H "Authorization: Bearer $CONARE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"documents": [
{ "id": "refunds", "text": "Refunds are available for 30 days.", "metadata": { "team": "support" } }
]
}'
import { Conare } from "conare";
const conare = new Conare();
const docs = conare.namespace("docs");
await docs.add({ id: "refunds", text: "Refunds are available for 30 days.", metadata: { team: "support" } });
3
검색
curl https://api.conare.ai/namespaces/docs/query \
-H "Authorization: Bearer $CONARE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "how do refunds work?"}'
const results = await docs.query("how do refunds work?");
Response
{
"results": [
{
"id": "refunds",
"text": "Refunds are available for 30 days.",
"score": 0.3471,
"reranked": true,
"metadata": { "team": "support" }
}
],
"took_ms": 59
}
text를 컨텍스트로 모델에 전달하세요.