DocsScraper عبارة عن حزمة مصممة لإنشاء "حزم معرفية" من مواقع التوثيق عبر الإنترنت للغة جوليا.
يقوم باستخلاص عناوين URL وتحليلها وبمساعدة PromptingTools.jl، يقوم بإنشاء فهرس للأجزاء وتضميناتها التي يمكن استخدامها في تطبيقات RAG. فهو يتكامل مع AIHelpMe.jl وPromptingTools.jl لتقديم استرجاع استعلام عالي الكفاءة وملائم، مما يضمن أن الاستجابات التي يولدها النظام خاصة بالمحتوى الموجود في قاعدة البيانات التي تم إنشاؤها.
لتثبيت DocsScraper، استخدم مدير حزم Julia واسم الحزمة (لم يتم تسجيلها بعد):
using Pkg
Pkg . add (url = " https://github.com/JuliaGenAI/DocsScraper.jl " )
المتطلبات الأساسية:
using DocsScraper
crawlable_urls = [ " https://juliagenai.github.io/DocsScraper.jl/dev " ]
index_path = make_knowledge_packs (crawlable_urls;
index_name = " docsscraper " , embedding_dimension = 1024 , embedding_bool = true , target_path = " knowledge_packs " )
[ Info : robots . txt unavailable for https : // juliagenai . github . io : / DocsScraper . jl / dev / home /
[ Info : Scraping link : https : // juliagenai . github . io : / DocsScraper . jl / dev / home /
[ Info : robots . txt unavailable for https : // juliagenai . github . io : / DocsScraper . jl / dev
[ Info : Scraping link : https : // juliagenai . github . io : / DocsScraper . jl / dev
. . .
[ Info : Processing https : // juliagenai . github . io : / DocsScraper . jl / dev ...
[ Info : Parsing URL : https : // juliagenai . github . io : / DocsScraper . jl / dev
[ Info : Scraping done : 44 chunks
[ Info : Removed 0 short chunks
[ Info : Removed 1 duplicate chunks
[ Info : Created embeddings for docsscraper. Cost : $ 0. 001
a docsscraper__v20240823__textembedding3large - 1024 - Bool__v1. 0. hdf5
[ Info : ARTIFACT : docsscraper__v20240823__textembedding3large - 1024 - Bool__v1. 0. tar . gz
┌ Info : sha256 :
└ sha = " 977c2b9d9fe30bebea3b6db124b733d29b7762a8f82c9bd642751f37ad27ee2e "
┌ Info : git - tree - sha1 :
└ git_tree_sha = " eca409c0a32ed506fbd8125887b96987e9fb91d2 "
[ Info : Saving source URLS in Julia knowledge_packs docsscraper docsscraper_URL_mapping . csv
" Julia \ knowledge_packs \ docsscraper \ Index \ docsscraper__v20240823__textembedding3large-1024-Bool__v1.0.hdf5 "
make_knowledge_packs
هي نقطة الدخول إلى الحزمة. تأخذ هذه الوظيفة عناوين URL لتحليلها وإرجاع الفهرس. يمكن تمرير هذا الفهرس إلى AIHelpMe.jl للإجابة على الاستعلامات الموجودة على حزم المعرفة المضمنة.
معلمات make_knowledge_packs
الافتراضية:
embedding_bool = true
.embedding_dimension = custom_dimension
.max_chunk_size = custom_max_size
و min_chunk_size = custom_min_size
. ملاحظة: للاستخدام اليومي، حجم التضمين = 1024 ونوع التضمين = Bool كافٍ. هذا متوافق مع خطوط أنابيب AIHelpMe :bronze
و :silver
( update_pipeline(:bronze)
). للحصول على نتائج أفضل، استخدم حجم التضمين = 3072 ونوع التضمين = Float32. يتطلب هذا استخدام :gold
(انظر المزيد ?RAG_CONFIGURATIONS
)
using AIHelpMe
using AIHelpMe : pprint, load_index!
# set it as the "default" index, then it will be automatically used for every question
load_index! (index_path)
aihelp ( " what is DocsScraper.jl? " ) |> pprint
[ Info : Updated RAG pipeline to ` :bronze ` (Configuration key : " textembedding3large-1024-Bool " ) .
[ Info : Loaded index from packs : julia into MAIN_INDEX
[ Info : Loading index from Julia DocsScraper . jl docsscraper Index docsscraper__v20240823__textembedding3large - 1024 - Bool__v1. 0. hdf5
[ Info : Loaded index a file Julia DocsScraper . jl docsscraper Index docsscraper__v20240823__textembedding3large - 1024 - Bool__v1. 0. hdf5 into MAIN_INDEX
[ Info : Done with RAG. Total cost : $ 0. 009
--------------------
AI Message
--------------------
DocsScraper . jl is a Julia package designed to create a vector database from input URLs. It scrapes and parses the URLs and, with the assistance of
PromptingTools . jl, creates a vector store that can be utilized in RAG (Retrieval - Augmented Generation) applications. DocsScraper . jl integrates with
AIHelpMe . jl and PromptingTools . jl to provide efficient and relevant query retrieval, ensuring that the responses generated by the system are specific to the content in the created database.
نصيحة: استخدم pprint
للحصول على مخرجات أفضل مع المصادر و last_result
للحصول على مخرجات أكثر تفصيلاً (مع المصادر).
using AIHelpMe : last_result
# last_result() returns the last result from the RAG pipeline, ie, same as running aihelp(; return_all=true)
print ( last_result ())
يقوم make_knowledge_packs
بإنشاء الملفات التالية:
index_name
│
├── Index
│ ├── index_name__artifact__info.txt
│ ├── index_name__vDate__model_embedding_size-embedding_type__v1.0.hdf5
│ └── index_name__vDate__model_embedding_size-embedding_type__v1.0.tar.gz
│
├── Scraped_files
│ ├── scraped_hostname-chunks-max-chunk_size-min-min_chunk_size.jls
│ ├── scraped_hostname-sources-max-chunk_size-min-min_chunk_size.jls
│ └── . . .
│
└── index_name_URL_mapping.csv
تم تطوير هذا المشروع كجزء من برنامج Google Summer of Code (GSoC). GSoC هو برنامج عالمي يقدم للمطورين الطلاب رواتب لكتابة التعليمات البرمجية للمشاريع مفتوحة المصدر. نحن ممتنون للدعم والفرصة التي قدمتها Google ومجتمع المصادر المفتوحة من خلال هذه المبادرة.