Article Content
-This is some test content.
-
-
-
-
-
- Universal, Self-improving memory layer for LLM applications. + Universal, self-improving memory layer for LLM applications.
AI Coding Tools`): - `integrations/claude-code` [Both] - `integrations/cursor` [Both] - `integrations/codex` [Both] +- `integrations/opencode` [Both] +- `integrations/antigravity` [Both] - `integrations/openclaw` [Both] ### MCP Endpoints diff --git a/docs/open-source/features/overview.mdx b/docs/open-source/features/overview.mdx index f7afa5950..073e0ce73 100644 --- a/docs/open-source/features/overview.mdx +++ b/docs/open-source/features/overview.mdx @@ -6,7 +6,7 @@ icon: "list" # Self-Hosting Features Overview -Mem0 Open Source ships with capabilities that adapt memory behavior for production workloads—async operations, graph relationships, multimodal inputs, and fine-tuned retrieval. Configure these features with code or YAML to match your application's needs. +Mem0 Open Source ships with capabilities that adapt memory behavior for production workloads—async operations, multimodal inputs, and fine-tuned retrieval. Configure these features with code or YAML to match your application's needs.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
If you can't find the specific data source, please feel free to request through one of the following channels and help us prioritize.
- -If you can't find the specific LLM you need, no need to fret. We're continuously expanding our support for additional LLMs, and you can help us prioritize by opening an issue on our GitHub or simply reaching out to us on our Slack or Discord community.
- -If you can't find specific feature or run into issues, please feel free to reach out through one of the following channels.
- -
-
-## Seeking help?
-
-If you run into issues with deployment, please feel free to reach out to us via any of the following methods:
-
-
-
-## Seeking help?
-
-If you run into issues with deployment, please feel free to reach out to us via any of the following methods:
-
-
-
-## Seeking help?
-
-If you run into issues with deployment, please feel free to reach out to us via any of the following methods:
-
-
-
-## Seeking help?
-
-If you run into issues with deployment, please feel free to reach out to us via any of the following methods:
-
-
-
-
-## Troubleshooting
-
-Here's how to solve some common problems when working with the CLI.
-
-| Embedding model | -Google Colab | -Replit | -
|---|---|---|
| OpenAI | -||
| VertexAI | -||
| GPT4All | -||
| Hugging Face | -
| Vector DB | -Google Colab | -Replit | -
|---|---|---|
| ChromaDB | -||
| Elasticsearch | -||
| Opensearch | -||
| Pinecone | -
-
-Embedchain now supports [OpenAI Assistants API](https://platform.openai.com/docs/assistants/overview) which allows you to build AI assistants within your own applications. An Assistant has instructions and can leverage models, tools, and knowledge to respond to user queries.
-
-At a high level, an integration of the Assistants API has the following flow:
-
-1. Create an Assistant in the API by defining custom instructions and picking a model
-2. Create a Thread when a user starts a conversation
-3. Add Messages to the Thread as the user ask questions
-4. Run the Assistant on the Thread to trigger responses. This automatically calls the relevant tools.
-
-Creating an OpenAI Assistant using Embedchain is very simple 3 step process.
-
-## Step 1: Create OpenAI Assistant
-
-Make sure that you have `OPENAI_API_KEY` set in the environment variable.
-
-```python Initialize
-from embedchain.store.assistants import OpenAIAssistant
-
-assistant = OpenAIAssistant(
- name="OpenAI DevDay Assistant",
- instructions="You are an organizer of OpenAI DevDay",
-)
-```
-
-If you want to use the existing assistant, you can do something like this:
-
-```python Initialize
-# Load an assistant and create a new thread
-assistant = OpenAIAssistant(assistant_id="asst_xxx")
-
-# Load a specific thread for an assistant
-assistant = OpenAIAssistant(assistant_id="asst_xxx", thread_id="thread_xxx")
-```
-
-## Step-2: Add data to thread
-
-You can add any custom data source that is supported by Embedchain. Else, you can directly pass the file path on your local system and Embedchain propagates it to OpenAI Assistant.
-```python Add data
-assistant.add("/path/to/file.pdf")
-assistant.add("https://www.youtube.com/watch?v=U9mJuUkhUzk")
-assistant.add("https://openai.com/blog/new-models-and-developer-products-announced-at-devday")
-```
-
-## Step-3: Chat with your Assistant
-```python Chat
-assistant.chat("How much OpenAI credits were offered to attendees during OpenAI DevDay?")
-# Response: 'Every attendee of OpenAI DevDay 2023 was offered $500 in OpenAI credits.'
-```
-
-You can try it out yourself using the following Google Colab notebook:
-
-
-
diff --git a/embedchain/docs/favicon.png b/embedchain/docs/favicon.png
deleted file mode 100644
index 35494d9ea..000000000
Binary files a/embedchain/docs/favicon.png and /dev/null differ
diff --git a/embedchain/docs/get-started/deployment.mdx b/embedchain/docs/get-started/deployment.mdx
deleted file mode 100644
index 87e72dcbb..000000000
--- a/embedchain/docs/get-started/deployment.mdx
+++ /dev/null
@@ -1,22 +0,0 @@
----
-title: 'Overview'
-description: 'Deploy your RAG application to production'
----
-
-After successfully setting up and testing your RAG app locally, the next step is to deploy it to a hosting service to make it accessible to a wider audience. Embedchain provides integration with different cloud providers so that you can seamlessly deploy your RAG applications to production without having to worry about going through the cloud provider instructions. Embedchain does all the heavy lifting for you.
-
-
diff --git a/embedchain/docs/integration/openlit.mdx b/embedchain/docs/integration/openlit.mdx
deleted file mode 100644
index 22036919e..000000000
--- a/embedchain/docs/integration/openlit.mdx
+++ /dev/null
@@ -1,50 +0,0 @@
----
-title: '🔭 OpenLIT'
-description: 'OpenTelemetry-native Observability and Evals for LLMs & GPUs'
----
-
-Embedchain now supports integration with [OpenLIT](https://github.com/openlit/openlit).
-
-## Getting Started
-
-### 1. Set environment variables
-```bash
-# Setting environment variable for OpenTelemetry destination and authetication.
-export OTEL_EXPORTER_OTLP_ENDPOINT = "YOUR_OTEL_ENDPOINT"
-export OTEL_EXPORTER_OTLP_HEADERS = "YOUR_OTEL_ENDPOINT_AUTH"
-```
-
-### 2. Install the OpenLIT SDK
-Open your terminal and run:
-
-```shell
-pip install openlit
-```
-
-### 3. Setup Your Application for Monitoring
-Now create an app using Embedchain and initialize OpenTelemetry monitoring
-
-```python
-from embedchain import App
-import OpenLIT
-
-# Initialize OpenLIT Auto Instrumentation for monitoring.
-openlit.init()
-
-# Initialize EmbedChain application.
-app = App()
-
-# Add data to your app
-app.add("https://en.wikipedia.org/wiki/Elon_Musk")
-
-# Query your app
-app.query("How many companies did Elon found?")
-```
-
-### 4. Visualize
-
-Once you've set up data collection with OpenLIT, you can visualize and analyze this information to better understand your application's performance:
-
-- **Using OpenLIT UI:** Connect to OpenLIT's UI to start exploring performance metrics. Visit the OpenLIT [Quickstart Guide](https://docs.openlit.io/latest/quickstart) for step-by-step details.
-
-- **Integrate with existing Observability Tools:** If you use tools like Grafana or DataDog, you can integrate the data collected by OpenLIT. For instructions on setting up these connections, check the OpenLIT [Connections Guide](https://docs.openlit.io/latest/connections/intro).
diff --git a/embedchain/docs/integration/streamlit-mistral.mdx b/embedchain/docs/integration/streamlit-mistral.mdx
deleted file mode 100644
index d7b795755..000000000
--- a/embedchain/docs/integration/streamlit-mistral.mdx
+++ /dev/null
@@ -1,112 +0,0 @@
----
-title: '🚀 Streamlit'
-description: 'Integrate with Streamlit to plug and play with any LLM'
----
-
-In this example, we will learn how to use `mistralai/Mixtral-8x7B-Instruct-v0.1` and Embedchain together with Streamlit to build a simple RAG chatbot.
-
-
-
-## Setup
-
-Install Embedchain and Streamlit.
-```bash
-pip install embedchain streamlit
-```
-🚀 An Embedchain app powered by OpenAI!
' # noqa: E501 -st.markdown(styled_caption, unsafe_allow_html=True) - -if "messages" not in st.session_state: - st.session_state.messages = [ - { - "role": "assistant", - "content": """ - Hi! I'm chatbot powered by Embedchain, which can answer questions about your pdf documents.\n - Upload your pdf documents here and I'll answer your questions about them! - """, - } - ] - -for message in st.session_state.messages: - with st.chat_message(message["role"]): - st.markdown(message["content"]) - -if prompt := st.chat_input("Ask me anything!"): - if not st.session_state.api_key: - st.error("Please enter your OpenAI API Key", icon="🤖") - st.stop() - - app = get_ec_app(st.session_state.api_key) - - with st.chat_message("user"): - st.session_state.messages.append({"role": "user", "content": prompt}) - st.markdown(prompt) - - with st.chat_message("assistant"): - msg_placeholder = st.empty() - msg_placeholder.markdown("Thinking...") - full_response = "" - - q = queue.Queue() - - def app_response(result): - llm_config = app.llm.config.as_dict() - llm_config["callbacks"] = [StreamingStdOutCallbackHandlerYield(q=q)] - config = BaseLlmConfig(**llm_config) - answer, citations = app.chat(prompt, config=config, citations=True) - result["answer"] = answer - result["citations"] = citations - - results = {} - thread = threading.Thread(target=app_response, args=(results,)) - thread.start() - - for answer_chunk in generate(q): - full_response += answer_chunk - msg_placeholder.markdown(full_response) - - thread.join() - answer, citations = results["answer"], results["citations"] - if citations: - full_response += "\n\n**Sources**:\n" - sources = [] - for i, citation in enumerate(citations): - source = citation[1]["url"] - pattern = re.compile(r"([^/]+)\.[^\.]+\.pdf$") - match = pattern.search(source) - if match: - source = match.group(1) + ".pdf" - sources.append(source) - sources = list(set(sources)) - for source in sources: - full_response += f"- {source}\n" - - msg_placeholder.markdown(full_response) - print("Answer: ", full_response) - st.session_state.messages.append({"role": "assistant", "content": full_response}) diff --git a/embedchain/examples/chat-pdf/embedchain.json b/embedchain/examples/chat-pdf/embedchain.json deleted file mode 100644 index 32dec2933..000000000 --- a/embedchain/examples/chat-pdf/embedchain.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "provider": "streamlit.io" -} \ No newline at end of file diff --git a/embedchain/examples/chat-pdf/requirements.txt b/embedchain/examples/chat-pdf/requirements.txt deleted file mode 100644 index b9bbe5aad..000000000 --- a/embedchain/examples/chat-pdf/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -streamlit -embedchain -langchain-text-splitters -pysqlite3-binary diff --git a/embedchain/examples/discord_bot/.dockerignore b/embedchain/examples/discord_bot/.dockerignore deleted file mode 100644 index 1dce42e87..000000000 --- a/embedchain/examples/discord_bot/.dockerignore +++ /dev/null @@ -1,8 +0,0 @@ -__pycache__/ -database -db -pyenv -venv -.env -.git -trash_files/ diff --git a/embedchain/examples/discord_bot/.gitignore b/embedchain/examples/discord_bot/.gitignore deleted file mode 100644 index ba288ed39..000000000 --- a/embedchain/examples/discord_bot/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -__pycache__ -db -database -pyenv -venv -.env -trash_files/ diff --git a/embedchain/examples/discord_bot/Dockerfile b/embedchain/examples/discord_bot/Dockerfile deleted file mode 100644 index c4f45e58f..000000000 --- a/embedchain/examples/discord_bot/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM python:3.11-slim - -WORKDIR /usr/src/discord_bot -COPY requirements.txt . -RUN pip install -r requirements.txt - -COPY . . - -CMD ["python", "discord_bot.py"] diff --git a/embedchain/examples/discord_bot/README.md b/embedchain/examples/discord_bot/README.md deleted file mode 100644 index 2d581871c..000000000 --- a/embedchain/examples/discord_bot/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Discord Bot - -This is a docker template to create your own Discord bot using the embedchain package. To know more about the bot and how to use it, go [here](https://docs.embedchain.ai/examples/discord_bot). - -To run this use the following command, - -```bash -docker run --name discord-bot -e OPENAI_API_KEY=sk-xxx -e DISCORD_BOT_TOKEN=xxx -p 8080:8080 embedchain/discord-bot:latest -``` diff --git a/embedchain/examples/discord_bot/discord_bot.py b/embedchain/examples/discord_bot/discord_bot.py deleted file mode 100644 index c7bad2689..000000000 --- a/embedchain/examples/discord_bot/discord_bot.py +++ /dev/null @@ -1,76 +0,0 @@ -import os - -import discord -from discord.ext import commands -from dotenv import load_dotenv - -from embedchain import App - -load_dotenv() -intents = discord.Intents.default() -intents.message_content = True - -bot = commands.Bot(command_prefix="/ec ", intents=intents) -root_folder = os.getcwd() - - -def initialize_chat_bot(): - global chat_bot - chat_bot = App() - - -@bot.event -async def on_ready(): - print(f"Logged in as {bot.user.name}") - initialize_chat_bot() - - -@bot.event -async def on_command_error(ctx, error): - if isinstance(error, commands.CommandNotFound): - await send_response(ctx, "Invalid command. Please refer to the documentation for correct syntax.") - else: - print("Error occurred during command execution:", error) - - -@bot.command() -async def add(ctx, data_type: str, *, url_or_text: str): - print(f"User: {ctx.author.name}, Data Type: {data_type}, URL/Text: {url_or_text}") - try: - chat_bot.add(data_type, url_or_text) - await send_response(ctx, f"Added {data_type} : {url_or_text}") - except Exception as e: - await send_response(ctx, f"Failed to add {data_type} : {url_or_text}") - print("Error occurred during 'add' command:", e) - - -@bot.command() -async def query(ctx, *, question: str): - print(f"User: {ctx.author.name}, Query: {question}") - try: - response = chat_bot.query(question) - await send_response(ctx, response) - except Exception as e: - await send_response(ctx, "An error occurred. Please try again!") - print("Error occurred during 'query' command:", e) - - -@bot.command() -async def chat(ctx, *, question: str): - print(f"User: {ctx.author.name}, Query: {question}") - try: - response = chat_bot.chat(question) - await send_response(ctx, response) - except Exception as e: - await send_response(ctx, "An error occurred. Please try again!") - print("Error occurred during 'chat' command:", e) - - -async def send_response(ctx, message): - if ctx.guild is None: - await ctx.send(message) - else: - await ctx.reply(message) - - -bot.run(os.environ["DISCORD_BOT_TOKEN"]) diff --git a/embedchain/examples/discord_bot/docker-compose.yml b/embedchain/examples/discord_bot/docker-compose.yml deleted file mode 100644 index 69baff0d8..000000000 --- a/embedchain/examples/discord_bot/docker-compose.yml +++ /dev/null @@ -1,11 +0,0 @@ -version: "3.9" - -services: - backend: - container_name: embedchain_discord_bot - restart: unless-stopped - build: - context: . - dockerfile: Dockerfile - env_file: - - variables.env \ No newline at end of file diff --git a/embedchain/examples/discord_bot/requirements.txt b/embedchain/examples/discord_bot/requirements.txt deleted file mode 100644 index 9cdaf53e3..000000000 --- a/embedchain/examples/discord_bot/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -discord==2.3.1 -embedchain==0.1.57 -python-dotenv==1.0.0 \ No newline at end of file diff --git a/embedchain/examples/discord_bot/variables.env b/embedchain/examples/discord_bot/variables.env deleted file mode 100644 index 7f3bd8975..000000000 --- a/embedchain/examples/discord_bot/variables.env +++ /dev/null @@ -1,2 +0,0 @@ -OPENAI_API_KEY="" -DISCORD_BOT_TOKEN="" \ No newline at end of file diff --git a/embedchain/examples/mistral-streamlit/README.md b/embedchain/examples/mistral-streamlit/README.md deleted file mode 100644 index 1bd80f83f..000000000 --- a/embedchain/examples/mistral-streamlit/README.md +++ /dev/null @@ -1,7 +0,0 @@ -### Streamlit Chat bot App (Embedchain + Mistral) - -To run it locally, - -```bash -streamlit run app.py -``` diff --git a/embedchain/examples/mistral-streamlit/app.py b/embedchain/examples/mistral-streamlit/app.py deleted file mode 100644 index 9df85fa32..000000000 --- a/embedchain/examples/mistral-streamlit/app.py +++ /dev/null @@ -1,72 +0,0 @@ -import os - -import streamlit as st - -from embedchain import App - - -@st.cache_resource -def ec_app(): - return App.from_config(config_path="config.yaml") - - -with st.sidebar: - huggingface_access_token = st.text_input("Hugging face Token", key="chatbot_api_key", type="password") - "[Get Hugging Face Access Token](https://huggingface.co/settings/tokens)" - "[View the source code](https://github.com/embedchain/examples/mistral-streamlit)" - - -st.title("💬 Chatbot") -st.caption("🚀 An Embedchain app powered by Mistral!") -if "messages" not in st.session_state: - st.session_state.messages = [ - { - "role": "assistant", - "content": """ - Hi! I'm a chatbot. I can answer questions and learn new things!\n - Ask me anything and if you want me to learn something do `/add🚀 An Embedchain app powered with Sadhguru\'s wisdom!
' # noqa: E501 -st.markdown(styled_caption, unsafe_allow_html=True) # noqa: E501 - -if "messages" not in st.session_state: - st.session_state.messages = [ - { - "role": "assistant", - "content": """ - Hi, I'm Sadhguru AI! I'm a mystic, yogi, visionary, and spiritual master. I'm here to answer your questions about life, the universe, and everything. - """, # noqa: E501 - } - ] - -for message in st.session_state.messages: - role = message["role"] - with st.chat_message(role, avatar=assistant_avatar_url if role == "assistant" else None): - st.markdown(message["content"]) - -if prompt := st.chat_input("Ask me anything!"): - with st.chat_message("user"): - st.markdown(prompt) - st.session_state.messages.append({"role": "user", "content": prompt}) - - with st.chat_message("assistant", avatar=assistant_avatar_url): - msg_placeholder = st.empty() - msg_placeholder.markdown("Thinking...") - full_response = "" - - q = queue.Queue() - - def app_response(result): - config = BaseLlmConfig(stream=True, callbacks=[StreamingStdOutCallbackHandlerYield(q)]) - answer, citations = app.chat(prompt, config=config, citations=True) - result["answer"] = answer - result["citations"] = citations - - results = {} - thread = threading.Thread(target=app_response, args=(results,)) - thread.start() - - for answer_chunk in generate(q): - full_response += answer_chunk - msg_placeholder.markdown(full_response) - - thread.join() - answer, citations = results["answer"], results["citations"] - if citations: - full_response += "\n\n**Sources**:\n" - sources = list(set(map(lambda x: x[1]["url"], citations))) - for i, source in enumerate(sources): - full_response += f"{i+1}. {source}\n" - - msg_placeholder.markdown(full_response) - st.session_state.messages.append({"role": "assistant", "content": full_response}) diff --git a/embedchain/examples/sadhguru-ai/requirements.txt b/embedchain/examples/sadhguru-ai/requirements.txt deleted file mode 100644 index bba32905a..000000000 --- a/embedchain/examples/sadhguru-ai/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -embedchain -streamlit -pysqlite3-binary \ No newline at end of file diff --git a/embedchain/examples/slack_bot/Dockerfile b/embedchain/examples/slack_bot/Dockerfile deleted file mode 100644 index 1b07f204b..000000000 --- a/embedchain/examples/slack_bot/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.11-slim - -WORKDIR /usr/src/ -COPY requirements.txt . -RUN pip install -r requirements.txt - -COPY . . - -EXPOSE 8000 - -CMD ["python", "-m", "embedchain.bots.slack", "--port", "8000"] diff --git a/embedchain/examples/slack_bot/requirements.txt b/embedchain/examples/slack_bot/requirements.txt deleted file mode 100644 index af7258c94..000000000 --- a/embedchain/examples/slack_bot/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -slack-sdk==3.21.3 -flask==2.3.3 -fastapi-poe==0.0.16 \ No newline at end of file diff --git a/embedchain/examples/telegram_bot/.env.example b/embedchain/examples/telegram_bot/.env.example deleted file mode 100644 index cd80d5eff..000000000 --- a/embedchain/examples/telegram_bot/.env.example +++ /dev/null @@ -1,2 +0,0 @@ -TELEGRAM_BOT_TOKEN= -OPENAI_API_KEY= diff --git a/embedchain/examples/telegram_bot/.gitignore b/embedchain/examples/telegram_bot/.gitignore deleted file mode 100644 index ba288ed39..000000000 --- a/embedchain/examples/telegram_bot/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -__pycache__ -db -database -pyenv -venv -.env -trash_files/ diff --git a/embedchain/examples/telegram_bot/Dockerfile b/embedchain/examples/telegram_bot/Dockerfile deleted file mode 100644 index aed7b62eb..000000000 --- a/embedchain/examples/telegram_bot/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.11-slim - -WORKDIR /usr/src/ -COPY requirements.txt . -RUN pip install -r requirements.txt - -COPY . . - -EXPOSE 8000 - -CMD ["python", "telegram_bot.py"] diff --git a/embedchain/examples/telegram_bot/README.md b/embedchain/examples/telegram_bot/README.md deleted file mode 100644 index 21fc2df50..000000000 --- a/embedchain/examples/telegram_bot/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Telegram Bot - -This is a replit template to create your own Telegram bot using the embedchain package. To know more about the bot and how to use it, go [here](https://docs.embedchain.ai/examples/telegram_bot). \ No newline at end of file diff --git a/embedchain/examples/telegram_bot/requirements.txt b/embedchain/examples/telegram_bot/requirements.txt deleted file mode 100644 index 3f6614632..000000000 --- a/embedchain/examples/telegram_bot/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -flask==2.3.2 -requests==2.31.0 -python-dotenv==1.0.0 -embedchain \ No newline at end of file diff --git a/embedchain/examples/telegram_bot/telegram_bot.py b/embedchain/examples/telegram_bot/telegram_bot.py deleted file mode 100644 index 8ff8892b3..000000000 --- a/embedchain/examples/telegram_bot/telegram_bot.py +++ /dev/null @@ -1,66 +0,0 @@ -import os - -import requests -from dotenv import load_dotenv -from flask import Flask, request - -from embedchain import App - -app = Flask(__name__) -load_dotenv() -bot_token = os.environ["TELEGRAM_BOT_TOKEN"] -chat_bot = App() - - -@app.route("/", methods=["POST"]) -def telegram_webhook(): - data = request.json - message = data["message"] - chat_id = message["chat"]["id"] - text = message["text"] - if text.startswith("/start"): - response_text = ( - "Welcome to Embedchain Bot! Try the following commands to use the bot:\n" - "For adding data sources:\n /add-🚀 An Embedchain app powered with Unacademy\'s UPSC data! -
-""" -st.markdown(styled_caption, unsafe_allow_html=True) - -with st.expander(":grey[Want to create your own Unacademy UPSC AI?]"): - st.write( - """ - ```bash - pip install embedchain - ``` - - ```python - from embedchain import App - unacademy_ai_app = App() - unacademy_ai_app.add( - "https://unacademy.com/content/upsc/study-material/plan-policy/atma-nirbhar-bharat-3-0/", - data_type="web_page" - ) - unacademy_ai_app.chat("What is Atma Nirbhar 3.0?") - ``` - - For more information, checkout the [Embedchain docs](https://docs.embedchain.ai/get-started/quickstart). - """ - ) - -if "messages" not in st.session_state: - st.session_state.messages = [ - { - "role": "assistant", - "content": """Hi, I'm Unacademy UPSC AI bot, who can answer any questions related to UPSC preparation. - Let me help you prepare better for UPSC.\n -Sample questions: -- What are the subjects in UPSC CSE? -- What is the CSE scholarship price amount? -- What are different indian calendar forms? - """, - } - ] - -for message in st.session_state.messages: - role = message["role"] - with st.chat_message(role, avatar=assistant_avatar_url if role == "assistant" else None): - st.markdown(message["content"]) - -if prompt := st.chat_input("Ask me anything!"): - with st.chat_message("user"): - st.markdown(prompt) - st.session_state.messages.append({"role": "user", "content": prompt}) - - with st.chat_message("assistant", avatar=assistant_avatar_url): - msg_placeholder = st.empty() - msg_placeholder.markdown("Thinking...") - full_response = "" - - q = queue.Queue() - - def app_response(result): - llm_config = app.llm.config.as_dict() - llm_config["callbacks"] = [StreamingStdOutCallbackHandlerYield(q=q)] - config = BaseLlmConfig(**llm_config) - answer, citations = app.chat(prompt, config=config, citations=True) - result["answer"] = answer - result["citations"] = citations - - results = {} - - for answer_chunk in generate(q): - full_response += answer_chunk - msg_placeholder.markdown(full_response) - - answer, citations = results["answer"], results["citations"] - - if citations: - full_response += "\n\n**Sources**:\n" - sources = list(set(map(lambda x: x[1], citations))) - for i, source in enumerate(sources): - full_response += f"{i+1}. {source}\n" - - msg_placeholder.markdown(full_response) - st.session_state.messages.append({"role": "assistant", "content": full_response}) diff --git a/embedchain/examples/unacademy-ai/requirements.txt b/embedchain/examples/unacademy-ai/requirements.txt deleted file mode 100644 index bba32905a..000000000 --- a/embedchain/examples/unacademy-ai/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -embedchain -streamlit -pysqlite3-binary \ No newline at end of file diff --git a/embedchain/examples/whatsapp_bot/.env.example b/embedchain/examples/whatsapp_bot/.env.example deleted file mode 100644 index e570b8b55..000000000 --- a/embedchain/examples/whatsapp_bot/.env.example +++ /dev/null @@ -1 +0,0 @@ -OPENAI_API_KEY= diff --git a/embedchain/examples/whatsapp_bot/.gitignore b/embedchain/examples/whatsapp_bot/.gitignore deleted file mode 100644 index 2227fe3e2..000000000 --- a/embedchain/examples/whatsapp_bot/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -__pycache__ -db -database -pyenv -venv -.env -trash_files/ -.ideas.md \ No newline at end of file diff --git a/embedchain/examples/whatsapp_bot/Dockerfile b/embedchain/examples/whatsapp_bot/Dockerfile deleted file mode 100644 index 528f2eea6..000000000 --- a/embedchain/examples/whatsapp_bot/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.11-slim - -WORKDIR /usr/src/ -COPY requirements.txt . -RUN pip install -r requirements.txt - -COPY . . - -EXPOSE 8000 - -CMD ["python", "whatsapp_bot.py"] diff --git a/embedchain/examples/whatsapp_bot/README.md b/embedchain/examples/whatsapp_bot/README.md deleted file mode 100644 index 54cbf5c25..000000000 --- a/embedchain/examples/whatsapp_bot/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# WhatsApp Bot - -This is a replit template to create your own WhatsApp bot using the embedchain package. To know more about the bot and how to use it, go [here](https://docs.embedchain.ai/examples/whatsapp_bot). \ No newline at end of file diff --git a/embedchain/examples/whatsapp_bot/requirements.txt b/embedchain/examples/whatsapp_bot/requirements.txt deleted file mode 100644 index ea2517403..000000000 --- a/embedchain/examples/whatsapp_bot/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -Flask==2.3.2 -twilio==8.5.0 -embedchain \ No newline at end of file diff --git a/embedchain/examples/whatsapp_bot/run.py b/embedchain/examples/whatsapp_bot/run.py deleted file mode 100644 index 92e26be15..000000000 --- a/embedchain/examples/whatsapp_bot/run.py +++ /dev/null @@ -1,10 +0,0 @@ -from embedchain.bots.whatsapp import WhatsAppBot - - -def main(): - whatsapp_bot = WhatsAppBot() - whatsapp_bot.start() - - -if __name__ == "__main__": - main() diff --git a/embedchain/examples/whatsapp_bot/whatsapp_bot.py b/embedchain/examples/whatsapp_bot/whatsapp_bot.py deleted file mode 100644 index 50f9c16dd..000000000 --- a/embedchain/examples/whatsapp_bot/whatsapp_bot.py +++ /dev/null @@ -1,51 +0,0 @@ -from flask import Flask, request -from twilio.twiml.messaging_response import MessagingResponse - -from embedchain import App - -app = Flask(__name__) -chat_bot = App() - - -@app.route("/chat", methods=["POST"]) -def chat(): - incoming_message = request.values.get("Body", "").lower() - response = handle_message(incoming_message) - twilio_response = MessagingResponse() - twilio_response.message(response) - return str(twilio_response) - - -def handle_message(message): - if message.startswith("add "): - response = add_sources(message) - else: - response = query(message) - return response - - -def add_sources(message): - message_parts = message.split(" ", 2) - if len(message_parts) == 3: - data_type = message_parts[1] - url_or_text = message_parts[2] - try: - chat_bot.add(data_type, url_or_text) - response = f"Added {data_type}: {url_or_text}" - except Exception as e: - response = f"Failed to add {data_type}: {url_or_text}.\nError: {str(e)}" - else: - response = "Invalid 'add' command format.\nUse: addArticle Content
-Article content goes here.
- {ignored_tag} -Main article content goes here.
- {ignored_tag} -Markdown content goes here.
- {ignored_tag} -Main content goes here.
- {ignored_tag} -Container content goes here.
- {ignored_tag} -Section content goes here.
- {ignored_tag} -Generic article content goes here.
- {ignored_tag} -Main content goes here.
- {ignored_tag} -This is some test content.
-