1
احصل على مفتاح
أنشئ مفتاح API في وحدة التحكم. الوصول بالدعوة فقط: اطلب الوصول.
export CONARE_API_KEY=sk-conare-...
npm install conare # for the TypeScript examples
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 الخاص بكل نتيجة إلى نموذجك كسياق.