🚀 جرب Zilliz Cloud، الـ Milvus المدارة بالكامل، مجاناً — تجربة أداء أسرع بـ 10 أضعاف! جرب الآن>>

milvus-logo
LFAI
الصفحة الرئيسية
  • عمليات الدمج
    • الوكلاء
  • Home
  • Docs
  • عمليات الدمج

  • الوكلاء

  • ميمغبت

MemGPT مع تكامل Milvus

تجعلMemGPT من السهل بناء ونشر وكلاء LLM ذوي الحالة. مع تكامل Milvus، يمكنك إنشاء وكلاء مع اتصالات بمصادر بيانات خارجية (RAG).

في هذا المثال، سنستخدم في هذا المثال MemGPT للدردشة مع مصدر بيانات مخصص مخزّن في Milvus.

التكوين

لتشغيل MemGPT، يجب التأكد من أن إصدار Python >= 3.10.

لتمكين الواجهة الخلفية لـ Milvus، تأكد من تثبيت التبعيات المطلوبة مع:

$ pip install 'pymemgpt[milvus]'

يمكنك تكوين اتصال ميلفوس عبر الأمر

$ memgpt configure
...
? Select storage backend for archival data: milvus
? Enter the Milvus connection URI (Default: ~/.memgpt/milvus.db): ~/.memgpt/milvus.db

ما عليك سوى تعيين URI إلى مسار الملف المحلي، على سبيل المثال ~/.memgpt/milvus.db ، والذي سيقوم تلقائيًا باستدعاء مثيل خدمة Milvus المحلي من خلال Milvus Lite.

إذا كان لديك نطاق كبير من البيانات مثل أكثر من مليون مستند، نوصي بإعداد خادم Milvus أكثر أداءً على docker أو kubenetes. وفي هذه الحالة، يجب أن يكون URI الخاص بك هو URI الخادم، على سبيل المثال http://localhost:19530.

إنشاء مصدر بيانات خارجي

لتغذية البيانات الخارجية في روبوت الدردشة MemGPT، نحتاج أولاً إلى إنشاء مصدر بيانات.

لتنزيل ورقة بحث MemGPT سنستخدم curl (يمكنك أيضًا تنزيل ملف PDF من متصفحك):

# we're saving the file as "memgpt_research_paper.pdf"
$ curl -L -o memgpt_research_paper.pdf https://arxiv.org/pdf/2310.08560.pdf

الآن بعد أن قمنا بتنزيل الورقة، يمكننا إنشاء مصدر بيانات MemGPT باستخدام memgpt load:

$ memgpt load directory --name memgpt_research_paper --input-files=memgpt_research_paper.pdf
Loading files: 100%|███████████████████████████████████| 1/1 [00:00<00:00,  3.94file/s]
Loaded 74 passages and 13 documents from memgpt_research_paper

إرفاق مصدر البيانات بعامل MemGPT

الآن بعد أن أنشأنا مصدر البيانات هذا، يمكننا إرفاقه بروبوت دردشة MemGPT في أي وقت.

لنقم بإنشاء روبوت دردشة آلي جديد باستخدام الشخصية memgpt_doc (ولكن يمكنك استخدام أي شخصية تريدها):

# reminder: `memgpt run --persona memgpt_doc` will create a new MemGPT agent using the `memgpt_doc` persona
$ memgpt run --persona memgpt_doc

بمجرد أن ندردش مع الوكيل، يمكننا "إرفاق" مصدر البيانات بذاكرة الوكيل الأرشيفية:

? Would you like to select an existing agent? No

🧬 Creating new agent...
->  🤖 Using persona profile: 'sam_pov'
->  🧑 Using human profile: 'basic'
🎉 Created new agent 'PoliteButterfly' (id=d26e1981-ff36-4095-97a0-61a1601dfb5d)

Hit enter to begin (will request first MemGPT message)

💭 Interesting, I've got a first-time user. Time to present myself and get to understand the user's needs. I wonder what brings Chad here today.
🤖 Greetings Chad! I'm MemGPT. How may I assist you today?

> Enter your message: /attach
? Select data source memgpt_research_paper
100%|███████████████████████████████████| 1/1 [00:00<00:00,  4.81it/s]

اختبار روبوت الدردشة الآلي الجديد

الآن بعد أن تم تحميل البيانات في ذاكرة روبوت الدردشة الآلية، يمكننا البدء في طرح الأسئلة حولها:

> Enter your message: The paper I loaded into your archival memory is called MemGPT. Can you tell me more about it?

💭 It seems Chad would like to know more about the paper titled 'MemGPT' that's stored in my archival memory. It's time to search the archival memory for details and background data to provide a comprehensive
understanding of the paper. Let's remember to page through results until I've gathered enough information to answer Chad's enquiry.
⚡🧠 [function] searching memory with archival_memory_search
💭 Based on the found results, MemGPT is an AI system designed for tasks like extended conversations and document analysis. It efficiently manages different tiers of storage to provide extended context within
the LLM’s limited cap. Also, noteworthy from my findings is that MemGPT performs impressively in deep memory retrieval (DMR) and document QA tasks. Let's prepare a comprehensive response for Chad.
🤖 Certainly, Chad. MemGPT, or MemoryGPT, is a system specially designed for tasks like extended conversations and document analysis which are traditionally hindered by the limited context windows of modern 
Large Language Models (LLMs). It uses a technique inspired by hierarchical memory systems in traditional operating systems, called virtual context management. This technique allows for an effective provision 
of extended context within an LLM’s limited context window by intelligently managing different storage tiers, much like paging between physical memory and disk. Notably, MemGPT outperforms the fixed-context 
baselines in deep memory retrieval and it's able to analyze large documents with precision.

جرب Managed Milvus مجاناً

Zilliz Cloud خالي من المتاعب، ويعمل بواسطة Milvus ويعمل بسرعة 10 أضعاف.

ابدأ
التعليقات

هل كانت هذه الصفحة مفيدة؟