Spaces:
Runtime error
Runtime error
update README, add better docs
Browse files
README.md
CHANGED
|
@@ -24,9 +24,9 @@ RAGTheDocs is an open-source library that allows you to deploy retrieval augment
|
|
| 24 |

|
| 25 |
|
| 26 |
3) Set your environment variables:
|
| 27 |
-
* OPENAI_API_KEY
|
| 28 |
-
* READTHEDOCS_URL
|
| 29 |
-
* READTHEDOCS_VERSION
|
| 30 |
|
| 31 |
**WARNING** This library is experimental and automatically calls OpenAI APIs for you. Use at your own risk! ⚠️
|
| 32 |
|
|
@@ -35,6 +35,6 @@ RAGTheDocs is an open-source library that allows you to deploy retrieval augment
|
|
| 35 |
|
| 36 |
- **Web Scraping and embeddings:** RAGtheDocs automatically scrapes and embeds documentation from any website generated by ReadTheDocs/Sphinx using OpenAI embeddings
|
| 37 |
|
| 38 |
-
- **RAG Interface:** It comes built-in with a gradio UI for users to interact with [Buster 🤖](github.com/jerpint/
|
| 39 |
|
| 40 |
- **Customization Options:** Tailor RAGtheDocs to your needs with customizable settings and options.
|
|
|
|
| 24 |

|
| 25 |
|
| 26 |
3) Set your environment variables:
|
| 27 |
+
* `OPENAI_API_KEY`: Needed for the app to work, e.g. `sk-...`
|
| 28 |
+
* `READTHEDOCS_URL`: The url of the website you are interested in scraping
|
| 29 |
+
* `READTHEDOCS_VERSION`: This is important only if there exist multiple versions of the docs (e.g. "en/v0.2.7" or "en/latest"). If left empty, it will scrape all available versions.
|
| 30 |
|
| 31 |
**WARNING** This library is experimental and automatically calls OpenAI APIs for you. Use at your own risk! ⚠️
|
| 32 |
|
|
|
|
| 35 |
|
| 36 |
- **Web Scraping and embeddings:** RAGtheDocs automatically scrapes and embeds documentation from any website generated by ReadTheDocs/Sphinx using OpenAI embeddings
|
| 37 |
|
| 38 |
+
- **RAG Interface:** It comes built-in with a gradio UI for users to interact with [Buster 🤖](https://github.com/jerpint/buste) our RAG agent.
|
| 39 |
|
| 40 |
- **Customization Options:** Tailor RAGtheDocs to your needs with customizable settings and options.
|
app.py
CHANGED
|
@@ -22,6 +22,7 @@ homepage_url = os.getenv("READTHEDOCS_URL") # e.g. "https://orion.readthedocs.io
|
|
| 22 |
target_version = os.getenv("READTHEDOCS_VERSION") # e.g. "en/stable"
|
| 23 |
|
| 24 |
# scrape and embed content from readthedocs website
|
|
|
|
| 25 |
scrape_rtd(
|
| 26 |
homepage_url=homepage_url, save_directory="outputs/", target_version=target_version
|
| 27 |
)
|
|
@@ -101,7 +102,24 @@ def chat(chat_history: ChatHistory) -> Tuple[ChatHistory, Completion]:
|
|
| 101 |
demo = gr.Blocks()
|
| 102 |
with demo:
|
| 103 |
with gr.Row():
|
| 104 |
-
gr.Markdown("<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
chatbot = gr.Chatbot()
|
| 107 |
|
|
@@ -122,10 +140,6 @@ with demo:
|
|
| 122 |
inputs=question,
|
| 123 |
)
|
| 124 |
|
| 125 |
-
gr.Markdown(
|
| 126 |
-
"This app uses [Buster 🤖](github.com/jerpint/buster) and ChatGPT to search the docs for relevant info and answer questions."
|
| 127 |
-
)
|
| 128 |
-
|
| 129 |
response = gr.State()
|
| 130 |
|
| 131 |
# fmt: off
|
|
|
|
| 22 |
target_version = os.getenv("READTHEDOCS_VERSION") # e.g. "en/stable"
|
| 23 |
|
| 24 |
# scrape and embed content from readthedocs website
|
| 25 |
+
# comment out if already embedded locally to avoid extra costs
|
| 26 |
scrape_rtd(
|
| 27 |
homepage_url=homepage_url, save_directory="outputs/", target_version=target_version
|
| 28 |
)
|
|
|
|
| 102 |
demo = gr.Blocks()
|
| 103 |
with demo:
|
| 104 |
with gr.Row():
|
| 105 |
+
gr.Markdown("<h1><center>RAGTheDocs</center></h1>")
|
| 106 |
+
|
| 107 |
+
gr.Markdown(
|
| 108 |
+
"""
|
| 109 |
+
## About
|
| 110 |
+
RAGTheDocs allows you to ask questions about any documentation hosted on readthedocs.
|
| 111 |
+
Simply clone this space and point it to the right URL!
|
| 112 |
+
|
| 113 |
+
Try it out by asking a question below about [orion](https://orion.readthedocs.io/), an open-source hyperparameter optimization library.
|
| 114 |
+
|
| 115 |
+
## How it works
|
| 116 |
+
This app uses [Buster 🤖](https://github.com/jerpint/buster) and ChatGPT to search the docs for relevant info and
|
| 117 |
+
answer questions.
|
| 118 |
+
View the code on the [project homepage](https://github.com/jerpint/RAGTheDocs)
|
| 119 |
+
"""
|
| 120 |
+
|
| 121 |
+
)
|
| 122 |
+
|
| 123 |
|
| 124 |
chatbot = gr.Chatbot()
|
| 125 |
|
|
|
|
| 140 |
inputs=question,
|
| 141 |
)
|
| 142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
response = gr.State()
|
| 144 |
|
| 145 |
# fmt: off
|