Skip to content

Commit

Permalink
fix component loading (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeier authored Oct 10, 2023
1 parent dede905 commit 2970082
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 131 deletions.
2 changes: 1 addition & 1 deletion 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 OSS app for RAG workflows that offers a Python and REST API as well as web UI.\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"
]
}
],
Expand Down
22 changes: 17 additions & 5 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='d9d5c32fcb2d4f3a3a36cb5d95c8147ab2e9c664ad2a3976f3e2eb9ef80b53c9', 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='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'>})"
]
},
"execution_count": 3,
Expand Down Expand Up @@ -127,10 +127,10 @@
"name": "stdout",
"output_type": "stream",
"text": [
"{('Chroma', 'OpenAI/gpt-3.5-turbo-16k'): <coroutine object answer_prompt at 0x7f690f91d640>,\n",
" ('Chroma', 'OpenAI/gpt-4'): <coroutine object answer_prompt at 0x7f690f7c04c0>,\n",
" ('LanceDB', 'OpenAI/gpt-3.5-turbo-16k'): <coroutine object answer_prompt at 0x7f690f7c0840>,\n",
" ('LanceDB', 'OpenAI/gpt-4'): <coroutine object answer_prompt at 0x7f690f7c09c0>}\n"
"{('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"
]
}
],
Expand Down Expand Up @@ -173,6 +173,18 @@
"name": "stdout",
"output_type": "stream",
"text": [
"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",
"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",
Expand Down
106 changes: 53 additions & 53 deletions examples/rest_api/rest_api.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"INFO: 127.0.0.1:42394 - \"GET /health HTTP/1.1\" 200 OK\n"
"INFO: 127.0.0.1:60998 - \"GET /health HTTP/1.1\" 200 OK\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: Started server process [39690]\n",
"INFO: Started server process [32153]\n",
"INFO: Waiting for application startup.\n",
"INFO: Application startup complete.\n",
"INFO: Uvicorn running on http://127.0.0.1:31476 (Press CTRL+C to quit)\n"
Expand Down Expand Up @@ -137,7 +137,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"INFO: 127.0.0.1:42394 - \"GET /chats?user=Ragna HTTP/1.1\" 200 OK\n",
"INFO: 127.0.0.1:60998 - \"GET /chats?user=Ragna HTTP/1.1\" 200 OK\n",
"[]\n"
]
}
Expand Down Expand Up @@ -167,7 +167,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"INFO: 127.0.0.1:42394 - \"GET /components?user=Ragna HTTP/1.1\" 200 OK\n",
"INFO: 127.0.0.1:60998 - \"GET /components?user=Ragna HTTP/1.1\" 200 OK\n",
"{'assistants': ['Ragna/DemoAssistant'],\n",
" 'source_storages': ['Ragna/DemoSourceStorage']}\n"
]
Expand Down Expand Up @@ -229,9 +229,9 @@
"name": "stdout",
"output_type": "stream",
"text": [
"INFO: 127.0.0.1:42394 - \"GET /document?user=Ragna&name=document0.txt HTTP/1.1\" 200 OK\n",
"{'data': {'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiUmFnbmEiLCJpZCI6ImRiZjdiOWE2LWEzMGItNGEyNS1iNGJhLTE3ODIwNjNhYzJhZiIsImV4cCI6MTY5NjQ1NTg2MS40MjkwMjE0fQ.gjMsP0qZ36hO9fAOFPxeKom-oYsyIyxggG82oP0svoc'},\n",
" 'document': {'id': 'dbf7b9a6-a30b-4a25-b4ba-1782063ac2af',\n",
"INFO: 127.0.0.1:60998 - \"GET /document?user=Ragna&name=document0.txt HTTP/1.1\" 200 OK\n",
"{'data': {'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiUmFnbmEiLCJpZCI6ImRlNWJiYjMxLTQ1MDEtNDFhNC05ZDRlLTFiN2EzNjk1Mjk5NSIsImV4cCI6MTY5Njg3Nzk1OS40NTE3NzcyfQ.XC7qKuCZXkbrI7isQ39IqYZMCL_O6oVP4GfI8wqHpdE'},\n",
" 'document': {'id': 'de5bbb31-4501-41a4-9d4e-1b7a36952995',\n",
" 'name': 'document0.txt'},\n",
" 'url': 'http://127.0.0.1:31476/document'}\n"
]
Expand Down Expand Up @@ -264,7 +264,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"INFO: 127.0.0.1:42394 - \"POST /document HTTP/1.1\" 200 OK\n"
"INFO: 127.0.0.1:60998 - \"POST /document HTTP/1.1\" 200 OK\n"
]
}
],
Expand Down Expand Up @@ -295,18 +295,18 @@
"name": "stdout",
"output_type": "stream",
"text": [
"INFO: 127.0.0.1:42394 - \"GET /document?user=Ragna&name=document1.txt HTTP/1.1\" 200 OK\n",
"INFO: 127.0.0.1:42394 - \"POST /document HTTP/1.1\" 200 OK\n",
"INFO: 127.0.0.1:42394 - \"GET /document?user=Ragna&name=document2.txt HTTP/1.1\" 200 OK\n",
"INFO: 127.0.0.1:42394 - \"POST /document HTTP/1.1\" 200 OK\n"
"INFO: 127.0.0.1:60998 - \"GET /document?user=Ragna&name=document1.txt HTTP/1.1\" 200 OK\n",
"INFO: 127.0.0.1:60998 - \"POST /document HTTP/1.1\" 200 OK\n",
"INFO: 127.0.0.1:60998 - \"GET /document?user=Ragna&name=document2.txt HTTP/1.1\" 200 OK\n",
"INFO: 127.0.0.1:60998 - \"POST /document HTTP/1.1\" 200 OK\n"
]
},
{
"data": {
"text/plain": [
"[{'id': 'dbf7b9a6-a30b-4a25-b4ba-1782063ac2af', 'name': 'document0.txt'},\n",
" {'id': '5c54ded3-67ae-4dd4-8829-190e09b2f3e3', 'name': 'document1.txt'},\n",
" {'id': '1ae72430-bde4-42a3-b623-4aadd234bc04', 'name': 'document2.txt'}]"
"[{'id': 'de5bbb31-4501-41a4-9d4e-1b7a36952995', 'name': 'document0.txt'},\n",
" {'id': '8e5e17b4-e6e3-4707-806a-917f0f5b46fb', 'name': 'document1.txt'},\n",
" {'id': '336436fa-1b6a-4a29-8821-791cd682a7cb', 'name': 'document2.txt'}]"
]
},
"execution_count": 9,
Expand Down Expand Up @@ -349,16 +349,16 @@
"name": "stdout",
"output_type": "stream",
"text": [
"INFO: 127.0.0.1:42394 - \"POST /chats?user=Ragna HTTP/1.1\" 200 OK\n",
"INFO: 127.0.0.1:60998 - \"POST /chats?user=Ragna HTTP/1.1\" 200 OK\n",
"{'closed': False,\n",
" 'id': 'f68e3999-444c-4a92-8d25-0f80dd3b2219',\n",
" 'id': '0777396d-9993-47ce-b807-2e9c48364c63',\n",
" 'messages': [],\n",
" 'metadata': {'assistant': 'Ragna/DemoAssistant',\n",
" 'documents': [{'id': 'dbf7b9a6-a30b-4a25-b4ba-1782063ac2af',\n",
" 'documents': [{'id': 'de5bbb31-4501-41a4-9d4e-1b7a36952995',\n",
" 'name': 'document0.txt'},\n",
" {'id': '5c54ded3-67ae-4dd4-8829-190e09b2f3e3',\n",
" {'id': '8e5e17b4-e6e3-4707-806a-917f0f5b46fb',\n",
" 'name': 'document1.txt'},\n",
" {'id': '1ae72430-bde4-42a3-b623-4aadd234bc04',\n",
" {'id': '336436fa-1b6a-4a29-8821-791cd682a7cb',\n",
" 'name': 'document2.txt'}],\n",
" 'name': 'Ragna REST API example',\n",
" 'params': {},\n",
Expand Down Expand Up @@ -401,20 +401,20 @@
"name": "stdout",
"output_type": "stream",
"text": [
"INFO: 127.0.0.1:42394 - \"POST /chats/f68e3999-444c-4a92-8d25-0f80dd3b2219/start?user=Ragna HTTP/1.1\" 200 OK\n",
"INFO: 127.0.0.1:60998 - \"POST /chats/0777396d-9993-47ce-b807-2e9c48364c63/start?user=Ragna HTTP/1.1\" 200 OK\n",
"{'closed': False,\n",
" 'id': 'f68e3999-444c-4a92-8d25-0f80dd3b2219',\n",
" 'id': '0777396d-9993-47ce-b807-2e9c48364c63',\n",
" 'messages': [{'content': 'How can I help you with the documents?',\n",
" 'id': '09df1d1c-3c8f-4d42-ad68-fa8a4d833d85',\n",
" 'id': 'f9b43a27-67ac-4984-9deb-3844ff4a6ea1',\n",
" 'role': 'system',\n",
" 'sources': [],\n",
" 'timestamp': '2023-10-04T21:43:51.941124'}],\n",
" 'timestamp': '2023-10-09T18:58:50.356957'}],\n",
" 'metadata': {'assistant': 'Ragna/DemoAssistant',\n",
" 'documents': [{'id': '1ae72430-bde4-42a3-b623-4aadd234bc04',\n",
" 'documents': [{'id': '336436fa-1b6a-4a29-8821-791cd682a7cb',\n",
" 'name': 'document2.txt'},\n",
" {'id': '5c54ded3-67ae-4dd4-8829-190e09b2f3e3',\n",
" {'id': '8e5e17b4-e6e3-4707-806a-917f0f5b46fb',\n",
" 'name': 'document1.txt'},\n",
" {'id': 'dbf7b9a6-a30b-4a25-b4ba-1782063ac2af',\n",
" {'id': 'de5bbb31-4501-41a4-9d4e-1b7a36952995',\n",
" 'name': 'document0.txt'}],\n",
" 'name': 'Ragna REST API example',\n",
" 'params': {},\n",
Expand Down Expand Up @@ -449,7 +449,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"INFO: 127.0.0.1:42394 - \"POST /chats/f68e3999-444c-4a92-8d25-0f80dd3b2219/answer?user=Ragna&prompt=What%20is%20Ragna%3F HTTP/1.1\" 200 OK\n",
"INFO: 127.0.0.1:60998 - \"POST /chats/0777396d-9993-47ce-b807-2e9c48364c63/answer?user=Ragna&prompt=What%20is%20Ragna%3F HTTP/1.1\" 200 OK\n",
"{'content': \"I can't really help you with your prompt:\\n\"\n",
" '\\n'\n",
" '> What is Ragna?\\n'\n",
Expand All @@ -459,21 +459,21 @@
" '- document2.txt: This is content of document 2\\n'\n",
" '- document1.txt: This is content of document 1\\n'\n",
" '- document0.txt: This is content of document 0',\n",
" 'id': '822615fa-c05c-4b03-8d25-60b8687ba568',\n",
" 'id': '00f34df9-5e74-4588-8808-e1e11987db7e',\n",
" 'role': 'assistant',\n",
" 'sources': [{'document': {'id': '1ae72430-bde4-42a3-b623-4aadd234bc04',\n",
" 'sources': [{'document': {'id': '336436fa-1b6a-4a29-8821-791cd682a7cb',\n",
" 'name': 'document2.txt'},\n",
" 'id': '6bfba599-7fdd-4a36-8f43-c1cb552f83eb',\n",
" 'id': 'a07d9305-860b-45c7-9997-bdf47b7dfe58',\n",
" 'location': ''},\n",
" {'document': {'id': '5c54ded3-67ae-4dd4-8829-190e09b2f3e3',\n",
" {'document': {'id': '8e5e17b4-e6e3-4707-806a-917f0f5b46fb',\n",
" 'name': 'document1.txt'},\n",
" 'id': 'e7ebeac9-891b-4867-b35b-62d571a50837',\n",
" 'id': '1fac7064-f8c0-4a85-9e52-06ade4bfff86',\n",
" 'location': ''},\n",
" {'document': {'id': 'dbf7b9a6-a30b-4a25-b4ba-1782063ac2af',\n",
" {'document': {'id': 'de5bbb31-4501-41a4-9d4e-1b7a36952995',\n",
" 'name': 'document0.txt'},\n",
" 'id': '37b9a731-032c-4bd6-9286-3693b1149952',\n",
" 'id': '8e5e94d7-35ab-4426-b369-88e04ef19e80',\n",
" 'location': ''}],\n",
" 'timestamp': '2023-10-04T21:43:51.953583'}\n",
" 'timestamp': '2023-10-09T18:58:50.368654'}\n",
"I can't really help you with your prompt:\n",
"\n",
"> What is Ragna?\n",
Expand Down Expand Up @@ -513,19 +513,19 @@
"name": "stdout",
"output_type": "stream",
"text": [
"INFO: 127.0.0.1:42394 - \"POST /chats/f68e3999-444c-4a92-8d25-0f80dd3b2219/close?user=Ragna HTTP/1.1\" 200 OK\n",
"INFO: 127.0.0.1:60998 - \"POST /chats/0777396d-9993-47ce-b807-2e9c48364c63/close?user=Ragna HTTP/1.1\" 200 OK\n",
"{'closed': True,\n",
" 'id': 'f68e3999-444c-4a92-8d25-0f80dd3b2219',\n",
" 'id': '0777396d-9993-47ce-b807-2e9c48364c63',\n",
" 'messages': [{'content': 'How can I help you with the documents?',\n",
" 'id': '09df1d1c-3c8f-4d42-ad68-fa8a4d833d85',\n",
" 'id': 'f9b43a27-67ac-4984-9deb-3844ff4a6ea1',\n",
" 'role': 'system',\n",
" 'sources': [],\n",
" 'timestamp': '2023-10-04T21:43:51.941124'},\n",
" 'timestamp': '2023-10-09T18:58:50.356957'},\n",
" {'content': 'What is Ragna?',\n",
" 'id': '362e63d9-16d6-4c0e-a3d7-26cab7ddd980',\n",
" 'id': '1d7f401a-556e-4c00-af11-8765c01d1709',\n",
" 'role': 'user',\n",
" 'sources': [],\n",
" 'timestamp': '2023-10-04T21:43:51.951584'},\n",
" 'timestamp': '2023-10-09T18:58:50.366988'},\n",
" {'content': \"I can't really help you with your prompt:\\n\"\n",
" '\\n'\n",
" '> What is Ragna?\\n'\n",
Expand All @@ -536,27 +536,27 @@
" '- document2.txt: This is content of document 2\\n'\n",
" '- document1.txt: This is content of document 1\\n'\n",
" '- document0.txt: This is content of document 0',\n",
" 'id': '822615fa-c05c-4b03-8d25-60b8687ba568',\n",
" 'id': '00f34df9-5e74-4588-8808-e1e11987db7e',\n",
" 'role': 'assistant',\n",
" 'sources': [{'document': {'id': '1ae72430-bde4-42a3-b623-4aadd234bc04',\n",
" 'sources': [{'document': {'id': '336436fa-1b6a-4a29-8821-791cd682a7cb',\n",
" 'name': 'document2.txt'},\n",
" 'id': '6bfba599-7fdd-4a36-8f43-c1cb552f83eb',\n",
" 'id': 'a07d9305-860b-45c7-9997-bdf47b7dfe58',\n",
" 'location': ''},\n",
" {'document': {'id': '5c54ded3-67ae-4dd4-8829-190e09b2f3e3',\n",
" {'document': {'id': '8e5e17b4-e6e3-4707-806a-917f0f5b46fb',\n",
" 'name': 'document1.txt'},\n",
" 'id': 'e7ebeac9-891b-4867-b35b-62d571a50837',\n",
" 'id': '1fac7064-f8c0-4a85-9e52-06ade4bfff86',\n",
" 'location': ''},\n",
" {'document': {'id': 'dbf7b9a6-a30b-4a25-b4ba-1782063ac2af',\n",
" {'document': {'id': 'de5bbb31-4501-41a4-9d4e-1b7a36952995',\n",
" 'name': 'document0.txt'},\n",
" 'id': '37b9a731-032c-4bd6-9286-3693b1149952',\n",
" 'id': '8e5e94d7-35ab-4426-b369-88e04ef19e80',\n",
" 'location': ''}],\n",
" 'timestamp': '2023-10-04T21:43:51.953583'}],\n",
" 'timestamp': '2023-10-09T18:58:50.368654'}],\n",
" 'metadata': {'assistant': 'Ragna/DemoAssistant',\n",
" 'documents': [{'id': '1ae72430-bde4-42a3-b623-4aadd234bc04',\n",
" 'documents': [{'id': '336436fa-1b6a-4a29-8821-791cd682a7cb',\n",
" 'name': 'document2.txt'},\n",
" {'id': '5c54ded3-67ae-4dd4-8829-190e09b2f3e3',\n",
" {'id': '8e5e17b4-e6e3-4707-806a-917f0f5b46fb',\n",
" 'name': 'document1.txt'},\n",
" {'id': 'dbf7b9a6-a30b-4a25-b4ba-1782063ac2af',\n",
" {'id': 'de5bbb31-4501-41a4-9d4e-1b7a36952995',\n",
" 'name': 'document0.txt'}],\n",
" 'name': 'Ragna REST API example',\n",
" 'params': {},\n",
Expand Down
Loading

0 comments on commit 2970082

Please sign in to comment.