- Notifications
You must be signed in to change notification settings - Fork48
Pebblo enables developers to safely load data and promote their Gen AI app to deployment
License
daxa-ai/pebblo
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Pebblo enables developers to safely load data and promote their Gen AI app to deployment without worrying about the organization’s compliance and security requirements. The project identifies semantic topics and entities found in the loaded data and summarizes them on the UI or a PDF report.
Pebblo has these components.
- Pebblo Server - a REST api application with topic-classifier, entity-classifier and reporting features
- Pebblo SafeLoader - a thin wrapper to Gen-AI framework's data loaders
- Pebblo SafeRetriever - a retrieval QA chain that enforces identity and semantic rules on Vector database retrieval before LLM inference
pip install pebblo --extra-index-url https://packages.daxa.ai/simple/
Alternatively, download and install the latest Pebblo python.whl
package from URLhttps://packages.daxa.ai/pebblo/0.1.13/pebblo-0.1.13-py3-none-any.whl
Example:
curl -LO"https://packages.daxa.ai/pebblo/0.1.13/pebblo-0.1.13-py3-none-any.whl" pip install pebblo-0.1.13-py3-none-any.whl
pebblo
Pebblo Server now listens tolocalhost:8000
to accept Gen-AI application data snippets for inspection and reporting.
--config <file>
: specify a configuration file in yaml format.
Seeconfiguration guide for knobs to control Pebblo Server behavior like enabling snippet anonymization, selecting specific report renderer, etc.
docker run -p 8000:8000 docker.daxa.ai/daxaai/pebblo
Local UI can be accessed by pointing the browser tohttps://localhost:8000
.
Seeinstallation guide for details on how to pass custom config.yaml and accessing PDF reports in the host machine.
Refer totroubleshooting guide.
Pebblo SafeLoader
is natively supported in Langchain framework. It is available in Langchain versions>=0.1.7
AddPebbloSafeLoader
wrapper to the existing Langchain document loader(s) used in the RAG application.PebbloSafeLoader
is interface compatible with LangchainBaseLoader
. The application can continue to useload()
andlazy_load()
methods as it would on a Langchain document loader.
Here is the snippet of Langchain RAG application usingCSVLoader
before enablingPebbloSafeLoader
.
fromlangchain_community.document_loadersimportCSVLoaderloader=CSVLoader(file_path)documents=loader.load()vectordb=Chroma.from_documents(documents,OpenAIEmbeddings())
The Pebblo SafeLoader can be enabled with few lines of code change to the above snippet.
fromlangchain_community.document_loadersimportCSVLoaderfromlangchain_community.document_loaders.pebbloimportPebbloSafeLoaderloader=PebbloSafeLoader(CSVLoader(file_path),name="acme-corp-rag-1",# App name (Mandatory)owner="Joe Smith",# Owner (Optional)description="Support productivity RAG application",# Description (Optional) )documents=loader.load()vectordb=Chroma.from_documents(documents,OpenAIEmbeddings())
Seehere for samples with Pebblo SafeLoader enabled RAG applications andthis document for more details.
PebbloRetrievalQA chain uses a SafeRetrieval to enforce that the snippets used for in-context are retrievedonly from the documents authorized for the user and semantically allowed for the Gen-AI application.
Here is a sample code for the PebbloRetrievalQA withauthorized_identities
from the user accessing the RAGapplication, passed inauth_context
.
fromlangchain_community.chainsimportPebbloRetrievalQAfromlangchain_community.chains.pebblo_retrieval.modelsimportAuthContext,ChainInputsafe_rag_chain=PebbloRetrievalQA.from_chain_type(llm=llm,app_name="pebblo-safe-retriever-demo",owner="Joe Smith",description="Safe RAG demo using Pebblo",chain_type="stuff",retriever=vectordb.as_retriever(),verbose=True,)defask(question:str,auth_context:dict):auth_context_obj=AuthContext(**auth_context)chain_input_obj=ChainInput(query=question,auth_context=auth_context_obj)returnsafe_rag_chain.invoke(chain_input_obj.dict())
Seehere for samples with Pebblo SafeRetriever enabled RAG applications andthis document for more details.
Pebblo is a open-source community project. If you want to contribute seeContributor Guidelines for more details.
Pebblo is released under the MIT License
About
Pebblo enables developers to safely load data and promote their Gen AI app to deployment