RAG doc search
Overview
This package offers a lightweight and straightforward solution for implementing Retrieval-augmented generation (RAG) functionality with large language models (LLMs). RAG enhances prediction quality by incorporating external data storage during inference, enabling the construction of more contextually rich prompts. Leveraging combinations of context, history, and up-to-date knowledge, RAG LLMs empower users to generate more accurate and relevant responses. This package streamlines the integration of RAG capabilities into applications, facilitating the creation of more intelligent and context-aware conversational agents, search engines, and text generation systems.
Config Json
{
"ai_provider": "OPENAI" | "BEDROCK" | "AZURE_OPENAI",
"embeddings_model": "<embedding model of openai or bedrock or azure openai as per ai_provider>",
"llm": "<llm model of openai or bedrock as per ai_provider>",
"llm_temperature": "<llm model of temperature>",
"llm_max_output_tokens": "<llm model of mac output token>",
"vector_store_provider": "FAISS" | "PGVector",
"faiss_vector_embeddings_location": "./data", provide only if vector_store_provider is FAISS
"faiss_index_name": "fiass-db", provide only if vector_store_provider is FAISS
"name": "<name of your project>",
"retriever": {
use this link [https://python.langchain.com/docs/modules/data_connection/retrievers/vectorstore] for understanding retriver searchtype and search_args
"search_type": "similarity" | "mmr" | "similarity_score_threshold" ,
"search_args": {
"k": 10,
"fetch_k": 500,
"lambda_mult": 0.1
"score_threshold" : 0.1
}
}
}
Note
Ensure that the necessary environment variables are set before initializing the configuration.
- If AI Provider is
OPENAIthen ENVOPENAI_API_KEYis required. - If AI Provider is
BEDROCKthen ENVAWS_ACCESS_KEY,AWS_SECRET_ACCESS_KEYare required and AWS_REGION is optional, default is 'us-east-1'. - If Vector Store Provider is
PGVectorthenPGVECTOR_HOST,PGVECTOR_PORT,PGVECTOR_DATABASE,PGVECTOR_USERandPGVECTOR_PASSWORDare required
How to Use
from rag_doc_search import config_init, get_bot_instance
from rag_doc_search.utils.config import Config
from rag_doc_search.src.enums.provider import AIProvider
# provide your config JSON in init config_init method below also set the required ENV as mentioned in Note
config = config_init({})
# Method a bot instance as per AI provider it will give you the bot model for BedRock or for OpenAI
bot_instance = get_bot_instance(config.ai_provider)
qa_instance = bot_model.create_qa_instance()
result = qa_instance.invoke(input="Provide your prompt here")
print(result)
Examples
To understand how to use the package, refer to the following examples:
-
To create an API that answers your questions, use the example provided here.
-
To create a WebSocket API for streaming answers to your questions, use the example provided here.
Metadata
Release files for rag-doc-search 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rag_doc_search-0.1.9.tar.gz | 11.7 kB | Without provenance | Details for rag_doc_search-0.1.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rag_doc_search-0.1.9-py3-none-any.whl | Python 3 | none | any | Details for rag_doc_search-0.1.9-py3-none-any.whl |
Total release size: 28.9 kB
Release files / rag_doc_search-0.1.9.tar.gz
| Download URL | rag_doc_search-0.1.9.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0984fb7255890c437981dbe291e0e44f93a44352c5549b8900f9214bbb0e0b7c
|
|
BLAKE2b-256 checksum How to use checksums |
c1b9b4d6ebd51601d60bbfefe01cb62ec802b3324b095982d7362ce7a2b12774
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.10.10 Darwin/23.5.0
|
Release files / rag_doc_search-0.1.9-py3-none-any.whl
| Download URL | rag_doc_search-0.1.9-py3-none-any.whl |
|---|---|
| Size | 17.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5bce5641282548204c578c27cc58ed6bbe9dad0481c3ce2071850d9f0138ce6c
|
|
BLAKE2b-256 checksum How to use checksums |
d3e7715a87e64945910ef00de3982fa2323b326e5b78e46b1ec1dd422b06fd75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.10.10 Darwin/23.5.0
|
Security for rag-doc-search 0.1.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.