PyRAG
A library that makes it easy to get started with RAG applications with SingleStore.
Installetion
To install the package run:
pip install pyrag
Usage Example
1. Import the PyRAG class from the pyrag package
from pyrag import PyRAG
2. Create a PyRAG instance
pyrag = PyRAG(
connection_url='DB_CONNECTION_URL',
embedding_model_name='text-embedding-3-small',
openai_api_key='OPENAI_API_KEY',
)
Note, you can also use HugginFace models. In this case you need to provide a huggingfacehub_api_token.
3. Provide a knowledge source in the form of a URL or S3 bucket
Supported file types: csv, json, txt, pdf
URL Knowledge Source
pyrag.files.url.sync_file(url="URL", table_name='TABLE_NAME')
S3 Bucket Knowledge Source
pyrag.files.s3(
access_key_id='AWS_ACCESS_KEY_ID',
secret_access_key='AWS_SECRET_ACCESS_KEY',
bucket_name='AWS_BUCKET_NAME',
).sync_files(
# This parameter is optional. If you want to use all files from the s3 bucket, remove this parameter.
allowed_files=['file_name_1', 'file_name_2', 'file_name_3'],
# This parameter is optional. Use it if you want to rename the table. By default, the table serializes the file name.
table_names={'file_name_1': 'file_name_1'}
4. Create a chat instance and chat session
chat = pyrag.chat.create(
id=1,
model_name='gpt-3.5-turbo',
knowledge_sources=[{'table': 'file_name_1'}],
store=True,
store_messages_history=True
)
chat_session = chat.create_session(id=1)
5. Use the chat instance
response = chat_session.send('PROMPT')
print(response)
Find more usage examples here
Metadata
Release files for PyRAG 0.0.4
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 |
|---|---|---|---|---|
| PyRAG-0.0.4.tar.gz | 16.2 kB | Without provenance | Details for PyRAG-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| PyRAG-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for PyRAG-0.0.4-py3-none-any.whl |
Total release size: 39.0 kB
Release files / PyRAG-0.0.4.tar.gz
| Download URL | PyRAG-0.0.4.tar.gz |
|---|---|
| Size | 16.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2deb821fc0113cbe4ca4fe7bcd5cdb378b15529bea51faa0728ce75feffd5517
|
|
BLAKE2b-256 checksum How to use checksums |
de37095c34b5cd3a82bc0ebfb1552141b9e210892cf9a7eb3e5ba01839f905eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.1
|
Release files / PyRAG-0.0.4-py3-none-any.whl
| Download URL | PyRAG-0.0.4-py3-none-any.whl |
|---|---|
| Size | 22.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
56077351c046963ef3f3843c5d0be8d24869d564f2242994c5ea6f96dcc5add7
|
|
BLAKE2b-256 checksum How to use checksums |
446e67ae49c242844f6aa1efee8e8fd7459b8592cc5de8dc97310eb8af0846f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.1
|
Security for PyRAG 0.0.4
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.