diff --git a/example/YouTubeChatbot/README.md b/example/YouTubeChatbot/README.md new file mode 100644 index 0000000..57d3a9e --- /dev/null +++ b/example/YouTubeChatbot/README.md @@ -0,0 +1,4 @@ +# youtubechatbot111 + +App Link here :[Youtube Chatbot](https://youtubechatbot111-dphcjsrysxgqchabexhv2d.streamlit.app/) +This application is driven by Lyzr SDK's Chatbot functionality! Here, you can upload your YouTube links and ask questions to receive relevant and insightful responses. Whether you're a student seeking clarification or a curious learner eager to delve deeper into a particular subject, our YouTube Chatbot is here to facilitate your learning journey. diff --git a/example/YouTubeChatbot/abc.txt b/example/YouTubeChatbot/abc.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/example/YouTubeChatbot/abc.txt @@ -0,0 +1 @@ + diff --git a/example/YouTubeChatbot/app1.py b/example/YouTubeChatbot/app1.py new file mode 100644 index 0000000..607085a --- /dev/null +++ b/example/YouTubeChatbot/app1.py @@ -0,0 +1,53 @@ +import streamlit as st +import os +from lyzr import ChatBot +import weaviate +import openai + +# Set your OpenAI API key +openai.api_key = st.secrets["OPENAI_API_KEY"] + +# Define the Weaviate vector store parameters +vector_store_params = { + "vector_store_type": "WeaviateVectorStore", + "url": "https://newytchatbot-tr5zy9ee.weaviate.network", + "api_key": "8C9HovD2PvtgREyGn77YGPyLnCSWB5vu8t7L", + "index_name": "Akshay" # First letter should be capital +} + +# Alternatively, for a local Embedded Weaviate vector store +# vector_store_params = { +# "vector_store_type": "WeaviateVectorStore", +# "index_name": "IndexName" # First letter should be capital +# } + +# Function to initialize the Chatbot with the provided video URL +def initialize_chatbot(video_url): + return ChatBot.youtube_chat(urls=[video_url], vector_store_params=vector_store_params) + +# Main function to create the Streamlit app +def main(): + st.title("YouTube Chatbot") + + # Input field for entering the YouTube video URL + video_url = st.text_input("Enter YouTube Video URL:") + + # Initialize the Chatbot if the video URL is provided + if video_url: + chatbot = initialize_chatbot(video_url) + + # Input field for asking questions + question = st.text_input("Ask a question related to the video content:") + + # Button to submit the question and get the response + if st.button("Ask"): + if question: + response = chatbot.chat(question) + st.write("Chatbot's Response:") + st.write(response.response) + else: + st.warning("Please enter a question.") + +# Run the Streamlit app +if __name__ == "__main__": + main() diff --git a/example/YouTubeChatbot/requirements.txt b/example/YouTubeChatbot/requirements.txt new file mode 100644 index 0000000..a305bcd Binary files /dev/null and b/example/YouTubeChatbot/requirements.txt differ diff --git a/example/wikibot/Hello.py b/example/wikibot/Hello.py new file mode 100644 index 0000000..366209f --- /dev/null +++ b/example/wikibot/Hello.py @@ -0,0 +1,120 @@ +import os +os.system("playwright install") +from PIL import Image +import streamlit as st +from lyzr import ChatBot +import nest_asyncio +#from typing import Union +import openai + +os.environ["OPENAI_API_KEY"] = st.secrets["apikey"] + +# Apply nest_asyncio +nest_asyncio.apply() + +# Custom function to style the app +def style_app(): + # You can put your CSS styles here + st.markdown(""" + + """, unsafe_allow_html=True) + +# Call the function to apply the styles +style_app() + +# Load and display the logo +image = Image.open("lyzr-logo.png") +st.image(image, width=150) + +# App title and introduction +st.title("WikiBot") +st.markdown("### Welcome to WikiBot! 🤖") +st.markdown("Interact with Wikipedia Through Chatbots (built using LYZR SDK)") + +# Define function to initialize chatbot +def initialize_chatbot(url): + # Replace these parameters with your actual Weaviate Vector Store parameters + vector_store_params = { + "vector_store_type": "WeaviateVectorStore", + "url": "https://wikibot-zn4f2emj.weaviate.network", + "api_key": "JKkfz6V0kxYa3WX40FdyiFf2DDTM3GlAIyTT", + "index_name": "Akshay" + } + # Initialize the Webpage Chatbot with the provided URL + return ChatBot.webpage_chat( + url=url, + vector_store_params=vector_store_params + ) + +# Main function to run the Streamlit app +def main(): + # User input for URL + url = st.text_input("Enter the URL of the webpage:") + + # Check if URL is provided + if url: + # Initialize the chatbot with the provided URL + chatbot = initialize_chatbot(url) + + # Pre-defined prompts + prompts = [ + "What is the summary of this page?", + "Can you explain the history of this topic?", + "Who are the notable figures related to this topic?", + "What are the controversies surrounding this topic?" + ] + + # Display pre-defined prompts as buttons + col1, col2 = st.columns(2) + for i, prompt in enumerate(prompts): + if i % 2 == 0: + button = col1.button(prompt, key=f"button_{i}") + else: + button = col2.button(prompt, key=f"button_{i}") + + # Check if button is clicked + if button: + # Chat with the chatbot + response = chatbot.chat(prompt) + + # Display chatbot's response + st.write("Chatbot's Response:") + st.write(response.response) + + + # User's own question input field + user_question = st.text_input("Enter your own question:") + + # Chat with the chatbot if user provides a question + if user_question: + response = chatbot.chat(user_question) + + # Display chatbot's response + st.write("Chatbot's Response:") + st.write(response.response) + +# Run the Streamlit app +if __name__ == "__main__": + main() + +# Footer or any additional information +with st.expander("ℹ️ - About this App"): + st.markdown(""" + WikiBot enables seamless interaction with Wikipedia through chatbots powered by the LYZR SDK. Effortlessly explore topics, utilize pre-defined prompts for summaries, and pose inquiries directly within your browser. For inquiries or assistance, reach out to Lyzr. + """) + + + st.link_button("Lyzr", url='https://www.lyzr.ai/', use_container_width = True) + st.link_button("Book a Demo", url='https://www.lyzr.ai/book-demo/', use_container_width = True) + st.link_button("Discord", url='https://discord.gg/nm7zSyEFA2', use_container_width = True) + st.link_button("Slack", url='https://join.slack.com/t/genaiforenterprise/shared_invite/zt-2a7fr38f7-_QDOY1W1WSlSiYNAEncLGw', use_container_width = True) diff --git a/example/wikibot/README.md b/example/wikibot/README.md new file mode 100644 index 0000000..b97c0da --- /dev/null +++ b/example/wikibot/README.md @@ -0,0 +1 @@ +WikiBot enables seamless interaction with Wikipedia through chatbots powered by the LYZR SDK. Effortlessly explore topics, utilize pre-defined prompts for summaries, and pose inquiries directly within your browser. For inquiries or assistance, reach out to Lyzr. diff --git a/example/wikibot/abc.txt b/example/wikibot/abc.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/example/wikibot/abc.txt @@ -0,0 +1 @@ + diff --git a/example/wikibot/lyzr-logo-cut.png b/example/wikibot/lyzr-logo-cut.png new file mode 100644 index 0000000..5667dd7 Binary files /dev/null and b/example/wikibot/lyzr-logo-cut.png differ diff --git a/example/wikibot/lyzr-logo.png b/example/wikibot/lyzr-logo.png new file mode 100644 index 0000000..090c292 Binary files /dev/null and b/example/wikibot/lyzr-logo.png differ diff --git a/example/wikibot/packages.txt b/example/wikibot/packages.txt new file mode 100644 index 0000000..ebd3bd9 --- /dev/null +++ b/example/wikibot/packages.txt @@ -0,0 +1,17 @@ +libnss3 +libnspr4 +libatk1.0-0 +libatk-bridge2.0-0 +libcups2 +libdrm2 +libxkbcommon0 +libxcomposite1 +libxdamage1 +libxfixes3 +libxrandr2 +libgbm1 +libpango-1.0-0 +libcairo2 +libasound2 +libatspi2.0-0 +libwayland-client0 diff --git a/example/wikibot/requirements.txt b/example/wikibot/requirements.txt new file mode 100644 index 0000000..4f23554 --- /dev/null +++ b/example/wikibot/requirements.txt @@ -0,0 +1,104 @@ +aiohttp==3.9.3 +aiosignal==1.3.1 +aiostream==0.5.2 +altair==5.2.0 +annotated-types==0.6.0 +anyio==3.7.1 +appdirs==1.4.4 +asyncio==3.4.3 +attrs==23.2.0 +Authlib==1.3.0 +beautifulsoup4==4.12.2 +blinker==1.7.0 +cachetools==5.3.3 +certifi==2023.11.17 +cffi==1.16.0 +charset-normalizer==3.3.2 +click==8.1.7 +contourpy==1.2.0 +cryptography==42.0.5 +cycler==0.12.1 +dataclasses-json==0.5.14 +Deprecated==1.2.14 +distro==1.9.0 +filelock==3.13.1 +fonttools==4.49.0 +frozenlist==1.4.1 +fsspec==2024.2.0 +gitdb==4.0.11 +GitPython==3.1.41 +greenlet==3.0.3 +h11==0.14.0 +httpcore==1.0.4 +httpx==0.27.0 +huggingface-hub==0.21.4 +idna==3.6 +importlib_metadata==7.0.2 +Jinja2==3.1.3 +joblib==1.3.2 +jsonpatch==1.33 +jsonpointer==2.4 +jsonschema==4.21.1 +jsonschema-specifications==2023.12.1 +kiwisolver==1.4.5 +langchain==0.0.339 +langsmith==0.0.92 +litellm==1.2.0 +llama-index==0.9.4 +llmsherpa==0.1.4 +lyzr==0.1.25 +markdown-it-py==3.0.0 +MarkupSafe==2.1.5 +marshmallow==3.21.1 +mdurl==0.1.2 +multidict==6.0.5 +mypy-extensions==1.0.0 +nest-asyncio==1.6.0 +nltk==3.8.1 +numpy==1.26.4 +openai==1.3.4 +packaging==23.2 +pandas==2.0.2 +pillow==10.2.0 +playwright==1.42.0 +protobuf==4.25.3 +pyarrow==15.0.1 +pycparser==2.21 +pydantic==2.6.4 +pydantic_core==2.16.3 +pydeck==0.8.1b0 +pyee==11.0.1 +Pygments==2.17.2 +pyparsing==3.1.2 +python-dateutil==2.9.0.post0 +python-dotenv==1.0.1 +pytz==2024.1 +PyYAML==6.0.1 +referencing==0.33.0 +regex==2023.12.25 +requests==2.31.0 +rich==13.7.1 +rpds-py==0.18.0 +six==1.16.0 +smmap==5.0.1 +sniffio==1.3.1 +soupsieve==2.5 +SQLAlchemy==2.0.28 +streamlit==1.32.2 +tenacity==8.2.3 +tiktoken==0.6.0 +tokenizers==0.15.2 +toml==0.10.2 +toolz==0.12.1 +tornado==6.4 +tqdm==4.66.2 +typing-inspect==0.9.0 +typing_extensions==4.10.0 +tzdata==2024.1 +urllib3==1.26.18 +validators==0.22.0 +watchdog==4.0.0 +weaviate-client==3.25.3 +wrapt==1.16.0 +yarl==1.9.4 +zipp==3.18.1