المعاملات
namestringمطلوبأي شيء آخر يتم تحويله، ما لا يمكن رفضه.
contentstringمطلوبالملاحظة بحد ذاتها، تصل إلى 4 آلاف حرف، الفراغ مرفوض
descriptionstringوهذا ما يراه الوكيل عند الاختيار — انظر أولاً-.
typestringpreference · project · fact · correction · otherالقيم المجهولة التي أصبحت other.
sourcestringuser أو agentأي شيء لا يعني user & agent.
sessionIdstringلقد تعلمت هذه الجلسة عندما كانت هناك واحدة
الاسم هو الهوية
حفظ الاسم الموجود بالفعل محل تلك الملاحظة. هذا هو آلية التحديث بأكملها، ولهذا السبب يستحق الاسم الاختيار حسناً: إنه الشيء الذي يجب أن تتطابق معه لاحقاً.
await api.memory.save({ name: "tone-of-voice", content: "Short answers.", source: "user" });
await api.memory.save({ name: "tone-of-voice", content: "Short answers, in French.", source: "user" });
// One note. The second content replaced the first.api.memory.save(name="tone-of-voice", content="Short answers.", source="user")
api.memory.save(name="tone-of-voice", content="Short answers, in French.", source="user")
# One note. The second content replaced the first.| ما تمر به | مُز |
|---|---|
| طين صوت | )لنغ في المائة |
| user_preferences | المستخدم |
| ! ! ! ! ! | دال - |
| ! ! | رُرِعت - invalid_name |
اثنان مختلف الاسمان يمكن أن يلتقيا على واحد، والثاني حفظ ثم يستبدل الملاحظة الأولى دون أن يقول ذلك. اختر أسماء بسيطة، مستقرة، واقرأ الاسم الذي يأتي عندما بنيته من مدخل المستخدم.
اكتب الوصف للعامل
The content is only opened when a note looks relevant, and relevance is judged on the description alone. So the description should say when this is worth reading, not what it contains.
| الوصف الوكِش | مُحسن |
|---|---|
| `4` `4` | " كيف يريد هذا المستخدم أن يكتب إلى |
| `قاعدة بيانات | `أي قاعدة بيانات تستخدم، والذي لا يمكن لمسه أبداً` |
| `مذكرات بشأن المشروع` | `قواعد نشر هذا المشروع، بما في ذلك ما هو محظور |
القيمة المُعادة
const note = await api.memory.save({
name: "deploy-rules",
description: "The deploy rules for this project, including what is forbidden",
content: "No deploys on Friday. Staging first, always. Migrations run separately.",
type: "project",
source: "user",
});
note.name; // "deploy-rules"
note.type; // "project"
note.updatedAt;note = api.memory.save(
name="deploy-rules",
description="The deploy rules for this project, including what is forbidden",
content="No deploys on Friday. Staging first, always. Migrations run separately.",
type="project",
source="user",
)
note["name"] # "deploy-rules"
note["type"] # "project"
note["updatedAt"]( ١ بطرس ٣ : ١ ) فَٱلْمَحَبَّةُ ٱلْمُخْزَنَةُ ٱلْمُخْزَنَةُ ، بَعْدَمَا يُحَوَّلُ ٱلْأَسْمَ وَيُصَلِّحُ ٱلْنَّصُ إلى حُدِّهَا ، قَرِّئْهَا مُقَدَّمَةً بِأَنَّ مَا أَرْسَلَتَهُ هُوَ مَا حُفِظَ .
الأخطاء
| الرمز | الحالة | متى |
|---|---|---|
| invalid_name | 400 | ولم يترك أي شيء يمكن استخدامه بعد التحويل. |
| content_required | 400 | المحتوى كان فارغ أو فقط أبيض فراغ. |
| too_many_memories | 400 | 200 ملاحظة بالفعل، وهذا سيكون واحد جديد. |
too_many_memories تطبيق الجديدة الجديدة الجديدة ( ١ تيموثاوس ٣ : ١ ) وَهذَا مَا يَجِبُ أَنْ يَحْدُثَ ٱلْكَلِمَةُ ٱلْمُتَمَسَّةُ بِٱلْمَحَبَّةِ .
import { IaGenifyError } from "iagenify";
try {
await api.memory.save({ name, content, description, type, source: "user" });
} catch (err) {
if (err instanceof IaGenifyError && err.code === "too_many_memories") {
// Let the user choose what goes. Do not evict on their behalf.
return { needsPruning: await api.memory.list() };
}
throw err;
}from iagenify import IaGenifyError
try:
api.memory.save(name=name, content=content, description=description, type=kind, source="user")
except IaGenifyError as error:
if error.code != "too_many_memories":
raise
# Let the user choose what goes. Do not evict on their behalf.
needs_pruning = api.memory.list()و لماذا يستحق الأمر أن يُقام
أي شيء غير موجود "user" (أ) agentوَبِأَنَّهُ بِأَنَّهُ يَتَحَلَّى بِصِفَةٍ بِٱلْبَشَرِ يَفْتَرِقُهُمْ « أَنْتَ أَنْتَ تَتَعَلَّمَ مِنْهُ » .