DocsScraper는 Julia 언어에 대한 온라인 문서 사이트에서 "지식 팩"을 생성하도록 설계된 패키지입니다.
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과 오픈소스 커뮤니티가 제공하는 지원과 기회에 감사드립니다.