# RAG Core
<p align="center">
<a href="https://www.python.org/downloads/release/python-310/"><img src="https://img.shields.io/badge/python-3.10-green.svg" alt="Python 3.10"></a>
<a href="https://www.python.org/downloads/release/python-311/"><img src="https://img.shields.io/badge/python-3.11-green.svg" alt="Python 3.11"></a>
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License: MIT"></a>
<a href="https://pypi.org/project/ragcore"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/ragcore?color=blue"></a>
<img src="https://github.com/daved01/ragcore/actions/workflows/code-check-main.yml/badge.svg" alt="GitHub CI">
</p>
A Retrieval-Augmented Generation library with a CLI interface. Build RAG applications with just a few commands and a configuration file.
## Supported setups
| Databases | LLMs | Embeddings | Document types |
| ----------------------- | -------------- | -------------- | --------------- |
| Chroma (local) | OpenAI | OpenAI | PDF |
| Pinecone (remote) | AzureOpenAI | AzureOpenAI | |
For more details see the [documentation](https://daved01.github.io/ragcore/).
# Installation
To install, run
```bash
pip install ragcore
```
or clone and build from source
```bash
git clone https://github.com/daved01/ragcore.git
cd ragcore
pip install .
```
If everything worked, running
```bash
ragcore -h
```
should show you some information about `ragcore`.
# A Simple Example
To build an application with OpenAI or AzureOpenAI LLMs and embeddings, and a local database, first set your OpenAI [API key](https://platform.openai.com/api-keys) as described [here](https://platform.openai.com/docs/quickstart/step-2-setup-your-api-key):
```bash
export OPENAI_API_KEY=[your token]
```
Then, create a config file `config.yaml` like this in the root of your project:
```bash
database:
provider: "chroma"
number_search_results: 5
base_dir: "data/database"
splitter:
chunk_overlap: 256
chunk_size: 1024
embedding:
provider: "openai"
model: "text-embedding-model"
llm:
provider: "openai"
model: "gpt-model"
```
And finally, create your application using this config file:
```python
from ragcore import RAGCore
app = RAGCore() # pass config=<path-to-config.yaml> if not in root
# Upload a document "My_Book.pdf"
app.add(path="My_Book.pdf")
# Now you can ask questions
answer = app.query(query="What did the elk say?")
print(answer.content)
# List the document's title and content on which the response is based
for doc in answer.documents:
print(doc.title, " | ", doc.content)
# List all documents in the database
print(app.get_titles())
# You can delete by title
app.delete(title="My_Book")
```
And that's it! For more information, as well as an overview of supported integrations check out the [documentation](https://daved01.github.io/ragcore/).
Raw data
{
"_id": null,
"home_page": "https://github.com/daved01/ragcore",
"name": "ragcore",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10, <4",
"maintainer_email": "",
"keywords": "retrieval augmented generation,rag,development,artificial intelligence,large language models",
"author": "David Kirchhoff",
"author_email": "david.kirchhoff@mail.utoronto.ca",
"download_url": "https://files.pythonhosted.org/packages/d6/16/08ae9b684712b610fd7b5351059a5a08a05d91b3c1871f6f64b139a03724/ragcore-1.0.3.tar.gz",
"platform": null,
"description": "# RAG Core\n\n<p align=\"center\">\n <a href=\"https://www.python.org/downloads/release/python-310/\"><img src=\"https://img.shields.io/badge/python-3.10-green.svg\" alt=\"Python 3.10\"></a>\n <a href=\"https://www.python.org/downloads/release/python-311/\"><img src=\"https://img.shields.io/badge/python-3.11-green.svg\" alt=\"Python 3.11\"></a>\n <a href=\"https://opensource.org/licenses/MIT\"><img src=\"https://img.shields.io/badge/License-MIT-green.svg\" alt=\"License: MIT\"></a>\n <a href=\"https://pypi.org/project/ragcore\"><img alt=\"PyPI - Version\" src=\"https://img.shields.io/pypi/v/ragcore?color=blue\"></a>\n <img src=\"https://github.com/daved01/ragcore/actions/workflows/code-check-main.yml/badge.svg\" alt=\"GitHub CI\">\n</p>\n\nA Retrieval-Augmented Generation library with a CLI interface. Build RAG applications with just a few commands and a configuration file.\n\n## Supported setups\n\n| Databases | LLMs | Embeddings | Document types |\n| ----------------------- | -------------- | -------------- | --------------- |\n| Chroma (local) | OpenAI | OpenAI | PDF |\n| Pinecone (remote) | AzureOpenAI | AzureOpenAI | |\n\nFor more details see the [documentation](https://daved01.github.io/ragcore/).\n\n# Installation\n\nTo install, run\n\n```bash\npip install ragcore\n```\n\nor clone and build from source\n\n```bash\ngit clone https://github.com/daved01/ragcore.git\ncd ragcore\npip install .\n```\n\nIf everything worked, running\n\n```bash\nragcore -h\n```\n\nshould show you some information about `ragcore`.\n\n# A Simple Example\n\nTo build an application with OpenAI or AzureOpenAI LLMs and embeddings, and a local database, first set your OpenAI [API key](https://platform.openai.com/api-keys) as described [here](https://platform.openai.com/docs/quickstart/step-2-setup-your-api-key):\n\n```bash\nexport OPENAI_API_KEY=[your token]\n```\n\nThen, create a config file `config.yaml` like this in the root of your project:\n\n```bash\ndatabase:\n provider: \"chroma\"\n number_search_results: 5\n base_dir: \"data/database\"\n\nsplitter:\n chunk_overlap: 256\n chunk_size: 1024\n\nembedding:\n provider: \"openai\"\n model: \"text-embedding-model\"\n\nllm:\n provider: \"openai\"\n model: \"gpt-model\"\n\n```\n\nAnd finally, create your application using this config file:\n\n```python\nfrom ragcore import RAGCore\n\n\napp = RAGCore() # pass config=<path-to-config.yaml> if not in root\n\n# Upload a document \"My_Book.pdf\"\napp.add(path=\"My_Book.pdf\")\n\n# Now you can ask questions\nanswer = app.query(query=\"What did the elk say?\")\n\nprint(answer.content)\n\n# List the document's title and content on which the response is based\nfor doc in answer.documents:\n print(doc.title, \" | \", doc.content)\n\n# List all documents in the database\nprint(app.get_titles())\n\n# You can delete by title\napp.delete(title=\"My_Book\")\n```\n\nAnd that's it! For more information, as well as an overview of supported integrations check out the [documentation](https://daved01.github.io/ragcore/).\n",
"bugtrack_url": null,
"license": "",
"summary": "A library to build Retrieval-Augmented Generation applications with only a few lines of code.",
"version": "1.0.3",
"project_urls": {
"Bug Reports": "https://github.com/daved01/ragcore/issues",
"Documentation": "https://daved01.github.io/ragcore/",
"Funding": "https://github.com/sponsors/daved01",
"Homepage": "https://github.com/daved01/ragcore",
"Say Thanks!": "https://www.paypal.com/donate/?hosted_button_id=JH7HXP6VE5U3S",
"Source": "https://github.com/daved01/ragcore"
},
"split_keywords": [
"retrieval augmented generation",
"rag",
"development",
"artificial intelligence",
"large language models"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e4f6cb98e56b4e56359539202f11f80f4056375a7b3de591a937dd3876754c63",
"md5": "7e51d69d4577deb8d39e8726fd31f083",
"sha256": "0198d71689d112ca8b6a3bb01ab1a22b314ac05b3169a3939333fa0380c24b67"
},
"downloads": -1,
"filename": "ragcore-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7e51d69d4577deb8d39e8726fd31f083",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10, <4",
"size": 30413,
"upload_time": "2024-03-02T12:16:32",
"upload_time_iso_8601": "2024-03-02T12:16:32.393498Z",
"url": "https://files.pythonhosted.org/packages/e4/f6/cb98e56b4e56359539202f11f80f4056375a7b3de591a937dd3876754c63/ragcore-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d61608ae9b684712b610fd7b5351059a5a08a05d91b3c1871f6f64b139a03724",
"md5": "a2cdca5b4acff33e32ff292bfdc18a75",
"sha256": "1b8a4b376bf7c551890e5db2895b839d4da13d6a10ced6704b676c6c4abbbc5e"
},
"downloads": -1,
"filename": "ragcore-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "a2cdca5b4acff33e32ff292bfdc18a75",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10, <4",
"size": 24476,
"upload_time": "2024-03-02T12:16:34",
"upload_time_iso_8601": "2024-03-02T12:16:34.199779Z",
"url": "https://files.pythonhosted.org/packages/d6/16/08ae9b684712b610fd7b5351059a5a08a05d91b3c1871f6f64b139a03724/ragcore-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-02 12:16:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "daved01",
"github_project": "ragcore",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "ragcore"
}