From 01f647dca4ef0c018fdca25206c39fac2a7de0f0 Mon Sep 17 00:00:00 2001 From: LUV SINGH Date: Wed, 6 Nov 2024 03:36:17 +0530 Subject: [PATCH] testing ci/cd --- .github/workflows/ci-cd.yml | 2 + Sukoon.egg-info/PKG-INFO | 148 +++++++++++++++++++++++++++ Sukoon.egg-info/SOURCES.txt | 10 ++ Sukoon.egg-info/dependency_links.txt | 1 + Sukoon.egg-info/requires.txt | 11 ++ Sukoon.egg-info/top_level.txt | 1 + __init__.py | 2 + dist/Sukoon-0.1.0-py3-none-any.whl | Bin 0 -> 4743 bytes dist/sukoon-0.1.0.tar.gz | Bin 0 -> 7445 bytes pyproject.toml | 41 ++++++++ requirements.txt | 16 +-- tests/requirements.txt | 18 ---- tests/sukoon.py | 117 --------------------- tests/sukoon_api.py | 39 ------- 14 files changed, 224 insertions(+), 182 deletions(-) create mode 100644 Sukoon.egg-info/PKG-INFO create mode 100644 Sukoon.egg-info/SOURCES.txt create mode 100644 Sukoon.egg-info/dependency_links.txt create mode 100644 Sukoon.egg-info/requires.txt create mode 100644 Sukoon.egg-info/top_level.txt create mode 100644 __init__.py create mode 100644 dist/Sukoon-0.1.0-py3-none-any.whl create mode 100644 dist/sukoon-0.1.0.tar.gz create mode 100644 pyproject.toml delete mode 100644 tests/requirements.txt delete mode 100644 tests/sukoon.py delete mode 100644 tests/sukoon_api.py diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index a6e60b86..c93427e4 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -92,6 +92,8 @@ jobs: - name: Build project run: | + python -m pip install --upgrade pip + pip install build python -m build - name: Verify build artifacts diff --git a/Sukoon.egg-info/PKG-INFO b/Sukoon.egg-info/PKG-INFO new file mode 100644 index 00000000..64b36ba4 --- /dev/null +++ b/Sukoon.egg-info/PKG-INFO @@ -0,0 +1,148 @@ +Metadata-Version: 2.1 +Name: Sukoon +Version: 0.1.0 +Summary: Sukoon AI mental health support system +Author-email: Luv Singh +Project-URL: Homepage, https://github.com/luv-singh-ai/Sukoon +Keywords: mental health AI,chatbot +Classifier: Programming Language :: Python :: 3 +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: OS Independent +Requires-Python: >=3.10 +Description-Content-Type: text/markdown +Requires-Dist: fastapi>=0.70.0 +Requires-Dist: uvicorn>=0.15.0 +Requires-Dist: langgraph +Requires-Dist: langchain-community +Requires-Dist: langchain-core +Requires-Dist: langchain-openai +Requires-Dist: langchain +Requires-Dist: pytest>=6.2.5 +Requires-Dist: pytest-cov>=2.12.1 +Requires-Dist: pytest-html>=3.1.1 +Requires-Dist: flake8>=3.9.2 + +# Project Sukoon: Mental Health Support using AI +Sukoon Pic + +## Open Roles for Tech Tasks + +- [ ] Agent Building - help us build and refine current agents being used +- [ ] Agent Testing - help us do thorough testing of agents and workflow +- [ ] Evals - Improved accuracy and efficiency of the evaluation pipeline. +- [ ] Contribute in curating datasets and/or LLM Prompt Finetuning +- [ ] UI/UX improvements + +## Table of Contents + +- [Vision](#vision) +- [Project Progress](#project-progress) +- [Installation](#installation) +- [Contributing](#contributing) +- [Documentation](#documentation) +- [Issues](#issues) +- [Pull Requests](#pull-requests) +- [Volunteer](#volunteer) + +## Vision + +Project Sukoon aims to build open-source solutions and standards for using AI to address mental health challenges. Our goal is to apply Digital Public Infrastructure (DPI) knowledge and practices to help professionals explore and understand the latest advancements in AI and their applications to mental health use-cases specific to India. + +## 🚀 Project Progress + +1. Prototyped with [Crew AI agent framework](https://www.crewai.com/) +2. Developed backend and frontend using [LangGraph framework](https://www.langchain.com/langgraph) +3. Shifted to [AutoGen framework](https://microsoft.github.io/autogen/docs/tutorial/introduction/) based on expert consultation +4. Currently addressing web UI issues and agent loop problems with AutoGen +5. Planning to create API endpoints for LangGraph and integrate with WhatsApp API +6. Iterated and added more agents to the pipeline + +[Watch the video](https://drive.google.com/file/d/1zFL8nz0d8aqzHxJhFU0h-ScDdFaSkPeT/view?usp=drive_link) + +## Installation + +### Technical Architecture +![Technical Architecture](archive/tech_arch_2.png) + +This is Langgraph code. Code from AutoGen is in different branch. + +# LangGraph (Current Version) +``` +- Go to langgraph branch +- install all dependencies in your environment (pip install -r requirements.txt) +- run 'python sukoon_api.py' +- go to sukoon-frontend(cd sukoon-frontend), run 'npm start' to access it in your browser. +- alternatively use this vercel deployment to access it - https://sukoon-1.vercel.app +``` + +## Steps to add environment variables - +Create a .env file with: +``` +OPENAI_API_KEY = '' +LANGCHAIN_API_KEY = '' +``` +- Alternatively , try this: +``` +On Mac/Linux - +export OPENAI_API_KEY=your_api_key_here + +On Windows - +setx OPENAI_API_KEY "your_api_key_here" +``` + +# How to contribute 🤝 +There are few ways you can contribute to Sukoon + +- By providing feedback on the POC +- By raising issues in the issues section +- By contributing to the codebase based on the issues +- Join the Sukoon team by filling the p+ai volunteer form (https://peopleplus.ai/volunteer) and select the Sukoon project. +- Submit PRs to the respective branches (e.g. 'autogen' or 'langgraph') + +For detailed guidelines, please read the guidelines outlined in CONTRIBUTING.md + +The docs folder contains overall project documentation and related documents. To access or contribute to the documentation, please refer to docs/README.md. +e.g Please read the main doc here and feel free to add comments here - https://docs.google.com/document/d/1H8-oJmMy0r28kYup9vqt8VGDlY_cCFW_2M07XJxWpFU/edit?usp=sharing + +## Issues + +If you encounter any issues with the project, please create a new issue using the issue template. Provide as much detail as possible to help us understand and resolve the issue. + +# Current Challenges +We have two active discussions: +``` +Develop a PII Removal Module for a Mental Health Care WhatsApp Chatbot +Improving Central Orchestrator Agent Classification in AutoGen System +``` + +# Current Landscape +Mental health support in India faces several challenges: + +* Stigma and discrimination +* Lack of awareness +* Shortage of trained mental healthcare personnel +* Affordability issues +* Low budget allocation for mental healthcare + +# What could a solution look like? (Tentative features) +* Very personal approach with focus on listening and emphasising +* Available in 22 Indic regional languages, especially on mobile devices +* Stores the user conversation locally, not on cloud -> ensuring complete privacy +* Will provide helpful resources for most common mental health problems. However, it'll not prescribe any medicines +* For training the bot , we can use federated learning +* Will be available as an API, so interested people can try this and build on top of it, based on their use case +* Aim is to get national-level adoption +* If serious, there’ll option to reach out to a psychiatrist or support community groups e.g. peer to peer network +* Have L1/L2/L3 level of support + +# Some interesting ideas to try: +* Can we gamify the whole conversation? If yes, then how? +* Can we nudge users to adopt healthier behaviour? +* In particular, we can warn users about what not to do - relying on superstitions, isolation, labelling, and other unhelpful tactics +* Give positive self-affirmation, create safety plan, etc +* Can we develop Emotional Intelligence that understands not just emotions, but context behind it +* Can we detect emotional status ike stress level using voice(like hume) and then support him +* Can we create a timeline tracker let’s say six month plan for meditation and track streak +* Can we give them a phone number they can call to? The bot will mainly listen , empathize and offer safe advice + +“Made for 🇮🇳 with ❤️ by People+AI” diff --git a/Sukoon.egg-info/SOURCES.txt b/Sukoon.egg-info/SOURCES.txt new file mode 100644 index 00000000..70ee8d74 --- /dev/null +++ b/Sukoon.egg-info/SOURCES.txt @@ -0,0 +1,10 @@ +README.md +pyproject.toml +sukoon_api.py +Sukoon.egg-info/PKG-INFO +Sukoon.egg-info/SOURCES.txt +Sukoon.egg-info/dependency_links.txt +Sukoon.egg-info/requires.txt +Sukoon.egg-info/top_level.txt +tests/test_api.py +tests/test_sukoon.py \ No newline at end of file diff --git a/Sukoon.egg-info/dependency_links.txt b/Sukoon.egg-info/dependency_links.txt new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/Sukoon.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/Sukoon.egg-info/requires.txt b/Sukoon.egg-info/requires.txt new file mode 100644 index 00000000..61c5c58e --- /dev/null +++ b/Sukoon.egg-info/requires.txt @@ -0,0 +1,11 @@ +fastapi>=0.70.0 +uvicorn>=0.15.0 +langgraph +langchain-community +langchain-core +langchain-openai +langchain +pytest>=6.2.5 +pytest-cov>=2.12.1 +pytest-html>=3.1.1 +flake8>=3.9.2 diff --git a/Sukoon.egg-info/top_level.txt b/Sukoon.egg-info/top_level.txt new file mode 100644 index 00000000..087ec7e4 --- /dev/null +++ b/Sukoon.egg-info/top_level.txt @@ -0,0 +1 @@ +sukoon_api diff --git a/__init__.py b/__init__.py new file mode 100644 index 00000000..155f7050 --- /dev/null +++ b/__init__.py @@ -0,0 +1,2 @@ +# Version of the sukoon package +__version__ = "0.1.0" \ No newline at end of file diff --git a/dist/Sukoon-0.1.0-py3-none-any.whl b/dist/Sukoon-0.1.0-py3-none-any.whl new file mode 100644 index 0000000000000000000000000000000000000000..4900824237affb6a3e2fc287d7ffd4b45b39efc5 GIT binary patch literal 4743 zcmai&1yEeeo`;9Q9TF1!4jO!L4?YBU8QcjP7+}x@cLoU_+~(pg0fGhs!JS}1gA9R- z1cJ+Q->coXH?^rfUEN*hRQFe1U0_5`Y0OYZ7yXu8g*HupQhRobg1`< zx}+}4Qq0f#9N#DKv{WiH6K~#dPm%OHr)96XPMbwT26^P_*g`n8Ip)#Z_LPpv551vy z27FxL3{dCSmF4HMhQ;lXj&9k>1w z{B#s&quRq>ltms1Ncq_@-YLM)b0`n{>wG_d*m$xR$#}@ZRJ^b7l>3JfEVaz1QLv^C z4P+9>I~1K6xv+7z=*Dg=zVuF_LL%z&kYuKYs4oqD2Ft~WitD`A-eJ|CW!}P` zJi(a>aF&1bx!Owt*gA~ZX5?O{eobqAl8sh%HfBJjbBP^Vj!P859iW<7(?M3k$xo>0 zpqHR6s~7yX9@?+W_L6*;5Zr6wA!I5&ytLW>Y5QlE`{*iR4csr3-KWjWRsSBK`9DT| zthF_??E0n-B>(^>C;$M^gHbyFGKz}_%nRlL+c&if6bY=Vv)I7cl zJ?c1tT5N?PA-##4Y8$MH?T-hOJ|}XfN>;X*fHCDl_y^u%$OZ9J<-J+@mh0`L)4JK7 z-m!mp44S_Q^Irz+$ax7pS&{?V!-dVd0@gCz`BK%r%*qxWbq=DJeOUb1@S9kwGwXP5 z1wae&-Wz|R%GvM?#}_Rp_YktF>f2UGn}ZiULVC82Ec+v3dXSF(IMrpX@R`e8kyp<) zl+$|?FN9p51(v0hx$AAk#r-K61$I11RyNt${s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Z6) zYVj#S<+Ig{NU(d_NsyuF-yf)jg`8Lh%pbT2%~bDy&WH`LbDLnRv5mZtaA^Ea0#;U5f;ZC z;Not1(T(9|bIK_}D?v{s6v9=C)!RXSSD~pLSjW8i7V|pjmC6l}D=sbt$lOg*XMaaO zxi7s{?#q?b)#_R?=#%Mkm^C$9*OpNC38X}kIK9$`FZ&ypfLzGTJG=$MNsO?WwcObE zHX5sronm+}j7>2kr&$eOsMDk)dJzH1YwB<7FLTdzKeeNAWh;`(!e|Wcj0rb{)fmlL zB4yml^nh?t0+dfUI)=V+Q$ zCv%Yo{%8w5bmkl4Rn-jI8CKnt@~YIN;Vya)f#EHwJM{#azSZU@0iAJGlm-=NPSnjE z8i!r+RCP)gp+m-oy!)N=oimS(m?}OaKQ=f6hIf40ys%UR3iD2w z>~E|tgHs%X#(YCWAqlK={;9{9!R1{1vSeqAwIBn}M~_`-r1<;(3abBfI%;+3!dz?`e!@q?aj=qQtba~>wtEActJUFt- zC9~l;R>`Af8412lyHJpusm|ARn$)p;Wznm
`|l6U9TeX)7VkNZ(ixw$v~$}UM$-%se&1r;p6I!3(7;vb(9G< z46dp56x7)wN=K5q6R7dZdF&o!{+P@59n*ay$27RDvMCkm?{#%O zk3m%)T=3wcRn%`>#c%%RwqCBS*R@K2BXAn#bbD+HE%Q_m;HEL>jrHkn;C{L4IFJ}E zJr8=}QhqDrqHwWh(PZd2Q##k_XC!|iH4^=*{GV)Z;h6yk@ekWA>8G@u($kjR zZb)kM>p1i?XO00-9Qm4R0NZr2oUzrkWkqq&eQCAOde4aQU<(FoW4mc^|H?G=42", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "Sukoon" +version = "0.1.0" +description = "Sukoon AI mental health support system" +authors = [ + { name = "Luv Singh", email = "luv@peopleplus.ai" } +] +readme = "README.md" +requires-python = ">=3.10" +license = { file = "LICENSE" } +keywords = ["mental health AI", "chatbot"] +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +] +dependencies = [ + "fastapi>=0.70.0", + "uvicorn>=0.15.0", + "langgraph", + "langchain-community", + "langchain-core", + "langchain-openai", + "langchain", + "pytest>=6.2.5", + "pytest-cov>=2.12.1", + "pytest-html>=3.1.1", + "flake8>=3.9.2" +] + +[project.urls] +"Homepage" = "https://github.com/luv-singh-ai/Sukoon" + +[tool.setuptools] +py-modules = ["sukoon_api"] # This tells setuptools that sukoon_api.py is a module \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index dd801bc9..91614cba 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,16 +3,16 @@ langchain-community langchain-core langchain-openai langchain +fastapi +uvicorn +pytest langgraph-sdk -# langgraph-checkpoint-sqlite -# langsmith +llama-index +uptrain +langgraph-checkpoint-sqlite +langsmith # langchainhub==0.1.15 # langchain-openai==0.1.3 # langchain==0.1.16 # langchain-core==0.1.42 -# pygraphviz==1.12 -llama-index -fastapi -uvicorn -pytest -uptrain \ No newline at end of file +# pygraphviz==1.12 \ No newline at end of file diff --git a/tests/requirements.txt b/tests/requirements.txt deleted file mode 100644 index dd801bc9..00000000 --- a/tests/requirements.txt +++ /dev/null @@ -1,18 +0,0 @@ -langgraph -langchain-community -langchain-core -langchain-openai -langchain -langgraph-sdk -# langgraph-checkpoint-sqlite -# langsmith -# langchainhub==0.1.15 -# langchain-openai==0.1.3 -# langchain==0.1.16 -# langchain-core==0.1.42 -# pygraphviz==1.12 -llama-index -fastapi -uvicorn -pytest -uptrain \ No newline at end of file diff --git a/tests/sukoon.py b/tests/sukoon.py deleted file mode 100644 index e70b7e8b..00000000 --- a/tests/sukoon.py +++ /dev/null @@ -1,117 +0,0 @@ -from langchain_core.messages import SystemMessage, HumanMessage, AIMessage -from pydantic import BaseModel, Field -from langgraph.graph.message import AnyMessage, add_messages -from typing import Literal, Annotated -from langchain_core.prompts import ChatPromptTemplate -from langgraph.graph import StateGraph, START, END -from langgraph.checkpoint.memory import MemorySaver -from typing import TypedDict, List -from openai import OpenAI -import os -from langchain_openai import ChatOpenAI -import yaml - -from dotenv import load_dotenv, find_dotenv -_ = load_dotenv(find_dotenv()) - -import logging -logger = logging.getLogger(__name__) - -# Define the state -class State(TypedDict): - messages: Annotated[list[AnyMessage], add_messages] - -openai_api_key = os.getenv("OPENAI_API_KEY") -def load_prompts(file_path='prompts.yaml'): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -prompts = load_prompts() -# Initialize OpenAI model -# model = llm -model = ChatOpenAI(model="gpt-4o", temperature=0.7) - -# Define prompts -planner_prompt = ChatPromptTemplate.from_messages([ - ("system", "You are a planner agent that decides which specialized agent to call based on the user's input. If the query indicates a risk of suicide or self-harm, respond with 'suicide_prevention'. Otherwise, respond with 'conversational'."), - ("human", "{input}"), -]) - -conversational_prompt = ChatPromptTemplate.from_messages([ - ("system", prompts['empathetic_agent_prompt']), - ("human", "{input}"), -]) - -suicide_prevention_prompt = ChatPromptTemplate.from_messages([ - ("system", prompts['suicide_prevention_agent_prompt']), - ("human", "{input}"), -]) - -# Define router -def route_query(state: State): - class RouteQuery(BaseModel): - """Route a user query to the most relevant node.""" - route: Literal["conversational", "suicide_prevention"] = Field( - ..., - description="Given a user question choose to route it to normal conversation or a suicide prevention.", - ) - # If we may want to specify 2 or more agents we can do that, too, by updating our schema to accept a List: - # route: List[Literal["conversational", "suicide_prevention"]] = Field( - structured_llm_router = model.with_structured_output(RouteQuery) - question_router = planner_prompt | structured_llm_router - last_message = state["messages"][-1] - resp = question_router.invoke({"input": last_message}) - return resp.route - -def run_conversational_agent(state: State): - print("Running conversational agent") - convo_model = conversational_prompt | model - response = convo_model.invoke(state["messages"]) - return {"messages": response} - -def run_suicide_prevention_agent(state: State): - print("Running suicide prevention agent") - concern_model = suicide_prevention_prompt | model - response = concern_model.invoke(state["messages"]) - return {"messages": response} - -# Create the graph -workflow = StateGraph(State) - -# Add nodes -workflow.add_node("conversational", run_conversational_agent) -workflow.add_node("suicide_prevention", run_suicide_prevention_agent) - -# Add edges -workflow.add_conditional_edges( - START, - route_query, - { - "conversational": "conversational", - "suicide_prevention": "suicide_prevention" - }, -) -workflow.add_edge("conversational", END) -workflow.add_edge("suicide_prevention", END) - -# Compile the graph -memory = MemorySaver() -graph = workflow.compile(checkpointer=memory) - -# Function to run a conversation turn -def chat(message: str, config: dict): - # print("User:", message) - result = graph.invoke({"messages": [HumanMessage(content=message)]}, config=config) - return result["messages"][-1] - -if __name__ == "__main__": - config = {"configurable": {"thread_id": "1"}} - while True: - user_input = input("You: ") - if user_input.lower() in ["exit", "quit"]: - print("Bot: Goodbye!") - break - # response = chat("Hi! I'm feeling really stressed about my exams", config) - # print("Bot:", response.content) - response = chat(user_input, config) - print("Sukoon:", response.content) \ No newline at end of file diff --git a/tests/sukoon_api.py b/tests/sukoon_api.py deleted file mode 100644 index 55850a6c..00000000 --- a/tests/sukoon_api.py +++ /dev/null @@ -1,39 +0,0 @@ -from fastapi import FastAPI -from pydantic import BaseModel -from typing import TypedDict, Annotated -import uvicorn - -from sukoon import chat - -from fastapi.middleware.cors import CORSMiddleware - -app = FastAPI(title="Sukoon", description="API for the Sukoon mental health support system") - -# Add CORS middleware -app.add_middleware( - CORSMiddleware, - allow_origins=["*"], # Allows all origins - allow_credentials=True, - allow_methods=["*"], # Allows all methods - allow_headers=["*"], # Allows all headers -) - -class SukoonRequest(BaseModel): - input: str - -class SukoonResponse(BaseModel): - output: str - -@app.post("/query", response_model = SukoonResponse) -async def process_query(request: SukoonRequest): - config = {"configurable": {"thread_id":"1"}} - user_input = request.input - response = chat(user_input, config) - return SukoonResponse(output = response.content) - -@app.get("/") -async def root(): - return {"message": "Welcome to the Sukoon API. Use the /query endpoint to interact with the system."} - -if __name__ == "__main__": - uvicorn.run(app, host = "127.0.0.1", port = 8001) \ No newline at end of file