Add new demo
This commit is contained in:
parent
e6cd853a8c
commit
b251fdd744
3 changed files with 63 additions and 0 deletions
28
chat_with_arxiv/README.md
Normal file
28
chat_with_arxiv/README.md
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
## 🔎 Chat with Arxiv
|
||||
This Streamlit app enables you to engage in interactive conversations with arXiv, a vast repository of scholarly articles, using GPT-4o. With this RAG application, you can easily access and explore the wealth of knowledge contained within arXiv.
|
||||
|
||||
### Features
|
||||
- Engage in conversational interactions with arXiv
|
||||
- Access and explore a vast collection of research papers
|
||||
- Utilize OpenAI GPT-4o for intelligent responses
|
||||
|
||||
### How to get Started?
|
||||
|
||||
1. Clone the GitHub repository
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git
|
||||
```
|
||||
2. Install the required dependencies:
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
3. Get your OpenAI API Key
|
||||
|
||||
- Sign up for an [OpenAI account](https://platform.openai.com/) (or the LLM provider of your choice) and obtain your API key.
|
||||
|
||||
4. Run the Streamlit App
|
||||
```bash
|
||||
streamlit run chat_arxiv.py
|
||||
```
|
||||
31
chat_with_arxiv/chat_arxiv.py
Normal file
31
chat_with_arxiv/chat_arxiv.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Import the required libraries
|
||||
import streamlit as st
|
||||
from phi.assistant import Assistant
|
||||
from phi.llm.openai import OpenAIChat
|
||||
from phi.tools.arxiv_toolkit import ArxivToolkit
|
||||
|
||||
# Set up the Streamlit app
|
||||
st.title("Chat with Arxiv 🔎🤖")
|
||||
st.caption("This app allows you to chat with arXiv using OpenAI GPT-4o model.")
|
||||
|
||||
# Get OpenAI API key from user
|
||||
openai_access_token = st.text_input("OpenAI API Key", type="password")
|
||||
|
||||
# If OpenAI API key is provided, create an instance of Assistant
|
||||
if openai_access_token:
|
||||
# Create an instance of the Assistant
|
||||
assistant = Assistant(
|
||||
llm=OpenAIChat(
|
||||
model="gpt-4o",
|
||||
max_tokens=1024,
|
||||
temperature=0.9,
|
||||
api_key=openai_access_token) , tools=[ArxivToolkit()], show_tool_calls=True
|
||||
)
|
||||
|
||||
# Get the search query from the user
|
||||
query= st.text_input("Enter the Search Query", type="default")
|
||||
|
||||
if query:
|
||||
# Search the web using the AI Assistant
|
||||
response = assistant.run(query, stream=False)
|
||||
st.write(response)
|
||||
4
chat_with_arxiv/requirements.txt
Normal file
4
chat_with_arxiv/requirements.txt
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
streamlit
|
||||
phidata
|
||||
arxiv
|
||||
openai
|
||||
Loading…
Reference in a new issue