Spaces:
Running
Running
jedick commited on
Commit Β·
cf58ea1
1
Parent(s): 9f5b319
Update app info dropdown
Browse files
app.py
CHANGED
|
@@ -265,6 +265,7 @@ with gr.Blocks(
|
|
| 265 |
chatbot = gr.Chatbot(
|
| 266 |
show_label=False,
|
| 267 |
avatar_images=(None, "images/cloud.png"),
|
|
|
|
| 268 |
render=False,
|
| 269 |
)
|
| 270 |
# Modified from gradio/chat_interface.py
|
|
@@ -318,23 +319,14 @@ with gr.Blocks(
|
|
| 318 |
## π·π€π¬ R-help-chat
|
| 319 |
|
| 320 |
**Search and chat with the [R-help mailing list archives](https://stat.ethz.ch/pipermail/r-help/).**
|
| 321 |
-
An LLM turns your question into a search query, including year ranges and months
|
| 322 |
-
|
| 323 |
You can ask follow-up questions with the chat history as context.
|
| 324 |
Press the clear button (π) to clear the history and start a new chat.
|
| 325 |
-
|
| 326 |
"""
|
| 327 |
return intro
|
| 328 |
|
| 329 |
-
def get_status_text():
|
| 330 |
-
status_text = f"""
|
| 331 |
-
π This app uses the OpenAI API<br>
|
| 332 |
-
β οΈ **_Privacy Notice_**: Data sharing with OpenAI is enabled<br>
|
| 333 |
-
β¨ text-embedding-3-small and {openai_model}<br>
|
| 334 |
-
π More info: [R-help-chat GitHub repository](https://github.com/jedick/R-help-chat)
|
| 335 |
-
"""
|
| 336 |
-
return status_text
|
| 337 |
-
|
| 338 |
def get_info_text():
|
| 339 |
try:
|
| 340 |
# Get source files for each email and start and end months from database
|
|
@@ -346,9 +338,12 @@ with gr.Blocks(
|
|
| 346 |
start = None
|
| 347 |
end = None
|
| 348 |
info_text = f"""
|
| 349 |
-
**Database:** {len(sources)} emails from {start} to {end}
|
| 350 |
-
**
|
| 351 |
-
**
|
|
|
|
|
|
|
|
|
|
| 352 |
"""
|
| 353 |
return info_text
|
| 354 |
|
|
@@ -392,7 +387,7 @@ with gr.Blocks(
|
|
| 392 |
with gr.Column(scale=1):
|
| 393 |
gr.Radio(
|
| 394 |
["Auto", "R-help", "R-devel", "R-pkg-devel"],
|
| 395 |
-
label="Mailing List",
|
| 396 |
interactive=False,
|
| 397 |
)
|
| 398 |
with gr.Group() as chat_interface:
|
|
@@ -405,8 +400,7 @@ with gr.Blocks(
|
|
| 405 |
missing_data.render()
|
| 406 |
# Right column: Info, Examples
|
| 407 |
with gr.Column(scale=1):
|
| 408 |
-
|
| 409 |
-
with gr.Accordion("βΉοΈ More Info", open=False):
|
| 410 |
info = gr.Markdown(get_info_text())
|
| 411 |
with gr.Accordion("π‘ Examples", open=True):
|
| 412 |
# Add some helpful examples
|
|
@@ -526,4 +520,9 @@ if __name__ == "__main__":
|
|
| 526 |
}
|
| 527 |
"""
|
| 528 |
# Launch the Gradio app
|
| 529 |
-
demo.launch(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
chatbot = gr.Chatbot(
|
| 266 |
show_label=False,
|
| 267 |
avatar_images=(None, "images/cloud.png"),
|
| 268 |
+
buttons=["copy", "copy_all"],
|
| 269 |
render=False,
|
| 270 |
)
|
| 271 |
# Modified from gradio/chat_interface.py
|
|
|
|
| 319 |
## π·π€π¬ R-help-chat
|
| 320 |
|
| 321 |
**Search and chat with the [R-help mailing list archives](https://stat.ethz.ch/pipermail/r-help/).**
|
| 322 |
+
An LLM turns your question into a search query, including year ranges and months.
|
| 323 |
+
Retrieved emails are shown below the chatbot and are used by the LLM to generate an answer.
|
| 324 |
You can ask follow-up questions with the chat history as context.
|
| 325 |
Press the clear button (π) to clear the history and start a new chat.
|
| 326 |
+
*Privacy notice*: Data sharing with OpenAI is enabled.
|
| 327 |
"""
|
| 328 |
return intro
|
| 329 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 330 |
def get_info_text():
|
| 331 |
try:
|
| 332 |
# Get source files for each email and start and end months from database
|
|
|
|
| 338 |
start = None
|
| 339 |
end = None
|
| 340 |
info_text = f"""
|
| 341 |
+
**Database:** {len(sources)} emails from {start} to {end}<br>
|
| 342 |
+
**Models:** {openai_model} and text-embedding-3-small<br>
|
| 343 |
+
**Features:** RAG, today's date, hybrid search (semantic + lexical), multiple retrievals, citations output, chat memory<br>
|
| 344 |
+
**Tech:** [OpenAI](https://openai.com/), [Chroma](https://www.trychroma.com/),
|
| 345 |
+
[BM25S](https://github.com/xhluca/bm25s), [LangGraph](https://www.langchain.com/langgraph), [Gradio](https://www.langchain.com/langgraph)<br>
|
| 346 |
+
π **More info:** [R-help-chat GitHub repository](https://github.com/jedick/R-help-chat)
|
| 347 |
"""
|
| 348 |
return info_text
|
| 349 |
|
|
|
|
| 387 |
with gr.Column(scale=1):
|
| 388 |
gr.Radio(
|
| 389 |
["Auto", "R-help", "R-devel", "R-pkg-devel"],
|
| 390 |
+
label="π§ Mailing List (Under construction) π§",
|
| 391 |
interactive=False,
|
| 392 |
)
|
| 393 |
with gr.Group() as chat_interface:
|
|
|
|
| 400 |
missing_data.render()
|
| 401 |
# Right column: Info, Examples
|
| 402 |
with gr.Column(scale=1):
|
| 403 |
+
with gr.Accordion("βΉοΈ App Info", open=True):
|
|
|
|
| 404 |
info = gr.Markdown(get_info_text())
|
| 405 |
with gr.Accordion("π‘ Examples", open=True):
|
| 406 |
# Add some helpful examples
|
|
|
|
| 520 |
}
|
| 521 |
"""
|
| 522 |
# Launch the Gradio app
|
| 523 |
+
demo.launch(
|
| 524 |
+
allowed_paths=allowed_paths,
|
| 525 |
+
theme=theme,
|
| 526 |
+
css=css,
|
| 527 |
+
footer_links=["gradio", "settings"],
|
| 528 |
+
)
|
main.py
CHANGED
|
@@ -22,6 +22,7 @@ from graph import BuildGraph
|
|
| 22 |
# R-help-chat
|
| 23 |
# -----------
|
| 24 |
# First version by Jeffrey Dick on 2025-06-29
|
|
|
|
| 25 |
|
| 26 |
# Setup environment variables
|
| 27 |
load_dotenv(dotenv_path=".env", override=True)
|
|
|
|
| 22 |
# R-help-chat
|
| 23 |
# -----------
|
| 24 |
# First version by Jeffrey Dick on 2025-06-29
|
| 25 |
+
# Updated to LangChain v1 and Chroma 6 on 2026-01-03
|
| 26 |
|
| 27 |
# Setup environment variables
|
| 28 |
load_dotenv(dotenv_path=".env", override=True)
|