Skip to main content

Easily implement RAG workflows with pre-built modules.

Project description

easy_rag_llm

CAUTION

  • easy-rag-llm==1.0.* version is testing version. These versions are usually invalid.

๐Ÿ‡ฐ๐Ÿ‡ท ์†Œ๊ฐœ

  • easy_rag_llm๋Š” OpenAI ๋ฐ DeepSeek ๋ชจ๋ธ์„ ์ง€์›ํ•˜๋Š” ๊ฐ„๋‹จํ•œ RAG(์ •๋ณด ๊ฒ€์ƒ‰ ๋ฐ ์ƒ์„ฑ) ๊ธฐ๋ฐ˜ ์„œ๋น„์Šค๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ๊ฐ„๋‹จํ•˜๊ฒŒ RAG LLM์„ ์„œ๋น„์Šค์— ํ†ตํ•ฉ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋„๋ก ๋งŒ๋“ค์–ด์กŒ์Šต๋‹ˆ๋‹ค.
  • (2025.01.16 ๊ธฐ์ค€/ v1.0.12) ํ•™์Šต๊ฐ€๋Šฅํ•œ ์ž๋ฃŒ ํฌ๋งท์€ PDF์ž…๋‹ˆ๋‹ค.

๐Ÿ‡บ๐Ÿ‡ธ Introduction

  • easy_rag_llm is a lightweight RAG-based service that supports both OpenAI and DeepSeek models. It is designed to seamlessly integrate RAG-based LLM functionalities into your service.
  • As of 2025-01-15 (v1.0.0), the supported resource format for training is PDF.

Usage

Install

pip install easy_rag_llm

How to integrate to your service?

from easy_rag import RagService

rs = RagService(
    embedding_model="text-embedding-3-small", #Fixed to OpenAI model
    response_model="deepseek-chat",  # Options: "openai" or "deepseek-chat"
    open_api_key="your_openai_api_key_here",
    deepseek_api_key="your_deepseek_api_key_here",
    deepseek_base_url="https://api.deepseek.com",
)

resource = rs.rsc("./rscFiles", force_update=False)  # Learn from all files under ./rscFiles

query = "Explain what is taught in the third week's lecture."
response, top_evidence = rs.generate_response(resource, query)

print(response)

๐Ÿ‡ฐ๐Ÿ‡ท ์•ˆ๋‚ด.

  • pdf ์ œ๋ชฉ์„ ๋ช…ํ™•ํ•˜๊ฒŒ ์ ์–ด์ฃผ์„ธ์š”. ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ์—๋Š” pdf์ œ๋ชฉ์ด ์ถ”์ถœ๋˜์–ด ๋“ค์–ด๊ฐ€๋ฉฐ, ๋‹ต๋ณ€ ๊ทผ๊ฑฐ๋ฅผ ์ถœ๋ ฅํ• ๋•Œ ์œ ์šฉํ•˜๊ฒŒ ์‚ฌ์šฉ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • rs.rsc("./folder") ์ž‘๋™์‹œ faiss_index.bin๊ณผ metadata.json์ด ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค. ์ดํ›„์—” ์ด๋ฏธ ๋งŒ๋“ค์–ด์ง„ .bin๊ณผ .json์œผ๋กœ ๋‹ต๋ณ€์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. ๋งŒ์•ฝ ํด๋”์— ์ƒˆ๋กœ์šด ํŒŒ์ผ์„ ์ถ”๊ฐ€ํ•˜๊ฑฐ๋‚˜ ์ œ๊ฑฐํ•˜์—ฌ ๋ณ€๊ฒฝํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด force_update=True๋กœ ์„ค์ •ํ•˜์—ฌ ๊ฐ•์ œ์—…๋ฐ์ดํŠธ๊ฐ€ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ‡บ๐Ÿ‡ธ Note.

  • Ensure that your PDFs have clear titles. Extracted titles from the PDF metadata are used during training and for generating evidence-based responses.
  • Running rs.rsc("./folder") generates faiss_index.bin and metadata.json files. Subsequently, the system uses the existing .bin and .json files to generate responses. If you want to reflect changes by adding or removing files in the folder, you can enable forced updates by setting force_update=True.

release version.

  • 1.0.12 : Supported. However, the embedding model and chat model are fixed to OpenAI's text-embedding-3-small and deepseek-chat, respectively. Fixed at threadpool worker=10, which may cause errors in certain environments.

๊ณ ์ณ์•ผํ•  ์ง€์ 

  • worker ๊ฐœ์ˆ˜ ์ž์œจ์กฐ์ •์„ ์œ„ํ•œ ํŒŒ๋ผ๋ฏธํ„ฐ ์ถ”๊ฐ€ ํ•„์š”
  • ์ฐธ๊ณ ํ•  evidence ๊ฐœ์ˆ˜ ์กฐ์ • ํŒŒ๋ผ๋ฏธํ„ฐ ์ถ”๊ฐ€ ํ•„์š”
  • api key ์‚ฌ์šฉ์ด ์ž์œ ๋กญ์ง€ ์•Š์Œ.

Author Information

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easy_rag_llm-1.0.13.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easy_rag_llm-1.0.13-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file easy_rag_llm-1.0.13.tar.gz.

File metadata

  • Download URL: easy_rag_llm-1.0.13.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.4

File hashes

Hashes for easy_rag_llm-1.0.13.tar.gz
Algorithm Hash digest
SHA256 581ad387a8409c62850371226a3b65ad4135ee1920cb69faafcd2a9a21c481f2
MD5 d954256650652e0e0ba55fa6138c19db
BLAKE2b-256 4f06b62ff71901f0955b26cf9297bf23196dd6ff94c609f4c9369e68c1401e46

See more details on using hashes here.

File details

Details for the file easy_rag_llm-1.0.13-py3-none-any.whl.

File metadata

  • Download URL: easy_rag_llm-1.0.13-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.4

File hashes

Hashes for easy_rag_llm-1.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 780959798b979eef90d245e1e956360758469e19544d913d611253b7f6a0eb74
MD5 3d1c11a61f33e1e7de597d811bde0961
BLAKE2b-256 97b20f37710fd36e9e0f1755a618b34d5141535a12e1cf0de1449db8858d0ae4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page