Skip to content

Commit

Permalink
move database to REST API (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeier authored Oct 13, 2023
1 parent e851297 commit 9a4e374
Show file tree
Hide file tree
Showing 26 changed files with 929 additions and 1,024 deletions.
7 changes: 4 additions & 3 deletions examples/local_llm/local_llm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
"output_type": "stream",
"text": [
"User: What is Ragna?\n",
"Assistant: Ragna is an open-source application (OSS) for RAG workflows. It offers a Python and REST API as well as a web UI.\n"
"Assistant: Ragna is an OSS app for RAG workflows that offers a Python and REST API as well as web UI.\n"
]
}
],
Expand All @@ -143,13 +143,14 @@
" \"Ragna is an OSS app for RAG workflows that offers a Python and REST API as well as web UI\\n\"\n",
" )\n",
"\n",
"async with await rag.new_chat(\n",
"async with rag.chat(\n",
" documents=[path],\n",
" source_storage=RagnaDemoSourceStorage,\n",
" assistant=AiroborosAssistant,\n",
") as chat:\n",
" prompt = \"What is Ragna?\"\n",
" answer = await chat.answer(prompt)\n",
" message = await chat.answer(prompt)\n",
" answer = message.content\n",
"\n",
"print(f\"User: {prompt}\")\n",
"print(f\"Assistant: {answer}\")"
Expand Down
61 changes: 39 additions & 22 deletions examples/python_api/python_api.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
{
"data": {
"text/plain": [
"Config(local_cache_root=PosixPath('/home/philip/.cache/ragna'), state_database_url='sqlite://', queue_database_url='memory', ragna_api_url='http://127.0.0.1:31476', ragna_ui_url='http://127.0.0.1:31477', document_class=<class 'ragna.core.LocalDocument'>, upload_token_secret='a9e79b896f90c136820e70ced28f30e6cbbaca6d19f52e41c35b154df21a657a', upload_token_ttl=30, registered_source_storage_classes={'Ragna/DemoSourceStorage': <class 'ragna.source_storage._demo.RagnaDemoSourceStorage'>}, registered_assistant_classes={'Ragna/DemoAssistant': <class 'ragna.assistant._demo.RagnaDemoAssistant'>})"
"Config(local_cache_root=PosixPath('/home/philip/.cache/ragna'), state_database_url='sqlite://', queue_database_url='memory', ragna_api_url='http://127.0.0.1:31476', ragna_ui_url='http://127.0.0.1:31477', document_class=<class 'ragna.core.LocalDocument'>, upload_token_secret='9ffa4b72f96f221953a455df1642304af954a0afa7d147ae96cc1aa62a89ed02', upload_token_ttl=30, registered_source_storage_classes={'Ragna/DemoSourceStorage': <class 'ragna.source_storage._demo.RagnaDemoSourceStorage'>}, registered_assistant_classes={'Ragna/DemoAssistant': <class 'ragna.assistant._demo.RagnaDemoAssistant'>})"
]
},
"execution_count": 3,
Expand Down Expand Up @@ -106,7 +106,7 @@
"\n",
"rag = Rag(demo_config)\n",
"\n",
"async with await rag.new_chat(\n",
"async with rag.chat(\n",
" documents=[document_path],\n",
" source_storage=RagnaDemoSourceStorage,\n",
" assistant=RagnaDemoAssistant,\n",
Expand All @@ -127,10 +127,10 @@
"name": "stdout",
"output_type": "stream",
"text": [
"{('Chroma', 'OpenAI/gpt-3.5-turbo-16k'): <coroutine object answer_prompt at 0x7fc40c89c640>,\n",
" ('Chroma', 'OpenAI/gpt-4'): <coroutine object answer_prompt at 0x7fc40c77f4c0>,\n",
" ('LanceDB', 'OpenAI/gpt-3.5-turbo-16k'): <coroutine object answer_prompt at 0x7fc40c77f840>,\n",
" ('LanceDB', 'OpenAI/gpt-4'): <coroutine object answer_prompt at 0x7fc40c77f9c0>}\n"
"{('Chroma', 'OpenAI/gpt-3.5-turbo-16k'): <coroutine object answer_prompt at 0x7fa6a15e48c0>,\n",
" ('Chroma', 'OpenAI/gpt-4'): <coroutine object answer_prompt at 0x7fa6a15e4b40>,\n",
" ('LanceDB', 'OpenAI/gpt-3.5-turbo-16k'): <coroutine object answer_prompt at 0x7fa6a15e4bc0>,\n",
" ('LanceDB', 'OpenAI/gpt-4'): <coroutine object answer_prompt at 0x7fa6a15e4c40>}\n"
]
}
],
Expand All @@ -144,13 +144,13 @@
"\n",
"\n",
"async def answer_prompt(source_storage, assistant):\n",
" chat = await rag.new_chat(\n",
" async with rag.chat(\n",
" documents=[document_path],\n",
" source_storage=source_storage,\n",
" assistant=assistant,\n",
" )\n",
" await chat.start()\n",
" return await chat.answer(prompt)\n",
" ) as chat:\n",
" message = await chat.answer(prompt)\n",
" return message.content\n",
"\n",
"\n",
"experiments = {\n",
Expand All @@ -177,18 +177,35 @@
"To disable this warning, you can either:\n",
"\t- Avoid using `tokenizers` before the fork if possible\n",
"\t- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)\n",
"huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...\n",
"To disable this warning, you can either:\n",
"\t- Avoid using `tokenizers` before the fork if possible\n",
"\t- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)\n",
"huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...\n",
"To disable this warning, you can either:\n",
"\t- Avoid using `tokenizers` before the fork if possible\n",
"\t- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)\n",
"{('Chroma', 'OpenAI/gpt-3.5-turbo-16k'): Ragna is an open-source RAG (Response Analysis Graph) orchestration app. It is designed to help users create conversational AI applications by providing a framework for managing and orchestrating the flow of conversations. Ragna allows developers to define conversation flows, handle user inputs, and generate dynamic responses based on predefined rules and logic. It is built on top of the Rasa framework and provides additional features and functionalities to simplify the development process.,\n",
" ('Chroma', 'OpenAI/gpt-4'): Ragna is an open-source RAG orchestration app.,\n",
" ('LanceDB', 'OpenAI/gpt-3.5-turbo-16k'): Ragna is an open-source rag orchestration app. It is a software application that allows users to create and arrange musical compositions using ragtime music. It is designed to be accessible and customizable for musicians and composers.,\n",
" ('LanceDB', 'OpenAI/gpt-4'): Ragna is an open-source rag orchestration app.}\n"
"{('Chroma', 'OpenAI/gpt-3.5-turbo-16k'): 'Ragna is an open-source RAG '\n",
" '(Response Analysis Graph) '\n",
" 'orchestration app. It is designed to '\n",
" 'help users create conversational AI '\n",
" 'applications by providing a '\n",
" 'framework for managing and '\n",
" 'orchestrating the flow of '\n",
" 'conversations. Ragna allows '\n",
" 'developers to define conversation '\n",
" 'flows, handle user inputs, and '\n",
" 'generate dynamic responses based on '\n",
" 'predefined rules and logic. It is '\n",
" 'built on top of the Rasa framework '\n",
" 'and provides additional features and '\n",
" 'functionalities to simplify the '\n",
" 'development process.',\n",
" ('Chroma', 'OpenAI/gpt-4'): 'Ragna is an open-source RAG orchestration app. '\n",
" 'Unfortunately, without additional context or '\n",
" \"sources, I can't provide more detailed \"\n",
" 'information about it.',\n",
" ('LanceDB', 'OpenAI/gpt-3.5-turbo-16k'): 'Ragna is an open-source rag '\n",
" 'orchestration app. It is a software '\n",
" 'application that allows users to '\n",
" 'create and arrange musical '\n",
" 'compositions using ragtime music. '\n",
" 'It is designed to be accessible and '\n",
" 'customizable for musicians and '\n",
" 'composers.',\n",
" ('LanceDB', 'OpenAI/gpt-4'): 'Ragna is an open-source rag orchestration app.'}\n"
]
}
],
Expand Down
Loading

0 comments on commit 9a4e374

Please sign in to comment.