Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

Update Sadhguru AI code (#1037)

Deshraj Yadav7ee2d0653b68
diff --git a/embedchain/cli.py b/embedchain/cli.py
index 199d43ee1..ba555b195 100644
--- a/embedchain/cli.py
+++ b/embedchain/cli.py
@@ -20,6 +20,7 @@ def cli():
anonymous_telemetry = AnonymousTelemetry()
+
def get_pkg_path_from_name(template: str):
try:
# Determine the installation location of the embedchain package
@@ -34,7 +35,7 @@ def get_pkg_path_from_name(template: str):
if not os.path.exists(src_path):
console.print(f"❌ [bold red]Template '{template}' not found.[/bold red]")
return
-
+
return src_path
@@ -71,9 +72,7 @@ def setup_modal_com_app(extra_args):
@click.option("--template", default="fly.io", help="The template to use.")
@click.argument("extra_args", nargs=-1, type=click.UNPROCESSED)
def create(template, extra_args):
- anonymous_telemetry.capture(
- event_name="ec_create", properties={"template_used": template}
- )
+ anonymous_telemetry.capture(event_name="ec_create", properties={"template_used": template})
src_path = get_pkg_path_from_name(template)
shutil.copytree(src_path, os.getcwd(), dirs_exist_ok=True)
env_sample_path = os.path.join(src_path, ".env.example")
@@ -134,9 +133,7 @@ def dev(debug, host, port):
embedchain_config = json.load(file)
template = embedchain_config["provider"]
- anonymous_telemetry.capture(
- event_name="ec_dev", properties={"template_used": template}
- )
+ anonymous_telemetry.capture(event_name="ec_dev", properties={"template_used": template})
if template == "fly.io":
run_dev_fly_io(debug, host, port)
elif template == "modal.com":
@@ -223,9 +220,7 @@ def deploy():
embedchain_config = json.load(file)
template = embedchain_config["provider"]
- anonymous_telemetry.capture(
- event_name="ec_deploy", properties={"template_used": template}
- )
+ anonymous_telemetry.capture(event_name="ec_deploy", properties={"template_used": template})
if template == "fly.io":
deploy_fly()
elif template == "modal.com":
diff --git a/embedchain/deployment/fly.io/app.py b/embedchain/deployment/fly.io/app.py
index b129b789f..75539a65f 100644
--- a/embedchain/deployment/fly.io/app.py
+++ b/embedchain/deployment/fly.io/app.py
@@ -1,8 +1,8 @@
+from dotenv import load_dotenv
from fastapi import FastAPI, responses
from pydantic import BaseModel
from embedchain import Pipeline
-from dotenv import load_dotenv
load_dotenv(".env")
diff --git a/examples/sadhguru-ai/README.md b/examples/sadhguru-ai/README.md
index d3012d97e..e6ba224b2 100644
--- a/examples/sadhguru-ai/README.md
+++ b/examples/sadhguru-ai/README.md
@@ -1,6 +1,6 @@
## Sadhguru AI
-This directory contains the code used to implement [Sadhguru AI](https://sadhguru-ai.streamlit.app/) using Embedchain.
+This directory contains the code used to implement [Sadhguru AI](https://sadhguru-ai.streamlit.app/) using Embedchain. It is built on 3K+ videos and 1K+ articles of Sadhguru. You can find the full list of data sources [here](https://gist.github.com/deshraj/50b0597157e04829bbbb7bc418be6ccb).
## Run locally
diff --git a/examples/sadhguru-ai/app.py b/examples/sadhguru-ai/app.py
index 52df1da6d..70e9fe913 100644
--- a/examples/sadhguru-ai/app.py
+++ b/examples/sadhguru-ai/app.py
@@ -1,7 +1,9 @@
import csv
import queue
import threading
+from io import StringIO
+import requests
import streamlit as st
from embedchain import Pipeline as App
@@ -27,9 +29,12 @@ def read_csv_row_by_row(file_path):
@st.cache_resource
def add_data_to_app():
app = sadhguru_ai()
- file_path = "data.csv"
- for row in read_csv_row_by_row(file_path):
- app.add(row["url"], data_type="web_page")
+ url = "https://gist.githubusercontent.com/deshraj/50b0597157e04829bbbb7bc418be6ccb/raw/95b0f1547028c39691f5c7db04d362baa597f3f4/data.csv" # noqa:E501
+ response = requests.get(url)
+ csv_file = StringIO(response.text)
+ for row in csv.reader(csv_file):
+ if row and row[0] != "url":
+ app.add(row[0], data_type="web_page")
app = sadhguru_ai()
diff --git a/examples/sadhguru-ai/data.csv b/examples/sadhguru-ai/data.csv
deleted file mode 100644
index 1011b3533..000000000
--- a/examples/sadhguru-ai/data.csv
+++ /dev/null
@@ -1,50 +0,0 @@
-data_type,url,topic
-Article,https://isha.sadhguru.org/in/en/wisdom/article/divorce-remarriage,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/parenting-for-teenager,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/find-fulfillment-in-life,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/women-pursue-career,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/child-no-need-instruction-manual,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/sadhuru-most-popular-blogs-2018,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/children-connect-nature,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/family-matters,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/how-should-parents-influence-lives,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/why-youth-turning-to-alcohol-drugs,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/self-doubt-growth-pangs,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/how-much-freedom-for-kids,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/how-chakras-form-in-fetus,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/attention-deficit-disorder,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/creating-right-atmosphere-children-flower,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/fathers-sons-karan-johar-conversation-sadhguru,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/disability-not-take-away-joy,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/when-parents-quarrel-what-do-you-do,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/mother-in-law-demystified,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/childlessness-bad-omen-or-blessing,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/parenting-without-nonsense,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/education-not-production-line,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/6-tips-to-be-a-truly-great-parent,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/dont-have-one-more,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/sadhgurus-message-to-parents-students-and-teachers,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/a-solution-for-generational-clash,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/education-without-competition,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/do-children-with-disabilities-suffer,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/a-sense-of-wonder,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/5-sadhguru-quotes-on-national-youth-day,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/when-a-child-comes-a-webcomic,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/childrens-day-5-awesome-activities-for-you-your-kids,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/rethinking-education-systems,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/3-back-to-school-tips-for-parents,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/children-discipline-best-way,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/colonel-mn-rai-people-applaud-even-curtains-fall,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/parenting-advice-skills,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/consigli-ai-genitori-per-far-fiorire-i-figli,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/what-is-the-best-kind-of-parenting,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/love-your-kids-liberate-them,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/sadhguru-on-relationships,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/are-you-ready-to-become-a-parent,Parenting
-Article,https://isha.sadhguru.org/in/en/wisdom/article/mahabharat-ep74-what-does-it-take-to-bless-or-curse-someone,Mahabharat
-Article,https://isha.sadhguru.org/in/en/wisdom/article/mahabharat-ep73-king-and-nagas-story-of-retribution-revenge,Mahabharat
-Article,https://isha.sadhguru.org/in/en/wisdom/article/mahabharat-ep72-heaven-or-hell-yudhishthira-makes-unusual-choice,Mahabharat
-Article,https://isha.sadhguru.org/in/en/wisdom/article/mahabharat-ep71-draupadi-pandavas-after-kurukshetra-war,Mahabharat
-Article,https://isha.sadhguru.org/in/en/wisdom/article/mahabharat-ep70-why-karnas-talent-went-waste,Mahabharat
-Article,https://isha.sadhguru.org/in/en/wisdom/article/mahabharat-ep69-devotion-have-place-today,Mahabharat
-Article,https://isha.sadhguru.org/in/en/wisdom/article/mahabharat-ep-68-cyclical-existence-karma,Mahabharat