From 03de69e527498641cc4ba28484821d126f08657e Mon Sep 17 00:00:00 2001 From: shounakacharya Date: Wed, 8 Jan 2025 23:20:38 +0530 Subject: [PATCH 1/4] After adding Graph RAG code --- apps/graph_rag_demo/.env | 0 apps/graph_rag_demo/.gitignore | 19 + apps/graph_rag_demo/README.md | 100 + .../__pycache__/build_graph.cpython-312.pyc | Bin 0 -> 1501 bytes .../__pycache__/data_insert.cpython-312.pyc | Bin 0 -> 3584 bytes .../depth_first_search.cpython-312.pyc | Bin 0 -> 2109 bytes .../do_graphlookup.cpython-312.pyc | Bin 0 -> 1491 bytes .../find_relevant_chunks.cpython-312.pyc | Bin 0 -> 2124 bytes .../nodes_relationships.cpython-312.pyc | Bin 0 -> 37872 bytes apps/graph_rag_demo/addEmbeddings.js | 56 + apps/graph_rag_demo/addTags.js | 69 + apps/graph_rag_demo/build_graph.py | 31 + apps/graph_rag_demo/data_insert.py | 65 + apps/graph_rag_demo/depth_first_search.py | 50 + apps/graph_rag_demo/do_graphlookup.py | 41 + apps/graph_rag_demo/driver_code.py | 84 + apps/graph_rag_demo/environment.yml | 511 +++++ apps/graph_rag_demo/find_relevant_chunks.py | 76 + apps/graph_rag_demo/nodes_relationships.py | 367 ++++ apps/graph_rag_demo/package-lock.json | 1641 +++++++++++++++++ apps/graph_rag_demo/package.json | 18 + apps/graph_rag_demo/user-interaction.html | 178 ++ 22 files changed, 3306 insertions(+) create mode 100644 apps/graph_rag_demo/.env create mode 100644 apps/graph_rag_demo/.gitignore create mode 100644 apps/graph_rag_demo/README.md create mode 100644 apps/graph_rag_demo/__pycache__/build_graph.cpython-312.pyc create mode 100644 apps/graph_rag_demo/__pycache__/data_insert.cpython-312.pyc create mode 100644 apps/graph_rag_demo/__pycache__/depth_first_search.cpython-312.pyc create mode 100644 apps/graph_rag_demo/__pycache__/do_graphlookup.cpython-312.pyc create mode 100644 apps/graph_rag_demo/__pycache__/find_relevant_chunks.cpython-312.pyc create mode 100644 apps/graph_rag_demo/__pycache__/nodes_relationships.cpython-312.pyc create mode 100644 apps/graph_rag_demo/addEmbeddings.js create mode 100644 apps/graph_rag_demo/addTags.js create mode 100644 apps/graph_rag_demo/build_graph.py create mode 100644 apps/graph_rag_demo/data_insert.py create mode 100644 apps/graph_rag_demo/depth_first_search.py create mode 100644 apps/graph_rag_demo/do_graphlookup.py create mode 100644 apps/graph_rag_demo/driver_code.py create mode 100644 apps/graph_rag_demo/environment.yml create mode 100644 apps/graph_rag_demo/find_relevant_chunks.py create mode 100644 apps/graph_rag_demo/nodes_relationships.py create mode 100644 apps/graph_rag_demo/package-lock.json create mode 100644 apps/graph_rag_demo/package.json create mode 100644 apps/graph_rag_demo/user-interaction.html diff --git a/apps/graph_rag_demo/.env b/apps/graph_rag_demo/.env new file mode 100644 index 0000000..e69de29 diff --git a/apps/graph_rag_demo/.gitignore b/apps/graph_rag_demo/.gitignore new file mode 100644 index 0000000..40b6f60 --- /dev/null +++ b/apps/graph_rag_demo/.gitignore @@ -0,0 +1,19 @@ +# Ignore Mac system files +.DS_store + +# Ignore node_modules folder +node_modules + +# Ignore all text files +*.txt + +# Ignore files related to API keys +./.env +./.gitignore + +# Ignore SASS config files +.sass-cache +#Ignore PDF Files +PDF_KG +.sass-cache + diff --git a/apps/graph_rag_demo/README.md b/apps/graph_rag_demo/README.md new file mode 100644 index 0000000..297a5e3 --- /dev/null +++ b/apps/graph_rag_demo/README.md @@ -0,0 +1,100 @@ +# kg_graph__rag_mongo +This guide explores how to leverage MongoDB's capabilities to create and manipulate graph representations using both Python and Node.js. By utilizing these two popular programming languages, we can demonstrate the versatility of MongoDB in different development environments, showcasing how to perform essential Graph RAG to represent and analyze graphs can provide valuable insights into complex relationships and interactions within data combining the Graph and RAG data in MongoDB. + + +## Prep Steps +1. Set Up Your MongoDB Database: + + Set up a Atlas a [cloud-based MongoDB instance of MongoDB.](https://www.mongodb.com/docs/atlas/tutorial/create-new-cluster/) + +2. Install Required Libraries: + For Python: + Please do a regular installation of Anaconda for your Operating System using the [doc](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html) + Once conda is installed, open up a shell with the Conda CLI, change to this directory and create a new environment with the packages listed in the requirements.txt by executing the following statement: + + ```bash + conda env create -f environment.yaml + conda activate kg-demo +``` + For Node.js: + For the Node JS files we have a package.json and you will be able to use npm install to install all the packages needed. Our Code was tested on Node version v20.15.0 and npm version 10.7.0 + +3. Now open the .env file in the directory and populate the following three variables. Please note that the .env file may be empty when you clone this repository + OPENAI_API_KEY1= + ATLAS_CONNECTION_STRING= + PDF = + +4. Create the MongoDB Atlas Database: + Please note that ATLAS_CONNECTION_STRING and OPENAI_API_KEY1 should already be created in the environment file. + Please create a new MongoDB Atlas database called langchain_db + Create two collections named knowledge_graph and nodes_relationships + +5. Download and install **MongoDB Compass** for your platform by following the steps mentioned [here](https://www.mongodb.com/docs/compass/current/install/). Please ensure you install a compass version 1.40.0 or higher. Once installed, connect to your Atlas cluster by following the link [here](https://www.mongodb.com/docs/compass/current/connect/). + +6. Create vector index on the Compass UI for the embedding field for knowledge_graph collection. [Please refer to this document](https://www.mongodb.com/docs/compass/current/indexes/create-vector-search-index/). You can use the following json document for the index defination. Please name the vector index as vector_index + Sample: + ```json + { + "fields": [ { + "type": "vector", + "path": "embedding", + "numDimensions": 1536, + "similarity": "euclidean" + } ] + } + ``` + After this create an Atlas Search Index on the knowledge_graph collection. [Please refer this document](https://www.mongodb.com/docs/compass/current/indexes/create-search-index/). Please name the Atlas Search Index as default + + + + +## Running the application + +### If running for the first time +We have to setup the data in the collection. Please perform the following steps: + +1. Open an Anaconda Shell and navigate to the project directory. +2. Activate the kg-demo environment by issuing the below commands: +```bash +conda activate kg-demo +``` +3. Run the data_insert.py file by issuing the following command: +```bash +python data_insert.py +``` +4. Now open a OS shell which should have `node` installed. Navigate to the project directory and issue the following commands in the same order: +```bash +node addEmbeddings.js +``` +**Please note that if the above command does not end after 10-15 seconds, please terminate it using Ctrl+C** +And then +```bash +node addTags.js +``` +5. Now return to the Anaconda shell opened in Step 1 where you should already be there in the project directory and in the kg-demo environment and run the following command: +```bash +python driver_code.py +``` +This will ask for a question which you want to ask. You can give a question like **How is social support related to aging?**. +It will then ask about the Spanning Tree depth. You can give it a value of 2 or 3 for an optimal performance. +Enjoy + +### On Subsequent Runs +Data is already prepared. We just need to chat and ask questions. Please perform the following steps: + +1. Open an Anaconda Shell and navigate to the project directory. +2. Activate the kg-demo environment by issuing the below commands: +```bash +conda activate kg-demo +``` +3. Run the following command: +```bash +python driver_code.py +``` +This will ask for a question which you want to ask. You can give a question like **How is social support related to aging?**. +It will then ask about the Spanning Tree depth. You can give it a value of 2 or 3 for an optimal performance. + +The answer for this question should be something as below: + +**Social Support:Social factor Stress:Condition Diet:Lifestyle factor Physical Health:Condition Work Environment:Environment Job Satisfaction:Emotional state Aging:Condition Job Satisfaction:Condition Productivity:Condition Social Support:Activity Immune System:Biological system Cortisol:Hormone Cognitive Function:Function Immune System:System Diet:Activity Burnout:Condition Work Performance:Condition Heart Disease:Disease Cognitive Function:Condition Sleep Quality:Condition Inflammation:Biological process Social Support:Condition Productivity:Outcome Employee Turnover:Outcome Work Environment:Factor Diabetes:Disease Genetics:Biological factor Physical Activity:Activity Diet:Condition Obesity:Condition Heart Disease:Condition Social Support:Factor Social Relationships:Condition Sleep Quality:Health aspect Inflammation:Condition Diet:Factor Memory:Condition Blood Pressure:Condition Exercise:Activity Depression:Condition Anxiety:Condition Mental Health:Aspect Learning:Condition Sleep Quality:Aspect Stress:Concept Diet:Behavior Physical Health:Health aspect Anxiety:Emotional state Anxiety:Mental condition Depression:Mental condition Depression:Emotional state Physical Activity:Behavior Job Satisfaction:Psychological factor Mental Health:Health aspect Mental Health:Condition ----------- +Social support is related to aging through its impact on stress. Social support reduces stress, and since stress accelerates aging, having social support can indirectly slow down the aging process by reducing the level of stress experienced by individuals.** \ No newline at end of file diff --git a/apps/graph_rag_demo/__pycache__/build_graph.cpython-312.pyc b/apps/graph_rag_demo/__pycache__/build_graph.cpython-312.pyc new file mode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4N3FFB=abw@<#W6f54*mtB CR!Wxu literal 0 HcmV?d00001 diff --git a/apps/graph_rag_demo/__pycache__/data_insert.cpython-312.pyc b/apps/graph_rag_demo/__pycache__/data_insert.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8c6c1f7d7c28246a7966129218815b6a2136ccc4 GIT binary patch literal 3584 zcmcInO>7&-6`tiTmw!u&5=s47GWF}9m1H@t4F`$sSbwP@z?Ol?t!-8TL36h>spU_1 zmvtztTmy9hs!<>XJy@wzL_Jlld(g3m9x9&#v?#P@9MTgRG0;560OG+)> zqK7WPnK$#^ym>S4y>A}>==Hi0eEHwpO&^cOO)KDtJ{dqa`-&h&T+Ik(_B)#AVQS$(?pb+y>1`o`?t5vl18Kpm#{#v@haI zw?tZi@4Sy9e!&H8tKf#VO$-R0h2sdxy*4De9@R{u5R8HX_lPnljB(q)aJ>y~fi1AS z@2^Cdr?7K68_%c3jLOs4dr6MvZd((Wnav6!=H3&fn3~LHl-tQ1Ebv^(W)j&cDM{AA zP|C)HsE}2~%nxD6=5lf}qt5a+Y|p@Q1>2=$WaYeHopM@qqqnX_pcY~BfV2?| z4M{>-(nNNN(NM~JkWWS$BiJ6*&ahkNN>!dB6sg@?XY!;V7D|a_$ zc@SLr34=5=hj@DS741MAeW zTmk!U<&%<7vn-m9<>bS#1M!OTb7=0NN+5La@@`9Tb#Zy|Lv0T^?PrVhZb#4h+{cSW zuF^hGZs+xOzUbKvb*^`R7XBn$3LW1J=%LZy&TVy zesg&1da3I|(O2O5^4lnw-N*G$Xa$nj;n1w`Gmg+?EuDG-uOOyM@N7JsM!Uak^g3skw=VQlTbV zUCr*bvD3Hz(0JIul@CyP4O?5MxUG1>;)Et&p%_-PEWvmee5w$Y%dJPGH=zo)+ zssoTrP>^RZ9Zd={xi;+Gk01(ms4*E(N8vdmg=KR6GKmPel{9UnA?xHIG=NtGpv)zh zjtPQHE)6qMQc-yhw-{gnFOK8~1m$53^b)n%zefQi zwFKAZmKTf6uGha7e9-Z6$A|OlgSz+dr}2%UU-7@>A7*s#Xwg<_39J^D3q_{lJ5=_C zbzgX0-WV$Rj)98K?uYiGx6&3YIw~ID8uQb)Dt&`{$l<-P#_jg>ZgAzk(|X_Oa^G3K z?`)~(&EL^_&$-`E{edfw&*|fHI!}n|ja9HCM%dxa{xO{rwyK7yi*o_{e7q zpDb+hThpcRTWg+5AiOd3ByhA6>|USIgGbB36MFE(rc@rgsE=KI8XSKye6~D%P9HwE z!=GQfv_A7Bc(mFAmQ?-7+f(KSbZ%gCU~BqM!OzpBnfaYWMjy<6$>m;f-3{jFZ9Ct+ zp%32tl8aQ2kZYoCCG*TGjs}+73u)8jf$W? zOCc2sKJ(M+v!tpJYQU<|0&PGny!rrC5Ul`wOv+=eYV?}j+6&(75CgXT$kyy_x2&g7 z0SzLR#GmmEAvv_f?z56@=(`EU<`R3CT^Tm}JJcQY0eutQp$7l!E|w(E%;JuTYnLbH zqElCAXWyN=Hgk10I(O~8nb}L2lVX_!yw%A}RJer$MgNfQAIel&BD;wY)S_k~8z)+(y0t?33_Qeg@4wwA(&fY9G6IwQBR&J9d5k)#P$= zr}I?F_btdFr?(hiaqqT5flzAgFS3m=rMGg+O3n4^ggT#i+bs?tH*!!Qle;A7Z literal 0 HcmV?d00001 diff --git a/apps/graph_rag_demo/__pycache__/depth_first_search.cpython-312.pyc b/apps/graph_rag_demo/__pycache__/depth_first_search.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..81266d2a4703bedae6d34058574475dd125a6d74 GIT binary patch literal 2109 zcma)8Uu+X~9KTfMWWLSd!w3)ZIO2mK54JGFdGUe7#Duqoz3oN6*R65l6u-&u&-eTL zem~#8*Yp9)(ge`e&(6ngTM6PfgJ}@jxU3o~bA(8IOk5x)QP3168!B*8u*|Sli?GiT zF`_`ivcR&!vcaOTWvqd<$q=KP8&X7I@l7`GXhhTkV$nJU`wMkRL)Xw0Z8yk*1KYOD!_mNo80;cS z9w7+%M{E@-!@9tT_5us}IWaS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al 0 HcmV?d00001 diff --git a/apps/graph_rag_demo/__pycache__/do_graphlookup.cpython-312.pyc b/apps/graph_rag_demo/__pycache__/do_graphlookup.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..246c9375f8f71e9494cc5db4ea9c8533d7a80516 GIT binary patch literal 1491 zcmah}%WvF77#}~^uieHC+az?ikYp3;qJ&2g2S7-9G^kR$mAXNwQIO?&jMs_Rw#Hua zkQX@Qu#tkojUG7k2=cV2R&gH2#ki(ok{ zf;?nk4hoQiVoX8F0Z{%%a44H@ zJ4F_V;B$86Qcv37`{x*`Jv65KwlQ4;;~>iJF_l*UDz>C3f1xY&bsvzMYe}C;J8yUQ zHEIp4GY`NTHU7WRdzzY3#X~cTcV=q(+`Ve`*4*OldsV%*c>i|w1FX1)XPb4y@pSkQ z4|+bdLLFJI5jnmW)}0{Szh z>DHADAuEiKV@5U0KxRGlcQ?&a6EW?Fn76I8AyL|ZSTt-KS+)^bm^XsJ@*oy(t((Ld zsS$HoD`U=d{m??>O#w~DVtNp|XEZD2YK_Qv zXoMD)Oy6}$X=wlZ}A*PtJ!t{x}+#hEPbMGvFNRkMbYjwZr8LKno zX3&PQJnx&$26=kn@~W+OlR$>8H_}JB4E-+DO=~*Xz{>M^B8@~zTR;4hEMI_MhF{!g ziygYm4ILK-cAaf!fB22V!kca8SS>xO9jc>kJ{cT&G<`6rwS}Zu-oJM9p!il>>hK_6 zOa_WyZFCrVsL)|pQR+w_e>EANO3LF&EmrFV#%q;LcVS63fsc74nx>yB+IVRmxZ(NbyD%x%;c;9zP~}u zYG6+gXD69GRh}JX_DWoejB+V5$)vP)dG=jK%i&zGksWQ;K3PkkE5sA#yWbp2zozV1 zzXPX)1n4?h&V=_GK5V+y`)Hc5=|>h`B@0Q5qE5g|Ct&1fAfAA0zXEwHe@c&0Wi&

Y}Tbk^(L?AmL`YbOnD)6{8GkXza&MFNBnRpeHXQW8W;QB7dA^-P_0*1OB> zx`~4gK5$5-qKZ=^0aCf3qH^LNK#yD!wW!O`o;da9HkCl_g*WTkLFK?$o_X)h`w5sMB8;$Lqnc0>1P;gSSWPU65iHvAQXFV;TdK(= zIigASKuswrHMOMH5~YNIVu;8$o~n$ncy&k5)b@$x8$uT=X&{lp14R28eH-ghBT0d1 zKPo*+DXk)`et}AZ4Y828&xH#Dljl6*OwRz6e8+VvZqc@g6U=hlc1>(xHz3Z%g2*IF z0@`3%KX5(6ybus-m_a~lUcg3{O)D^{>0q~JkQL8$K!s)6Y;f+~le5z^#`L>0#@i>) zO|6a}hSjy0f15P&mXp6=IXGWltUF77-tzNcc);{5V~I4%PaTZh9DrSf|JFmGUPTqu z60p#U;aE$=Vk?g0EeT64If$6~R*m(+K2VkVU>|5AEdMxg<0*G*pgB;L`XJU^f(Lptn~;oZ*4#!tj3Py@AG1~&zo{}M?hAB!=!eeU~D;+!zMNlPfi{y#F%6` zUOiw^&Ber~JjJW2iHoEhxOASFw7kf)E@nUxk`<=*l@uf{%xQ7Y3>I1PlRBY|vymv1 zY^!DkEalW|MJRd;n*s4xl?ji!Rp4MF(`Qak&l|`CglldF&D@c z!W)$GA;eU(QlX^6*<{lLRhX$KSIWc-EZ1R@M=b}UQMO&56tYYKpZw@1j@`1)(lvNj z)QN^~trEb^m4D+Z1d%&VC=-@gqE@#9%Y%nfx|f*G6G7)jkmpKi8fOhj+r38EVgTWTYnA)1jVgpL&!=*}Zr4!lquhqfc(? zli{v?;jUvH31z3YkeJQ3PjwVDGqzwbNq~BFi zYvvW@lJcY@0{Vo9BVzqB{n(#^(EYq;I#(3YFOx!X0^JnV;<$KIOBP4PnGxTYOn8WSHEoe#%>$4S0-_`lq)u UhuW!*tO)U~p<}`jeFJp=11w=BcK`qY literal 0 HcmV?d00001 diff --git a/apps/graph_rag_demo/__pycache__/nodes_relationships.cpython-312.pyc b/apps/graph_rag_demo/__pycache__/nodes_relationships.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5f52ff52d5ba0e19025141d29da62c30ddbd471b GIT bin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7xM3e>`X-;8+1KL481Wg9K>U6keDj*uMeP}Wl}ufFjuL(>fQMJZ_<|lL$~l=6 z=Q!a{`FK&lu%Qcnw_4o2ly#qSKS$xbu|dSkKGEzIvR-@(wy-_KHq)$ literal 0 HcmV?d00001 diff --git a/apps/graph_rag_demo/addEmbeddings.js b/apps/graph_rag_demo/addEmbeddings.js new file mode 100644 index 0000000..4962a69 --- /dev/null +++ b/apps/graph_rag_demo/addEmbeddings.js @@ -0,0 +1,56 @@ +import { RecursiveCharacterTextSplitter } from "langchain/text_splitter"; +import { MongoDBAtlasVectorSearch } from "@langchain/mongodb"; +import { OpenAIEmbeddings } from "@langchain/openai"; +import { MongoClient } from "mongodb"; +import { PDFLoader } from "langchain/document_loaders/fs/pdf"; +import dotenv from "dotenv"; +dotenv.config(); + +const client = new MongoClient(process.env.ATLAS_CONNECTION_STRING); +process.env.OPENAI_API_KEY = process.env.OPENAI_API_KEY1; + +async function run() { + try { + await client.connect(); + console.log('Connected to MongoDB successfully'); + const database = client.db("langchain_db"); + const collection = database.collection("knowledge_graph"); + const dbConfig = { + collection: collection, + indexName: "vector_index", // The name of the Atlas search index to use. + textKey: "chunks", // Field name for the raw text content. Defaults to "text". + embeddingKey: "embedding", // Field name for the vector embeddings. Defaults to "embedding". + }; + // Ensure that the collection is empty + await collection.deleteMany({}); + const pdfArray = [ + './PDF_KG/Diet, Stress and Mental Healt.pdf', + './PDF_KG/Effect of Stress Management Interventions on Job Stress among nurses working in critical care units.pdf', + './PDF_KG/Factors contributing to stress among parents of children with autism.pdf', + './PDF_KG/Level of physical activity, well-being, stress and self rated health in persons with migraine and co existing tension-type headache and neck pain.pdf', + './PDF_KG/Stress and Blood Pr ess and Blood Pressure During Pr e During Pregnancy Racial Diff egnancy Racial Differences.pdf', + './PDF_KG/Stress and Headache.pdf', + './PDF_KG/THE IMPACT OF STRESSFUL LIFE EVENTS ON RELAPSE OF GENERALIZED ANXIETY DISORDER.pdf', + './PDF_KG/where are we at with stress and headache.pdf' + ] + + // Load and split the sample data + pdfArray.forEach(async (pdfname) => { + console.log("Starting sync...", pdfname); + const loader = new PDFLoader(pdfname); + const data = await loader.load(); + const textSplitter = new RecursiveCharacterTextSplitter({ + chunkSize: 1000, + chunkOverlap: 200, + }); + const docs = await textSplitter.splitDocuments(data); + await MongoDBAtlasVectorSearch.fromDocuments(docs, new OpenAIEmbeddings(), dbConfig); + console.log("Ending sync...", pdfname); + }) + } catch (error){ + console.log(error) + } +} +run().catch(console.dir); + + diff --git a/apps/graph_rag_demo/addTags.js b/apps/graph_rag_demo/addTags.js new file mode 100644 index 0000000..d037d3f --- /dev/null +++ b/apps/graph_rag_demo/addTags.js @@ -0,0 +1,69 @@ +import { MongoClient } from "mongodb"; +import dotenv from "dotenv"; +dotenv.config(); + +async function findAllDocuments(dbName, collectionName1, collectionName2) { + const client = new MongoClient(process.env.ATLAS_CONNECTION_STRING); + try { + await client.connect(); + console.log('Connected to MongoDB'); + + // Access the database + const db = client.db(dbName); + + // Access the source and destination collections + const sourceCollection = db.collection(collectionName1); + const destinationCollection = db.collection(collectionName2); + + // Find all documents in the source collection + const documents = await sourceCollection.find({}, { projection: { _id: 1 } }).toArray() + console.log(`Found ${documents.length} documents in source collection`); + + // Insert documents into the destination collection + if (documents.length > 0) { + for (let i = 0; i < documents.length; i++) { + const idRepalce = documents[i]._id.replace(":", ' as a ') + console.log(idRepalce) + const agg = [ + { + $search: { + index: "default", + text: { + path: "chunks", + query: idRepalce, + }, + }, + }, + { + $addFields: { + tags: { + $cond: { + if: { $isArray: "$tags" }, + then: { $concatArrays: [ "$tags", [ {tagName: documents[i]._id, score: { $meta: "searchScore" }} ] ] }, + else: [{tagName: documents[i]._id, score: { $meta: "searchScore" }}] + } + } + } + }, + { + $merge: { + into: collectionName2, + whenMatched: "merge", + whenNotMatched: "discard" + } + } + ] + const newdocuments = await destinationCollection.aggregate(agg).toArray(); + console.log('Documents copied to destination collection', newdocuments.chunks); + } + } else { + console.log('No documents found in the source collection'); + } + } catch (err) { + console.error('Error connecting to the database or finding documents:', err); + } finally { + client.close(); + } +} + +findAllDocuments('langchain_db', 'nodes_relationships', 'knowledge_graph').catch(console.dir); \ No newline at end of file diff --git a/apps/graph_rag_demo/build_graph.py b/apps/graph_rag_demo/build_graph.py new file mode 100644 index 0000000..a670544 --- /dev/null +++ b/apps/graph_rag_demo/build_graph.py @@ -0,0 +1,31 @@ +from collections import defaultdict +def addEdge(graph,u,v): + graph[u].append(v) +def generate_edges(graph): + edges = [] + + # for each node in graph + for node in graph: + + # for each neighbour node of a single node + for neighbour in graph[node]: + + # if edge exists then append + edges.append((node, neighbour)) + return edges + +def build_graph(level_dict): + graph = defaultdict(list) + relationship_names = defaultdict(set) + for level in level_dict.keys(): + #print(f'Level is {level}') + for source,targets in level_dict[level].items(): + #print(f'Source is {source} and targets are {targets}') + for _,relationships in targets.items(): + #print(f'Target Node {target_node} and relationships {relationships}') + for target_node, edges in relationships.items(): + addEdge(graph,source,target_node) + relationship_key = (source,target_node) + for edge in edges: + relationship_names[relationship_key].add(edge) + return graph,relationship_names \ No newline at end of file diff --git a/apps/graph_rag_demo/data_insert.py b/apps/graph_rag_demo/data_insert.py new file mode 100644 index 0000000..47e48a3 --- /dev/null +++ b/apps/graph_rag_demo/data_insert.py @@ -0,0 +1,65 @@ +from langchain_core.documents import Document +from langchain_community.graphs.graph_document import GraphDocument, Node, Relationship +from pymongo import MongoClient +from dotenv import load_dotenv +from pprint import pprint +import os +import json +from nodes_relationships import nodes,links + +def build_lookup_map(): + quick_lookup = {} + for key in links.keys(): + relationship = links[key] + source_node = relationship.source + lookup_key = str(source_node.id)+":"+str(source_node.type) + lookup_content = quick_lookup.get(lookup_key,"empty") + if lookup_content != "empty": + quick_lookup.get(lookup_key).append(relationship) + else: + quick_lookup[lookup_key] = [relationship] + return quick_lookup + +def create_mongo_documents(): + mongo_documents = [] + quick_lookup = build_lookup_map() + for key in nodes.keys(): + node = nodes[key] + id = str(node.id)+":"+str(node.type) + type = node.type + rel = quick_lookup.get(id,None) + relationships = set() + targets = {} + if rel!=None: + for relationship in rel: + target_id = str(relationship.target.id)+":"+str(relationship.target.type) + relationships.add(target_id) + target_type = targets.get(target_id,None) + if target_type != None: + targets[target_id].append(relationship.type) + else: + targets[target_id] = [relationship.type] + mongo_documents.append({"_id":id,"type":type,"relationships":list(relationships),"targets":targets}) + else: + mongo_documents.append({"_id":id,"type":type,"relationships":[],"targets":{}}) + return mongo_documents + +def mongo_insert(): + mongo_documents = create_mongo_documents() + try: + uri = os.getenv("ATLAS_CONNECTION_STRING") + print(uri) + client = MongoClient(uri) + database = client["langchain_db"] + collection = database["nodes_relationships"] + for doc in mongo_documents: + collection.insert_one(doc) + except Exception as e: + print(e) + finally: + client.close() +if __name__=="__main__": + load_dotenv() + print("Inserting Documents") + mongo_insert() + print("Successfully Inserted Documents") \ No newline at end of file diff --git a/apps/graph_rag_demo/depth_first_search.py b/apps/graph_rag_demo/depth_first_search.py new file mode 100644 index 0000000..a9c13df --- /dev/null +++ b/apps/graph_rag_demo/depth_first_search.py @@ -0,0 +1,50 @@ +def depth_first_search(graph,start,relationship_names,path): + visited = [] + stack = [] + parent = [] + nodes = [] + links = [] + stack.append(start) + visited.append(start) + i = 0 + while stack: + s=stack.pop() + print(s,end=" ") + node = {'id':s,'group':0,'level':1,'label':s.split(":")[0]+' from '+s.split(":")[1]} + nodes.append(node) + if i!=0: + parent_node = parent[-1] + parent_name='' + current_child_count=0 + for x,y in parent_node.items(): + parent_name=x + current_child_count=y + relationships = relationship_names[(parent_name,s)] + #print(f'{relationships}') + rel_names='' + j=0 + if relationships: + for rel in relationships: + if j!=len(relationships)-1: + rel_names+=rel+" / " + else: + rel_names+=rel + j+=1 + path+= f'{parent_name.split(":")[0]} ({rel_names}) {s.split(":")[0]}, ' + link = {'source':parent_name,'target':s,'strength':0.7,'linkName':rel_names} + links.append(link) + current_child_count -= 1 + if current_child_count == 0: + parent.pop() + else: + parent[-1][parent_name]=current_child_count + k=0 + for x in graph[s][::-1]: + if x not in visited: + visited.append(x) + stack.append(x) + k+=1 + if k > 0: + parent.append({s:k}) + i+=1 + return path,nodes,links \ No newline at end of file diff --git a/apps/graph_rag_demo/do_graphlookup.py b/apps/graph_rag_demo/do_graphlookup.py new file mode 100644 index 0000000..ba2e499 --- /dev/null +++ b/apps/graph_rag_demo/do_graphlookup.py @@ -0,0 +1,41 @@ +from pymongo import MongoClient +from pprint import pprint +import os +from dotenv import load_dotenv + +load_dotenv() +def graph_lookup(node_name,max_depth): + + graph_lookup_docs = [] + try: + uri = os.getenv("ATLAS_CONNECTION_STRING") + client = MongoClient(uri) + database = client["langchain_db"] + collection = database["nodes_relationships"] + pipeline = [ + { + '$match': { + '_id': node_name + } + }, { + '$graphLookup': { + 'from': 'nodes_relationships', + 'startWith': '$_id', + 'connectFromField': 'relationships', + 'connectToField': '_id', + 'as': 'relates_to', + 'maxDepth': max_depth, + 'depthField': 'distance', + 'restrictSearchWithMatch': {} + } + } + ] + cursor = collection.aggregate(pipeline) + for doc in cursor: + graph_lookup_docs.append(doc) + except Exception as e: + print(e) + finally: + client.close() + pprint(graph_lookup_docs) + return graph_lookup_docs \ No newline at end of file diff --git a/apps/graph_rag_demo/driver_code.py b/apps/graph_rag_demo/driver_code.py new file mode 100644 index 0000000..0a63392 --- /dev/null +++ b/apps/graph_rag_demo/driver_code.py @@ -0,0 +1,84 @@ +from langchain_core.documents import Document +from langchain_community.graphs.graph_document import GraphDocument, Node, Relationship +from pymongo import MongoClient +from openai import OpenAI +from dotenv import load_dotenv +from pprint import pprint +from nodes_relationships import nodes,links +from data_insert import build_lookup_map, create_mongo_documents, mongo_insert +import os +import subprocess +from find_relevant_chunks import find_chunks +from do_graphlookup import graph_lookup +from build_graph import build_graph +from depth_first_search import depth_first_search + +if __name__ == "__main__": + load_dotenv() + open_ai_key = os.getenv("OPENAI_API_KEY1") + print(f"----OpenAI Key in Driver Code is {open_ai_key}") + openai_client = OpenAI(api_key=open_ai_key) +# print("Inserting documents") +# mongo_insert() +# print("Documents inserted successfully... Adding Embeddings") +# subprocess.run(["powershell","-Command","fnm env --use-on-cd | Out-String | Invoke-Expression\nnode addEmbeddings.js\n"]) +# print("Embeddings created successfully... Adding tags") +# subprocess.run(["powershell","-Command","fnm env --use-on-cd | Out-String | Invoke-Expression\nnode addTags.js\n"]) +# print("Tags added successfully") + question = input("Please enter your question ") + tree_depth = input("What is the maximum tree depth you require for Knowledge graph traversal? ") + tag_docs = find_chunks(question) + top_id_idx = 0 + top_tag_score = 0 + top_tag_idx = 0 + i=0 + for doc in tag_docs: + j=0 + for tag in doc['tags']: + if tag['score'] > top_tag_score: + top_tag_score = tag['score'] + top_id_idx = i + top_tag_idx=j + j+=1 + i+=1 + print(top_id_idx,top_tag_idx,top_tag_score) + node_name = tag_docs[top_id_idx]['tags'][top_tag_idx]['tagName'] + print(node_name) + graph_lookup_docs = graph_lookup(node_name,int(tree_depth)) + level_dict = {} + for graph_doc in graph_lookup_docs: + rel_docs = graph_doc['relates_to'] + for rel_doc in rel_docs: + level_key = rel_doc['distance'] + obj = level_dict.get(level_key,None) + targets = rel_doc['targets'] + id = rel_doc['_id'] + inner_dict = {"targets":targets} + if obj != None: + level_dict[level_key][id] = inner_dict + else: + level_dict[level_key]={} + level_dict[level_key][id] = inner_dict + pprint(level_dict) + graph,relationship_names = build_graph(level_dict) + path,nodes,links = depth_first_search(graph,node_name,relationship_names,'') + chunk = tag_docs[top_id_idx]['chunks'] + chunk = chunk + f"\n Entity Relationships: {path}" + prompt = f''' + You are a doctor who specialises in mental health and psychiatry. Please use the below context to answer {question} + Please note that the below text has relationship between various entities written after the text Entity Relationships: + The relationships are written in comma separated sentences with the relationship names between the entities written in brackets. There can be multiple + entity names which are given by slashes. You can chose any of the names to answer the question. Please only answer the question based upon the relationships + provided and context given and not from your own previous knowledge. + ''' + + response = openai_client.chat.completions.create( + model="gpt-4o", + messages=[ + {"role": "system", "content": prompt}, + {"role": "user", "content": chunk}, + ] + ) + print("-----------") + print(response.choices[0].message.content) + diff --git a/apps/graph_rag_demo/environment.yml b/apps/graph_rag_demo/environment.yml new file mode 100644 index 0000000..65d2660 --- /dev/null +++ b/apps/graph_rag_demo/environment.yml @@ -0,0 +1,511 @@ +name: kg-demo +channels: + - conda-forge + - defaults +dependencies: + - _anaconda_depends=2024.06 + - abseil-cpp=20211102.0 + - aiobotocore=2.12.3 + - aiohttp=3.9.5 + - aioitertools=0.7.1 + - aiosignal=1.2.0 + - alabaster=0.7.16 + - altair=5.0.1 + - anaconda-catalogs=0.2.0 + - annotated-types=0.6.0 + - anyio=4.2.0 + - aom=3.6.0 + - appdirs=1.4.4 + - archspec=0.2.3 + - argon2-cffi=21.3.0 + - argon2-cffi-bindings=21.2.0 + - arrow=1.2.3 + - arrow-cpp=14.0.2 + - astroid=2.14.2 + - astropy=6.1.0 + - astropy-iers-data=0.2024.6.3.0.31.14 + - asttokens=2.0.5 + - async-lru=2.0.4 + - atomicwrites=1.4.0 + - attrs=23.1.0 + - automat=20.2.0 + - autopep8=2.0.4 + - aws-c-auth=0.6.19 + - aws-c-cal=0.5.20 + - aws-c-common=0.8.5 + - aws-c-compression=0.2.16 + - aws-c-event-stream=0.2.15 + - aws-c-http=0.6.25 + - aws-c-io=0.13.10 + - aws-c-mqtt=0.7.13 + - aws-c-s3=0.1.51 + - aws-c-sdkutils=0.1.6 + - aws-checksums=0.1.13 + - aws-crt-cpp=0.18.16 + - aws-sdk-cpp=1.10.55 + - babel=2.11.0 + - bcrypt=3.2.0 + - beautifulsoup4=4.12.3 + - binaryornot=0.4.4 + - black=24.4.2 + - blas=1.0 + - bleach=4.1.0 + - blinker=1.6.2 + - blosc=1.21.3 + - bokeh=3.4.1 + - boltons=23.0.0 + - boost-cpp=1.82.0 + - botocore=1.34.69 + - bottleneck=1.3.7 + - brotli=1.0.9 + - brotli-bin=1.0.9 + - brotli-python=1.0.9 + - bzip2=1.0.8 + - c-ares=1.19.1 + - c-blosc2=2.12.0 + - ca-certificates=2024.8.30 + - cachetools=5.3.3 + - certifi=2024.8.30 + - cffi=1.16.0 + - cfitsio=3.470 + - chardet=4.0.0 + - charls=2.2.0 + - charset-normalizer=2.0.4 + - click=8.1.7 + - cloudpickle=2.2.1 + - colorama=0.4.6 + - colorcet=3.1.0 + - comm=0.2.1 + - conda-content-trust=0.2.0 + - conda-pack=0.7.1 + - conda-package-handling=2.3.0 + - conda-package-streaming=0.10.0 + - conda-repo-cli=1.0.88 + - constantly=23.10.4 + - contourpy=1.2.0 + - cookiecutter=2.6.0 + - cryptography=42.0.5 + - cssselect=1.2.0 + - curl=8.7.1 + - cycler=0.11.0 + - cytoolz=0.12.2 + - dask=2024.5.0 + - dask-core=2024.5.0 + - dask-expr=1.1.0 + - datashader=0.16.2 + - dav1d=1.2.1 + - debugpy=1.6.7 + - decorator=5.1.1 + - defusedxml=0.7.1 + - diff-match-patch=20200713 + - dill=0.3.8 + - distributed=2024.5.0 + - distro=1.9.0 + - docstring-to-markdown=0.11 + - docutils=0.18.1 + - entrypoints=0.4 + - et_xmlfile=1.1.0 + - executing=0.8.3 + - expat=2.6.2 + - filelock=3.13.1 + - flake8=7.0.0 + - flask=3.0.3 + - fmt=9.1.0 + - fonttools=4.51.0 + - freetype=2.12.1 + - frozendict=2.4.2 + - frozenlist=1.4.0 + - fsspec=2024.3.1 + - gensim=4.3.2 + - gflags=2.2.2 + - giflib=5.2.1 + - gitdb=4.0.7 + - gitpython=3.1.37 + - glog=0.5.0 + - greenlet=3.0.1 + - grpc-cpp=1.48.2 + - h5py=3.11.0 + - hdf5=1.12.1 + - heapdict=1.0.1 + - holoviews=1.19.0 + - hvplot=0.10.0 + - hyperlink=21.0.0 + - icc_rt=2022.1.0 + - icu=73.1 + - idna=3.7 + - imagecodecs=2023.1.23 + - imageio=2.33.1 + - imagesize=1.4.1 + - imbalanced-learn=0.12.3 + - importlib-metadata=7.0.1 + - incremental=22.10.0 + - inflection=0.5.1 + - iniconfig=1.1.1 + - intake=0.7.0 + - intel-openmp=2023.1.0 + - intervaltree=3.1.0 + - ipykernel=6.28.0 + - ipython_genutils=0.2.0 + - ipywidgets=7.8.1 + - isort=5.13.2 + - itemadapter=0.3.0 + - itemloaders=1.1.0 + - itsdangerous=2.2.0 + - jaraco.classes=3.2.1 + - jedi=0.18.1 + - jellyfish=1.0.1 + - jinja2=3.1.4 + - jmespath=1.0.1 + - joblib=1.4.2 + - jpeg=9e + - jq=1.6 + - json5=0.9.6 + - jsonpatch=1.33 + - jsonpointer=2.1 + - jsonschema=4.19.2 + - jsonschema-specifications=2023.7.1 + - jupyter=1.0.0 + - jupyter-lsp=2.2.0 + - jupyter_client=8.6.0 + - jupyter_console=6.6.3 + - jupyter_core=5.7.2 + - jupyter_events=0.10.0 + - jupyter_server=2.14.1 + - jupyter_server_terminals=0.4.4 + - jupyterlab=4.0.11 + - jupyterlab-variableinspector=3.1.0 + - jupyterlab_pygments=0.1.2 + - jupyterlab_server=2.25.1 + - jupyterlab_widgets=1.0.0 + - keyring=24.3.1 + - kiwisolver=1.4.4 + - krb5=1.20.1 + - lazy-object-proxy=1.10.0 + - lazy_loader=0.4 + - lcms2=2.12 + - lerc=3.0 + - libaec=1.0.4 + - libarchive=3.6.2 + - libavif=0.11.1 + - libboost=1.82.0 + - libbrotlicommon=1.0.9 + - libbrotlidec=1.0.9 + - libbrotlienc=1.0.9 + - libclang=14.0.6 + - libclang13=14.0.6 + - libcurl=8.7.1 + - libdeflate=1.17 + - libevent=2.1.12 + - libffi=3.4.4 + - libiconv=1.16 + - liblief=0.12.3 + - libmamba=1.5.8 + - libmambapy=1.5.8 + - libpng=1.6.39 + - libpq=12.17 + - libprotobuf=3.20.3 + - libsodium=1.0.18 + - libsolv=0.7.24 + - libspatialindex=1.9.3 + - libssh2=1.11.0 + - libthrift=0.15.0 + - libtiff=4.5.1 + - libwebp-base=1.3.2 + - libxml2=2.10.4 + - libxslt=1.1.37 + - libzopfli=1.0.3 + - linkify-it-py=2.0.0 + - llvmlite=0.42.0 + - locket=1.0.0 + - lxml=5.2.1 + - lz4=4.3.2 + - lz4-c=1.9.4 + - lzo=2.10 + - m2-msys2-runtime=2.5.0.17080.65c939c + - m2-patch=2.7.5 + - m2w64-libwinpthread-git=5.0.0.4634.697f757 + - markdown=3.4.1 + - markdown-it-py=2.2.0 + - markupsafe=2.1.3 + - matplotlib=3.8.4 + - matplotlib-base=3.8.4 + - matplotlib-inline=0.1.6 + - mccabe=0.7.0 + - mdit-py-plugins=0.3.0 + - mdurl=0.1.0 + - menuinst=2.1.1 + - mistune=2.0.4 + - mkl=2023.1.0 + - mkl-service=2.4.0 + - mkl_fft=1.3.8 + - mkl_random=1.2.4 + - more-itertools=10.1.0 + - mpmath=1.3.0 + - msgpack-python=1.0.3 + - msys2-conda-epoch=20160418 + - multidict=6.0.4 + - multipledispatch=0.6.0 + - mypy=1.10.0 + - mypy_extensions=1.0.0 + - nbclient=0.8.0 + - nbformat=5.9.2 + - nest-asyncio=1.6.0 + - networkx=3.2.1 + - nltk=3.8.1 + - notebook=7.0.8 + - notebook-shim=0.2.3 + - numba=0.59.1 + - numexpr=2.8.7 + - numpy=1.26.4 + - numpy-base=1.26.4 + - numpydoc=1.7.0 + - openjdk=11.0.13 + - openjpeg=2.4.0 + - openpyxl=3.1.2 + - openssl=3.0.14 + - orc=1.7.4 + - overrides=7.4.0 + - packaging=23.2 + - pandas=2.2.2 + - pandocfilters=1.5.0 + - panel=1.4.4 + - param=2.1.0 + - paramiko=2.8.1 + - parsel=1.8.1 + - parso=0.8.3 + - partd=1.4.1 + - pathspec=0.10.3 + - patsy=0.5.6 + - pcre2=10.42 + - pexpect=4.8.0 + - pickleshare=0.7.5 + - pillow=10.3.0 + - pip=24.0 + - pkce=1.0.3 + - pkginfo=1.10.0 + - platformdirs=3.10.0 + - plotly=5.22.0 + - pluggy=1.0.0 + - ply=3.11 + - prometheus_client=0.14.1 + - prompt-toolkit=3.0.43 + - prompt_toolkit=3.0.43 + - protego=0.1.16 + - psutil=5.9.0 + - ptyprocess=0.7.0 + - pure_eval=0.2.2 + - py-cpuinfo=9.0.0 + - py-lief=0.12.3 + - py4j=0.10.9.7 + - pyarrow=14.0.2 + - pyasn1=0.4.8 + - pyasn1-modules=0.2.8 + - pybind11-abi=5 + - pycodestyle=2.11.1 + - pycosat=0.6.6 + - pycparser=2.21 + - pyct=0.5.0 + - pycurl=7.45.2 + - pydeck=0.8.0 + - pydispatcher=2.0.5 + - pydocstyle=6.3.0 + - pyerfa=2.0.1.4 + - pyflakes=3.2.0 + - pygments=2.15.1 + - pyjwt=2.8.0 + - pylint=2.16.2 + - pylint-venv=3.0.3 + - pyls-spyder=0.4.0 + - pynacl=1.5.0 + - pyodbc=5.0.1 + - pyopenssl=24.0.0 + - pyparsing=3.0.9 + - pyqt=5.15.10 + - pyqt5-sip=12.13.0 + - pyqtwebengine=5.15.10 + - pysocks=1.7.1 + - pyspark=3.5.1 + - pytables=3.9.2 + - pytest=7.4.4 + - python=3.12.4 + - python-dateutil=2.9.0post0 + - python-dotenv=0.21.0 + - python-fastjsonschema=2.16.2 + - python-json-logger=2.0.7 + - python-libarchive-c=2.9 + - python-lmdb=1.4.1 + - python-lsp-black=2.0.0 + - python-lsp-jsonrpc=1.1.2 + - python-lsp-server=1.10.0 + - python-slugify=5.0.2 + - python-snappy=0.6.1 + - python-tzdata=2023.3 + - pytoolconfig=1.2.6 + - pytz=2024.1 + - pyviz_comms=3.0.2 + - pywavelets=1.5.0 + - pywin32=305 + - pywin32-ctypes=0.2.2 + - pywinpty=2.0.10 + - pyyaml=6.0.1 + - pyzmq=25.1.2 + - qdarkstyle=3.2.3 + - qstylizer=0.2.2 + - qt-main=5.15.2 + - qt-webengine=5.15.9 + - qtawesome=1.2.2 + - qtconsole=5.5.1 + - qtpy=2.4.1 + - queuelib=1.6.2 + - re2=2022.04.01 + - referencing=0.30.2 + - regex=2023.10.3 + - reproc=14.2.4 + - reproc-cpp=14.2.4 + - requests=2.32.2 + - requests-file=1.5.1 + - requests-toolbelt=1.0.0 + - rfc3339-validator=0.1.4 + - rfc3986-validator=0.1.1 + - rich=13.3.5 + - rope=1.12.0 + - rpds-py=0.10.6 + - rtree=1.0.1 + - ruamel.yaml=0.17.21 + - ruamel_yaml=0.17.21 + - s3fs=2024.3.1 + - scikit-image=0.23.2 + - scikit-learn=1.4.2 + - scipy=1.13.1 + - scrapy=2.11.1 + - seaborn=0.13.2 + - semver=3.0.2 + - send2trash=1.8.2 + - service_identity=18.1.0 + - setuptools=69.5.1 + - sip=6.7.12 + - six=1.16.0 + - smart_open=5.2.1 + - smmap=4.0.0 + - snappy=1.1.10 + - sniffio=1.3.0 + - snowballstemmer=2.2.0 + - sortedcontainers=2.4.0 + - soupsieve=2.5 + - sphinx=7.3.7 + - sphinxcontrib-applehelp=1.0.2 + - sphinxcontrib-devhelp=1.0.2 + - sphinxcontrib-htmlhelp=2.0.0 + - sphinxcontrib-jsmath=1.0.1 + - sphinxcontrib-qthelp=1.0.3 + - sphinxcontrib-serializinghtml=1.1.10 + - spyder=5.5.1 + - spyder-kernels=2.5.0 + - sqlalchemy=2.0.30 + - sqlite=3.45.3 + - stack_data=0.2.0 + - statsmodels=0.14.2 + - streamlit=1.32.0 + - sympy=1.12 + - tabulate=0.9.0 + - tbb=2021.8.0 + - tblib=1.7.0 + - tenacity=8.2.2 + - terminado=0.17.1 + - text-unidecode=1.3 + - textdistance=4.2.1 + - threadpoolctl=2.2.0 + - three-merge=0.1.1 + - tifffile=2023.4.12 + - tinycss2=1.2.1 + - tk=8.6.14 + - tldextract=3.2.0 + - toml=0.10.2 + - tomli=2.0.1 + - tomlkit=0.11.1 + - toolz=0.12.0 + - tornado=6.4.1 + - tqdm=4.66.4 + - traitlets=5.14.3 + - truststore=0.8.0 + - twisted=23.10.0 + - twisted-iocpsupport=1.0.2 + - typing-extensions=4.11.0 + - typing_extensions=4.11.0 + - tzdata=2024a + - uc-micro-py=1.0.1 + - ujson=5.10.0 + - unicodedata2=15.1.0 + - unidecode=1.2.0 + - urllib3=2.2.2 + - utf8proc=2.6.1 + - vc=14.2 + - vs2015_runtime=14.29.30133 + - w3lib=2.1.2 + - watchdog=4.0.1 + - wcwidth=0.2.5 + - webencodings=0.5.1 + - websocket-client=1.8.0 + - werkzeug=3.0.3 + - whatthepatch=1.0.2 + - wheel=0.43.0 + - widgetsnbextension=3.6.6 + - win_inet_pton=1.1.0 + - winpty=0.4.3 + - wrapt=1.14.1 + - xarray=2023.6.0 + - xlwings=0.31.4 + - xyzservices=2022.9.0 + - xz=5.4.6 + - yaml=0.2.5 + - yaml-cpp=0.8.0 + - yapf=0.40.2 + - yarl=1.9.3 + - zeromq=4.3.5 + - zfp=1.0.0 + - zict=3.0.0 + - zipp=3.17.0 + - zlib=1.2.13 + - zlib-ng=2.0.7 + - zope=1.0 + - zope.interface=5.4.0 + - zstandard=0.22.0 + - zstd=1.5.5 + - pip: + - backcall==0.2.0 + - dataclasses-json==0.6.7 + - dnspython==2.6.1 + - docopt==0.6.2 + - googleapis-common-protos==1.65.0 + - grpcio==1.66.1 + - grpcio-status==1.66.1 + - h11==0.14.0 + - httpcore==1.0.5 + - httpx==0.27.0 + - httpx-sse==0.4.0 + - ipython==8.12.3 + - jiter==0.8.2 + - langchain==0.3.10 + - langchain-community==0.3.10 + - langchain-core==0.3.23 + - langchain-experimental==0.3.3 + - langchain-openai==0.2.12 + - langchain-text-splitters==0.3.2 + - langsmith==0.1.147 + - marshmallow==3.21.3 + - nbconvert==7.16.5 + - openai==1.57.1 + - orjson==3.10.6 + - pipreqs==0.5.0 + - protobuf==5.28.0 + - pydantic==2.8.2 + - pydantic-core==2.20.1 + - pydantic-settings==2.6.1 + - pymongo==4.8.0 + - pymupdf==1.24.14 + - pymupdf4llm==0.0.17 + - pypdf==4.3.1 + - tiktoken==0.7.0 + - typing-inspect==0.9.0 + - utils==1.0.2 + - yarg==0.1.9 diff --git a/apps/graph_rag_demo/find_relevant_chunks.py b/apps/graph_rag_demo/find_relevant_chunks.py new file mode 100644 index 0000000..5c724f9 --- /dev/null +++ b/apps/graph_rag_demo/find_relevant_chunks.py @@ -0,0 +1,76 @@ +from openai import OpenAI +from pymongo import MongoClient +import os +from dotenv import load_dotenv +from tenacity import ( + retry, + stop_after_attempt, + wait_random_exponential, +) +load_dotenv() +open_ai_key = os.getenv("OPENAI_API_KEY1") +print(f"----OpenAI Key in find chunks is {open_ai_key}") +openai_client = OpenAI(api_key=open_ai_key) + + +''' +@retry(wait=wait_random_exponential(min=1, max=1), stop=stop_after_attempt(6)) +def chat_completion_backoff(**kwargs): + return openai_client.chat.completions.create(**kwargs) + +@retry(wait=wait_random_exponential(min=1, max=1), stop=stop_after_attempt(6)) +def embedding_create_backoff(**kwargs): + return openai_client.embeddings.create(**kwargs) +''' + +def find_chunks(question): + docs = [] + min_chunk_size = 500 + max_chunk_size = 2000 + delimiter = '. ' + #openai_client = OpenAI() + + k = 3 + multiplier = 10 + +# embeddings = embedding_create_backoff( +# input=question, +# model="text-embedding-ada-002" +# ) + + embeddings = openai_client.embeddings.create( + input=question, + model="text-embedding-ada-002" + ) + query_vector = embeddings.data[0].embedding + + agg_pipeline = [ + { + "$vectorSearch": { + "index":'vector_index', + "path": "embedding", + "queryVector": query_vector, + "limit": k, + "numCandidates": k * multiplier, + }, + }, + { + "$project": {"embedding": 0} + } + ] + + tag_docs = [] + + try: + uri = os.getenv("ATLAS_CONNECTION_STRING") + client = MongoClient(uri) + database = client["langchain_db"] + collection = database["knowledge_graph"] + cursor = collection.aggregate(agg_pipeline) + for tag in cursor: + tag_docs.append(tag) + except Exception as e: + print(e) + finally: + client.close() + return tag_docs \ No newline at end of file diff --git a/apps/graph_rag_demo/nodes_relationships.py b/apps/graph_rag_demo/nodes_relationships.py new file mode 100644 index 0000000..a2cb2cd --- /dev/null +++ b/apps/graph_rag_demo/nodes_relationships.py @@ -0,0 +1,367 @@ +from langchain_core.documents import Document +from langchain_community.graphs.graph_document import GraphDocument, Node, Relationship + +nodes = { +"node1":Node(id='Stress', type='Concept'), +"node2":Node(id='Heart Disease', type='Disease'), +"node3":Node(id='Burnout', type='Condition'), +"node4":Node(id='Mental Health', type='Aspect'), +"node5":Node(id='Physical Activity', type='Behavior'), +"node6":Node(id='Job Satisfaction', type='Emotional state'), +"node7":Node(id='Obesity', type='Condition'), +"node8":Node(id='Aging', type='Condition'), +"node9":Node(id='Diet', type='Condition'), +"node10":Node(id='Inflammation', type='Condition'), +"node11":Node(id='Genetics', type='Biological factor'), +"node12":Node(id='Depression', type='Condition'), +"node13":Node(id='Exercise', type='Lifestyle factor'), +"node14":Node(id='Memory', type='Condition'), +"node15":Node(id='Exercise', type='Factor'), +"node16":Node(id='Depression', type='Mental condition'), +"node17":Node(id='Employee Turnover', type='Outcome'), +"node18":Node(id='Social Support', type='Social factor'), +"node19":Node(id='Cognitive Function', type='Condition'), +"node20":Node(id='Job Satisfaction', type='Condition'), +"node21":Node(id='Social Support', type='Behavior'), +"node22":Node(id='Work Environment', type='Factor'), +"node23":Node(id='Job Satisfaction', type='Workplace factor'), +"node24":Node(id='Job Satisfaction', type='Psychological factor'), +"node25":Node(id='Immune System', type='Biological system'), +"node26":Node(id='Social Support', type='Factor'), +"node27":Node(id='Immune System', type='System'), +"node28":Node(id='Diet', type='Behavior'), +"node29":Node(id='Physical Health', type='Health aspect'), +"node30":Node(id='Productivity', type='Outcome'), +"node31":Node(id='Anxiety', type='Emotional state'), +"node32":Node(id='Sleep Quality', type='Health aspect'), +"node33":Node(id='Cortisol', type='Hormone'), +"node34":Node(id='Diet', type='Lifestyle factor'), +"node35":Node(id='Diet', type='Factor'), +"node36":Node(id='Social Relationships', type='Condition'), +"node37":Node(id='Mental Health', type='Health aspect'), +"node38":Node(id='Social Support', type='Aspect'), +"node39":Node(id='Work Environment', type='Environment'), +"node40":Node(id='Physical Health', type='Condition'), +"node41":Node(id='Exercise', type='Activity'), +"node42":Node(id='Physical Activity', type='Activity'), +"node43":Node(id='Cognitive Function', type='Function'), +"node44":Node(id='Sleep Quality', type='Condition'), +"node45":Node(id='Anxiety', type='Condition'), +"node46":Node(id='Mental Health', type='Condition'), +"node47":Node(id='Heart Rate', type='Physiological measure'), +"node48":Node(id='Anxiety', type='Mental condition'), +"node49":Node(id='Smoking', type='Activity'), +"node50":Node(id='Diet', type='Aspect'), +"node51":Node(id='Genetics', type='Factor'), +"node52":Node(id='Blood Pressure', type='Physiological measure'), +"node53":Node(id='Stress', type='Condition'), +"node54":Node(id='Social Support', type='Activity'), +"node55":Node(id='Heart Disease', type='Condition'), +"node56":Node(id='Smoking', type='Lifestyle'), +"node57":Node(id='Genetics', type='Aspect'), +"node58":Node(id='Diet', type='Activity'), +"node59":Node(id='Blood Pressure', type='Condition'), +"node60":Node(id='Alcohol Consumption', type='Activity'), +"node61":Node(id='Inflammation', type='Biological process'), +"node62":Node(id='Productivity', type='Condition'), +"node63":Node(id='Alcohol Consumption', type='Lifestyle'), +"node64":Node(id='Work Environment', type='Condition'), +"node65":Node(id='Diet', type='Lifestyle'), +"node66":Node(id='Diabetes', type='Disease'), +"node67":Node(id='Learning', type='Condition'), +"node68":Node(id='Work Performance', type='Condition'), +"node69":Node(id='Depression', type='Emotional state'), +"node70":Node(id='Sleep Quality', type='Aspect'), +"node71":Node(id='Social Support', type='Condition'), +} + +links = { +"rel1":Relationship(source=Node(id='Immune System', type='System'), target=Node(id='Inflammation', type='Condition'), type='REDUCES'), +"rel2":Relationship(source=Node(id='Inflammation', type='Condition'), target=Node(id='Heart Disease', type='Disease'), type='CAUSES'), +"rel3":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Sleep Quality', type='Health aspect'), type='DECREASES'), +"rel4":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Diet', type='Lifestyle factor'), type='WORSENS'), +"rel5":Relationship(source=Node(id='Job Satisfaction', type='Psychological factor'), target=Node(id='Stress', type='Condition'), type='REDUCES'), +"rel6":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Physical Health', type='Condition'), type='IMPAIRS'), +"rel7":Relationship(source=Node(id='Burnout', type='Condition'), target=Node(id='Mental Health', type='Condition'), type='DETERIORATES'), +"rel8":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Work Environment', type='Environment'), type='INFLUENCED_BY'), +"rel9":Relationship(source=Node(id='Cortisol', type='Hormone'), target=Node(id='Depression', type='Condition'), type='INCREASES'), +"rel10":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Mental Health', type='Health aspect'), type='AFFECTS'), +"rel11":Relationship(source=Node(id='Diet', type='Factor'), target=Node(id='Physical Health', type='Condition'), type='AFFECTS'), +"rel12":Relationship(source=Node(id='Alcohol Consumption', type='Activity'), target=Node(id='Mental Health', type='Condition'), type='AFFECTS'), +"rel13":Relationship(source=Node(id='Mental Health', type='Health aspect'), target=Node(id='Anxiety', type='Condition'), type='INCLUDES'), +"rel14":Relationship(source=Node(id='Social Support', type='Activity'), target=Node(id='Sleep Quality', type='Condition'), type='IMPROVES'), +"rel15":Relationship(source=Node(id='Cortisol', type='Hormone'), target=Node(id='Cognitive Function', type='Condition'), type='IMPAIRS'), +"rel16":Relationship(source=Node(id='Anxiety', type='Condition'), target=Node(id='Stress', type='Condition'), type='INCREASES'), +"rel17":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Aging', type='Condition'), type='ACCELERATES'), +"rel18":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Diet', type='Behavior'), type='WORSENS'), +"rel19":Relationship(source=Node(id='Exercise', type='Activity'), target=Node(id='Physical Health', type='Condition'), type='IMPROVES'), +"rel20":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Job Satisfaction', type='Condition'), type='REDUCES'), +"rel21":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Mental Health', type='Condition'), type='IMPACTS'), +"rel22":Relationship(source=Node(id='Diabetes', type='Disease'), target=Node(id='Heart Disease', type='Disease'), type='INCREASES_RISK'), +"rel23":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Work Environment', type='Environment'), type='WORSENS'), +"rel24":Relationship(source=Node(id='Job Satisfaction', type='Emotional state'), target=Node(id='Burnout', type='Condition'), type='REDUCES'), +"rel25":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Physical Activity', type='Activity'), type='DECREASES'), +"rel26":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Social Support', type='Activity'), type='DECREASES'), +"rel27":Relationship(source=Node(id='Social Support', type='Condition'), target=Node(id='Mental Health', type='Condition'), type='IMPROVES'), +"rel28":Relationship(source=Node(id='Sleep Quality', type='Condition'), target=Node(id='Physical Health', type='Condition'), type='AFFECTS'), +"rel29":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Immune System', type='Biological system'), type='WEAKENS'), +"rel30":Relationship(source=Node(id='Cognitive Function', type='Condition'), target=Node(id='Stress', type='Condition'), type='DECREASES'), +"rel31":Relationship(source=Node(id='Diet', type='Condition'), target=Node(id='Stress', type='Condition'), type='INFLUENCES'), +"rel32":Relationship(source=Node(id='Cortisol', type='Hormone'), target=Node(id='Inflammation', type='Condition'), type='INCREASES'), +"rel33":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Genetics', type='Biological factor'), type='INFLUENCED_BY'), +"rel34":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Sleep Quality', type='Health aspect'), type='REDUCES'), +"rel35":Relationship(source=Node(id='Physical Activity', type='Behavior'), target=Node(id='Stress', type='Concept'), type='REDUCES'), +"rel36":Relationship(source=Node(id='Diet', type='Activity'), target=Node(id='Obesity', type='Condition'), type='AFFECTS'), +"rel37":Relationship(source=Node(id='Exercise', type='Activity'), target=Node(id='Stress', type='Condition'), type='DECREASES'), +"rel38":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Physical Health', type='Condition'), type='AFFECTS'), +"rel39":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Cortisol', type='Hormone'), type='INCREASES'), +"rel40":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Mental Health', type='Health aspect'), type='WORSENS'), +"rel41":Relationship(source=Node(id='Depression', type='Condition'), target=Node(id='Sleep Quality', type='Condition'), type='DECREASES'), +"rel42":Relationship(source=Node(id='Physical Activity', type='Activity'), target=Node(id='Blood Pressure', type='Condition'), type='REDUCES'), +"rel43":Relationship(source=Node(id='Sleep Quality', type='Health aspect'), target=Node(id='Immune System', type='Biological system'), type='AFFECTS'), +"rel44":Relationship(source=Node(id='Inflammation', type='Condition'), target=Node(id='Heart Disease', type='Disease'), type='INCREASES_RISK'), +"rel45":Relationship(source=Node(id='Job Satisfaction', type='Emotional state'), target=Node(id='Mental Health', type='Health aspect'), type='IMPROVES'), +"rel46":Relationship(source=Node(id='Social Support', type='Social factor'), target=Node(id='Stress', type='Condition'), type='DECREASES'), +"rel47":Relationship(source=Node(id='Mental Health', type='Health aspect'), target=Node(id='Sleep Quality', type='Health aspect'), type='AFFECTS'), +"rel48":Relationship(source=Node(id='Diet', type='Activity'), target=Node(id='Inflammation', type='Condition'), type='INFLUENCES'), +"rel49":Relationship(source=Node(id='Smoking', type='Activity'), target=Node(id='Physical Health', type='Condition'), type='AFFECTS'), +"rel50":Relationship(source=Node(id='Physical Activity', type='Activity'), target=Node(id='Anxiety', type='Condition'), type='REDUCES'), +"rel51":Relationship(source=Node(id='Productivity', type='Outcome'), target=Node(id='Employee Turnover', type='Outcome'), type='INCREASES'), +"rel52":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Mental Health', type='Health aspect'), type='WORSENS'), +"rel53":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Cognitive Function', type='Function'), type='IMPAIRS'), +"rel54":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Social Support', type='Activity'), type='REDUCES'), +"rel55":Relationship(source=Node(id='Social Support', type='Activity'), target=Node(id='Heart Disease', type='Disease'), type='INFLUENCES_RISK'), +"rel56":Relationship(source=Node(id='Exercise', type='Lifestyle factor'), target=Node(id='Physical Health', type='Condition'), type='IMPROVES'), +"rel57":Relationship(source=Node(id='Social Support', type='Activity'), target=Node(id='Anxiety', type='Condition'), type='REDUCES'), +"rel58":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Mental Health', type='Condition'), type='DETERIORATES'), +"rel59":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Immune System', type='System'), type='WEAKENS'), +"rel60":Relationship(source=Node(id='Cortisol', type='Hormone'), target=Node(id='Immune System', type='Biological system'), type='SUPPRESSES'), +"rel61":Relationship(source=Node(id='Diet', type='Factor'), target=Node(id='Inflammation', type='Condition'), type='INFLUENCES'), +"rel62":Relationship(source=Node(id='Genetics', type='Factor'), target=Node(id='Stress', type='Condition'), type='INFLUENCES'), +"rel63":Relationship(source=Node(id='Mental Health', type='Condition'), target=Node(id='Cognitive Function', type='Condition'), type='INFLUENCES'), +"rel64":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Diet', type='Activity'), type='NEGATIVELY_AFFECTS'), +"rel65":Relationship(source=Node(id='Cognitive Function', type='Condition'), target=Node(id='Mental Health', type='Condition'), type='AFFECTS'), +"rel66":Relationship(source=Node(id='Exercise', type='Activity'), target=Node(id='Stress', type='Condition'), type='REDUCES'), +"rel67":Relationship(source=Node(id='Obesity', type='Condition'), target=Node(id='Blood Pressure', type='Condition'), type='INCREASES'), +"rel68":Relationship(source=Node(id='Inflammation', type='Condition'), target=Node(id='Heart Disease', type='Disease'), type='CONTRIBUTES'), +"rel69":Relationship(source=Node(id='Obesity', type='Condition'), target=Node(id='Heart Disease', type='Disease'), type='INCREASES_RISK'), +"rel70":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Burnout', type='Condition'), type='INCREASES'), +"rel71":Relationship(source=Node(id='Diabetes', type='Disease'), target=Node(id='Stress', type='Condition'), type='INCREASES'), +"rel72":Relationship(source=Node(id='Social Support', type='Aspect'), target=Node(id='Stress', type='Condition'), type='REDUCES'), +"rel73":Relationship(source=Node(id='Mental Health', type='Condition'), target=Node(id='Anxiety', type='Condition'), type='INCLUDES'), +"rel74":Relationship(source=Node(id='Social Support', type='Activity'), target=Node(id='Cognitive Function', type='Condition'), type='IMPROVES'), +"rel75":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Social Support', type='Activity'), type='REQUIRES'), +"rel76":Relationship(source=Node(id='Social Support', type='Social factor'), target=Node(id='Stress', type='Condition'), type='REDUCES'), +"rel77":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Diet', type='Activity'), type='AFFECTS'), +"rel78":Relationship(source=Node(id='Burnout', type='Condition'), target=Node(id='Productivity', type='Outcome'), type='DECREASES'), +"rel79":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Physical Health', type='Health aspect'), type='IMPAIRS'), +"rel80":Relationship(source=Node(id='Mental Health', type='Health aspect'), target=Node(id='Depression', type='Mental condition'), type='INCLUDES'), +"rel81":Relationship(source=Node(id='Mental Health', type='Condition'), target=Node(id='Anxiety', type='Condition'), type='RELATED_TO'), +"rel82":Relationship(source=Node(id='Depression', type='Condition'), target=Node(id='Stress', type='Condition'), type='INCREASES'), +"rel83":Relationship(source=Node(id='Work Environment', type='Environment'), target=Node(id='Job Satisfaction', type='Emotional state'), type='AFFECTS'), +"rel84":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Work Performance', type='Condition'), type='DECREASES'), +"rel85":Relationship(source=Node(id='Diet', type='Activity'), target=Node(id='Inflammation', type='Condition'), type='REDUCES'), +"rel86":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Mental Health', type='Condition'), type='DECREASES'), +"rel87":Relationship(source=Node(id='Diet', type='Behavior'), target=Node(id='Stress', type='Concept'), type='INFLUENCES'), +"rel88":Relationship(source=Node(id='Exercise', type='Activity'), target=Node(id='Stress', type='Concept'), type='REDUCES'), +"rel89":Relationship(source=Node(id='Cognitive Function', type='Condition'), target=Node(id='Mental Health', type='Condition'), type='ASSOCIATED_WITH'), +"rel90":Relationship(source=Node(id='Cognitive Function', type='Condition'), target=Node(id='Stress', type='Condition'), type='AFFECTS'), +"rel91":Relationship(source=Node(id='Job Satisfaction', type='Workplace factor'), target=Node(id='Stress', type='Concept'), type='INFLUENCES'), +"rel92":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Heart Disease', type='Disease'), type='INCREASES'), +"rel93":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Cognitive Function', type='Condition'), type='IMPAIRS'), +"rel94":Relationship(source=Node(id='Diet', type='Activity'), target=Node(id='Mental Health', type='Condition'), type='INFLUENCES'), +"rel95":Relationship(source=Node(id='Social Support', type='Activity'), target=Node(id='Depression', type='Condition'), type='REDUCES'), +"rel96":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Sleep Quality', type='Condition'), type='DECREASES'), +"rel97":Relationship(source=Node(id='Job Satisfaction', type='Psychological factor'), target=Node(id='Stress', type='Concept'), type='REDUCES'), +"rel98":Relationship(source=Node(id='Diet', type='Lifestyle'), target=Node(id='Stress', type='Condition'), type='INFLUENCES'), +"rel99":Relationship(source=Node(id='Alcohol Consumption', type='Lifestyle'), target=Node(id='Stress', type='Condition'), type='INCREASES'), +"rel100":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Inflammation', type='Biological process'), type='INCREASES'), +"rel101":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Mental Health', type='Condition'), type='DEGRADES'), +"rel102":Relationship(source=Node(id='Mental Health', type='Condition'), target=Node(id='Anxiety', type='Condition'), type='AFFECTS'), +"rel103":Relationship(source=Node(id='Job Satisfaction', type='Condition'), target=Node(id='Burnout', type='Condition'), type='DECREASES'), +"rel104":Relationship(source=Node(id='Work Environment', type='Condition'), target=Node(id='Stress', type='Condition'), type='INFLUENCES'), +"rel105":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Work Environment', type='Environment'), type='INFLUENCED_BY'), +"rel106":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Mental Health', type='Health aspect'), type='DETERIORATES'), +"rel107":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Social Support', type='Social factor'), type='REDUCES'), +"rel108":Relationship(source=Node(id='Blood Pressure', type='Condition'), target=Node(id='Stress', type='Condition'), type='INCREASES'), +"rel109":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Social Support', type='Condition'), type='DECREASES'), +"rel110":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Mental Health', type='Condition'), type='IMPAIRS'), +"rel111":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Anxiety', type='Emotional state'), type='INCREASES'), +"rel112":Relationship(source=Node(id='Sleep Quality', type='Condition'), target=Node(id='Cognitive Function', type='Condition'), type='AFFECTS'), +"rel113":Relationship(source=Node(id='Sleep Quality', type='Condition'), target=Node(id='Mental Health', type='Condition'), type='IMPROVES'), +"rel114":Relationship(source=Node(id='Diet', type='Activity'), target=Node(id='Stress', type='Condition'), type='INFLUENCES'), +"rel115":Relationship(source=Node(id='Cortisol', type='Hormone'), target=Node(id='Inflammation', type='Biological process'), type='PROMOTES'), +"rel116":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Diet', type='Lifestyle factor'), type='WORSENS'), +"rel117":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Mental Health', type='Health aspect'), type='DETERIORATES'), +"rel118":Relationship(source=Node(id='Diet', type='Lifestyle factor'), target=Node(id='Stress', type='Condition'), type='INFLUENCES'), +"rel119":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Diet', type='Activity'), type='WORSENS'), +"rel120":Relationship(source=Node(id='Physical Activity', type='Activity'), target=Node(id='Obesity', type='Condition'), type='REDUCES'), +"rel121":Relationship(source=Node(id='Job Satisfaction', type='Emotional state'), target=Node(id='Mental Health', type='Health aspect'), type='AFFECTS'), +"rel122":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Productivity', type='Outcome'), type='DECREASES'), +"rel123":Relationship(source=Node(id='Social Support', type='Factor'), target=Node(id='Stress', type='Condition'), type='DECREASES'), +"rel124":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Work Environment', type='Factor'), type='WORSENS'), +"rel125":Relationship(source=Node(id='Mental Health', type='Condition'), target=Node(id='Depression', type='Condition'), type='INCLUDES'), +"rel126":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Sleep Quality', type='Condition'), type='REDUCES'), +"rel127":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Work Environment', type='Environment'), type='WORSENS'), +"rel128":Relationship(source=Node(id='Social Support', type='Factor'), target=Node(id='Mental Health', type='Condition'), type='IMPROVES'), +"rel129":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Diabetes', type='Disease'), type='INCREASES_RISK_OF'), +"rel130":Relationship(source=Node(id='Cognitive Function', type='Condition'), target=Node(id='Aging', type='Condition'), type='DECLINES_WITH'), +"rel131":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Inflammation', type='Biological process'), type='INCREASES'), +"rel132":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Anxiety', type='Mental condition'), type='INCREASES'), +"rel133":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Job Satisfaction', type='Emotional state'), type='DECREASES'), +"rel134":Relationship(source=Node(id='Diet', type='Factor'), target=Node(id='Physical Health', type='Condition'), type='IMPROVES'), +"rel135":Relationship(source=Node(id='Cortisol', type='Hormone'), target=Node(id='Diabetes', type='Disease'), type='INCREASES_RISK'), +"rel136":Relationship(source=Node(id='Mental Health', type='Condition'), target=Node(id='Social Support', type='Activity'), type='INFLUENCES'), +"rel137":Relationship(source=Node(id='Physical Activity', type='Activity'), target=Node(id='Mental Health', type='Condition'), type='IMPROVES'), +"rel138":Relationship(source=Node(id='Immune System', type='Biological system'), target=Node(id='Inflammation', type='Biological process'), type='REGULATES'), +"rel139":Relationship(source=Node(id='Physical Activity', type='Activity'), target=Node(id='Cortisol', type='Hormone'), type='REDUCES'), +"rel140":Relationship(source=Node(id='Mental Health', type='Condition'), target=Node(id='Depression', type='Condition'), type='RELATED_TO'), +"rel141":Relationship(source=Node(id='Job Satisfaction', type='Condition'), target=Node(id='Burnout', type='Condition'), type='REDUCES'), +"rel142":Relationship(source=Node(id='Exercise', type='Factor'), target=Node(id='Physical Health', type='Condition'), type='IMPROVES'), +"rel143":Relationship(source=Node(id='Social Support', type='Condition'), target=Node(id='Stress', type='Condition'), type='DECREASES'), +"rel144":Relationship(source=Node(id='Work Environment', type='Factor'), target=Node(id='Stress', type='Condition'), type='INFLUENCES'), +"rel145":Relationship(source=Node(id='Genetics', type='Aspect'), target=Node(id='Stress', type='Condition'), type='INFLUENCES'), +"rel146":Relationship(source=Node(id='Mental Health', type='Health aspect'), target=Node(id='Anxiety', type='Mental condition'), type='INCLUDES'), +"rel147":Relationship(source=Node(id='Sleep Quality', type='Health aspect'), target=Node(id='Mental Health', type='Health aspect'), type='AFFECTS'), +"rel148":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Heart Disease', type='Disease'), type='INCREASES_RISK_OF'), +"rel149":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Social Support', type='Condition'), type='REDUCES'), +"rel150":Relationship(source=Node(id='Social Support', type='Behavior'), target=Node(id='Stress', type='Condition'), type='REDUCES'), +"rel151":Relationship(source=Node(id='Cortisol', type='Hormone'), target=Node(id='Blood Pressure', type='Condition'), type='INCREASES'), +"rel152":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Mental Health', type='Condition'), type='AFFECTS'), +"rel153":Relationship(source=Node(id='Sleep Quality', type='Condition'), target=Node(id='Mental Health', type='Condition'), type='INFLUENCES'), +"rel154":Relationship(source=Node(id='Work Environment', type='Environment'), target=Node(id='Stress', type='Condition'), type='INDUCES'), +"rel155":Relationship(source=Node(id='Immune System', type='Biological system'), target=Node(id='Inflammation', type='Condition'), type='REDUCES'), +"rel156":Relationship(source=Node(id='Heart Rate', type='Physiological measure'), target=Node(id='Stress', type='Condition'), type='INCREASES'), +"rel157":Relationship(source=Node(id='Smoking', type='Activity'), target=Node(id='Stress', type='Condition'), type='INCREASES'), +"rel158":Relationship(source=Node(id='Cortisol', type='Hormone'), target=Node(id='Sleep Quality', type='Condition'), type='DECREASES'), +"rel159":Relationship(source=Node(id='Cortisol', type='Hormone'), target=Node(id='Inflammation', type='Condition'), type='REGULATES'), +"rel160":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Genetics', type='Biological factor'), type='INFLUENCED_BY'), +"rel161":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Physical Health', type='Condition'), type='DETERIORATES'), +"rel162":Relationship(source=Node(id='Work Environment', type='Environment'), target=Node(id='Stress', type='Condition'), type='INFLUENCES'), +"rel163":Relationship(source=Node(id='Social Support', type='Factor'), target=Node(id='Stress', type='Condition'), type='REDUCES'), +"rel164":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Physical Activity', type='Activity'), type='DECREASES'), +"rel165":Relationship(source=Node(id='Work Environment', type='Environment'), target=Node(id='Job Satisfaction', type='Condition'), type='INFLUENCES'), +"rel166":Relationship(source=Node(id='Physical Activity', type='Activity'), target=Node(id='Depression', type='Condition'), type='REDUCES'), +"rel167":Relationship(source=Node(id='Burnout', type='Condition'), target=Node(id='Mental Health', type='Condition'), type='AFFECTS'), +"rel168":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Depression', type='Mental condition'), type='INCREASES'), +"rel169":Relationship(source=Node(id='Physical Activity', type='Activity'), target=Node(id='Stress', type='Condition'), type='REDUCES'), +"rel170":Relationship(source=Node(id='Mental Health', type='Condition'), target=Node(id='Physical Activity', type='Activity'), type='IMPROVES'), +"rel171":Relationship(source=Node(id='Exercise', type='Lifestyle factor'), target=Node(id='Stress', type='Condition'), type='REDUCES'), +"rel172":Relationship(source=Node(id='Diet', type='Activity'), target=Node(id='Heart Disease', type='Disease'), type='INFLUENCES_RISK'), +"rel173":Relationship(source=Node(id='Genetics', type='Biological factor'), target=Node(id='Stress', type='Condition'), type='INFLUENCES'), +"rel174":Relationship(source=Node(id='Blood Pressure', type='Physiological measure'), target=Node(id='Stress', type='Condition'), type='INCREASES'), +"rel175":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Immune System', type='Biological system'), type='WEAKENS'), +"rel176":Relationship(source=Node(id='Work Environment', type='Environment'), target=Node(id='Stress', type='Condition'), type='INCREASES'), +"rel177":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Depression', type='Emotional state'), type='INCREASES'), +"rel178":Relationship(source=Node(id='Social Support', type='Condition'), target=Node(id='Stress', type='Condition'), type='REDUCES'), +"rel179":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Work Environment', type='Environment'), type='AFFECTED_BY'), +"rel180":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Diet', type='Condition'), type='AFFECTS'), +"rel181":Relationship(source=Node(id='Sleep Quality', type='Health aspect'), target=Node(id='Immune System', type='Biological system'), type='IMPROVES'), +"rel182":Relationship(source=Node(id='Diet', type='Factor'), target=Node(id='Physical Health', type='Condition'), type='INFLUENCES'), +"rel183":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Heart Disease', type='Disease'), type='INCREASES_RISK_OF'), +"rel184":Relationship(source=Node(id='Social Support', type='Social factor'), target=Node(id='Stress', type='Concept'), type='REDUCES'), +"rel185":Relationship(source=Node(id='Mental Health', type='Condition'), target=Node(id='Physical Activity', type='Activity'), type='INFLUENCES'), +"rel186":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Cortisol', type='Hormone'), type='INCREASES'), +"rel187":Relationship(source=Node(id='Social Support', type='Social factor'), target=Node(id='Mental Health', type='Health aspect'), type='IMPROVES'), +"rel188":Relationship(source=Node(id='Diet', type='Activity'), target=Node(id='Diabetes', type='Disease'), type='INFLUENCES'), +"rel189":Relationship(source=Node(id='Diet', type='Lifestyle factor'), target=Node(id='Physical Health', type='Condition'), type='IMPROVES'), +"rel190":Relationship(source=Node(id='Heart Disease', type='Disease'), target=Node(id='Blood Pressure', type='Condition'), type='INCREASES'), +"rel191":Relationship(source=Node(id='Diet', type='Activity'), target=Node(id='Depression', type='Condition'), type='INFLUENCES'), +"rel192":Relationship(source=Node(id='Work Environment', type='Environment'), target=Node(id='Stress', type='Condition'), type='CAUSES'), +"rel193":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Obesity', type='Condition'), type='INCREASES_RISK_OF'), +"rel194":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Physical Activity', type='Activity'), type='REDUCES'), +"rel195":Relationship(source=Node(id='Cortisol', type='Hormone'), target=Node(id='Inflammation', type='Biological process'), type='INCREASES'), +"rel196":Relationship(source=Node(id='Work Environment', type='Environment'), target=Node(id='Social Support', type='Social factor'), type='INFLUENCES'), +"rel197":Relationship(source=Node(id='Job Satisfaction', type='Condition'), target=Node(id='Productivity', type='Condition'), type='INCREASES'), +"rel198":Relationship(source=Node(id='Diet', type='Aspect'), target=Node(id='Stress', type='Condition'), type='INFLUENCES'), +"rel199":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Mental Health', type='Condition'), type='WORSENS'), +"rel200":Relationship(source=Node(id='Diet', type='Activity'), target=Node(id='Stress', type='Condition'), type='DECREASES'), +"rel201":Relationship(source=Node(id='Sleep Quality', type='Condition'), target=Node(id='Mental Health', type='Condition'), type='AFFECTS'), +"rel202":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Obesity', type='Condition'), type='INCREASES_RISK'), +"rel203":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Heart Disease', type='Condition'), type='INCREASES_RISK'), +"rel204":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Physical Activity', type='Behavior'), type='DECREASES'), +"rel205":Relationship(source=Node(id='Physical Activity', type='Activity'), target=Node(id='Stress', type='Concept'), type='REDUCES'), +"rel206":Relationship(source=Node(id='Mental Health', type='Condition'), target=Node(id='Diet', type='Activity'), type='INFLUENCES'), +"rel207":Relationship(source=Node(id='Diet', type='Activity'), target=Node(id='Heart Disease', type='Disease'), type='INFLUENCES'), +"rel208":Relationship(source=Node(id='Diet', type='Factor'), target=Node(id='Stress', type='Condition'), type='INFLUENCES'), +"rel209":Relationship(source=Node(id='Genetics', type='Factor'), target=Node(id='Heart Disease', type='Disease'), type='INFLUENCES'), +"rel210":Relationship(source=Node(id='Physical Activity', type='Activity'), target=Node(id='Stress', type='Condition'), type='DECREASES'), +"rel211":Relationship(source=Node(id='Job Satisfaction', type='Condition'), target=Node(id='Stress', type='Condition'), type='INFLUENCES'), +"rel212":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Social Support', type='Factor'), type='DECREASES'), +"rel213":Relationship(source=Node(id='Mental Health', type='Health aspect'), target=Node(id='Depression', type='Condition'), type='INCLUDES'), +"rel214":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Social Support', type='Social factor'), type='DECREASES'), +"rel215":Relationship(source=Node(id='Social Support', type='Social factor'), target=Node(id='Mental Health', type='Condition'), type='IMPROVES'), +"rel216":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Social Relationships', type='Condition'), type='DETERIORATES'), +"rel217":Relationship(source=Node(id='Burnout', type='Condition'), target=Node(id='Mental Health', type='Health aspect'), type='AFFECTS'), +"rel218":Relationship(source=Node(id='Diet', type='Activity'), target=Node(id='Sleep Quality', type='Condition'), type='INFLUENCES'), +"rel219":Relationship(source=Node(id='Physical Activity', type='Behavior'), target=Node(id='Stress', type='Condition'), type='REDUCES'), +"rel220":Relationship(source=Node(id='Diet', type='Lifestyle factor'), target=Node(id='Inflammation', type='Biological process'), type='REDUCES'), +"rel221":Relationship(source=Node(id='Inflammation', type='Biological process'), target=Node(id='Heart Disease', type='Disease'), type='CONTRIBUTES_TO'), +"rel222":Relationship(source=Node(id='Work Environment', type='Environment'), target=Node(id='Job Satisfaction', type='Emotional state'), type='INFLUENCES'), +"rel223":Relationship(source=Node(id='Physical Activity', type='Activity'), target=Node(id='Diabetes', type='Disease'), type='REDUCES_RISK'), +"rel224":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Sleep Quality', type='Health aspect'), type='DECREASES'), +"rel225":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Inflammation', type='Condition'), type='INCREASES'), +"rel226":Relationship(source=Node(id='Diet', type='Lifestyle factor'), target=Node(id='Stress', type='Concept'), type='INFLUENCES'), +"rel227":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Diet', type='Factor'), type='INFLUENCED_BY'), +"rel228":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Memory', type='Condition'), type='IMPAIRS'), +"rel229":Relationship(source=Node(id='Blood Pressure', type='Condition'), target=Node(id='Heart Disease', type='Disease'), type='INCREASES_RISK'), +"rel230":Relationship(source=Node(id='Diet', type='Lifestyle factor'), target=Node(id='Inflammation', type='Condition'), type='INFLUENCES'), +"rel231":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Blood Pressure', type='Condition'), type='INCREASES'), +"rel232":Relationship(source=Node(id='Social Support', type='Activity'), target=Node(id='Stress', type='Condition'), type='REDUCES'), +"rel233":Relationship(source=Node(id='Work Environment', type='Environment'), target=Node(id='Job Satisfaction', type='Condition'), type='AFFECTS'), +"rel234":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Heart Disease', type='Disease'), type='INCREASES_RISK'), +"rel235":Relationship(source=Node(id='Cortisol', type='Hormone'), target=Node(id='Immune System', type='Biological system'), type='WEAKENS'), +"rel236":Relationship(source=Node(id='Mental Health', type='Condition'), target=Node(id='Depression', type='Condition'), type='AFFECTS'), +"rel237":Relationship(source=Node(id='Cortisol', type='Hormone'), target=Node(id='Immune System', type='System'), type='SUPPRESSES'), +"rel238":Relationship(source=Node(id='Diet', type='Behavior'), target=Node(id='Inflammation', type='Condition'), type='REDUCES'), +"rel239":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Exercise', type='Activity'), type='REDUCED_BY'), +"rel240":Relationship(source=Node(id='Cortisol', type='Hormone'), target=Node(id='Anxiety', type='Condition'), type='INCREASES'), +"rel241":Relationship(source=Node(id='Physical Activity', type='Activity'), target=Node(id='Sleep Quality', type='Condition'), type='IMPROVES'), +"rel242":Relationship(source=Node(id='Physical Activity', type='Activity'), target=Node(id='Cognitive Function', type='Condition'), type='IMPROVES'), +"rel243":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Diet', type='Factor'), type='WORSENS'), +"rel244":Relationship(source=Node(id='Sleep Quality', type='Health aspect'), target=Node(id='Heart Disease', type='Disease'), type='AFFECTS'), +"rel245":Relationship(source=Node(id='Smoking', type='Lifestyle'), target=Node(id='Stress', type='Condition'), type='INCREASES'), +"rel246":Relationship(source=Node(id='Cortisol', type='Hormone'), target=Node(id='Inflammation', type='Condition'), type='PROMOTES'), +"rel247":Relationship(source=Node(id='Cortisol', type='Hormone'), target=Node(id='Obesity', type='Condition'), type='CONTRIBUTES_TO'), +"rel248":Relationship(source=Node(id='Obesity', type='Condition'), target=Node(id='Stress', type='Condition'), type='INCREASES'), +"rel249":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Social Support', type='Factor'), type='REDUCES'), +"rel250":Relationship(source=Node(id='Sleep Quality', type='Condition'), target=Node(id='Cognitive Function', type='Condition'), type='IMPROVES'), +"rel251":Relationship(source=Node(id='Work Environment', type='Environment'), target=Node(id='Stress', type='Condition'), type='CONTRIBUTES_TO'), +"rel252":Relationship(source=Node(id='Inflammation', type='Condition'), target=Node(id='Diabetes', type='Disease'), type='CONTRIBUTES_TO'), +"rel253":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Social Support', type='Social factor'), type='REDUCES'), +"rel254":Relationship(source=Node(id='Job Satisfaction', type='Psychological factor'), target=Node(id='Stress', type='Condition'), type='INFLUENCES'), +"rel255":Relationship(source=Node(id='Job Satisfaction', type='Condition'), target=Node(id='Stress', type='Condition'), type='REDUCES'), +"rel256":Relationship(source=Node(id='Diet', type='Activity'), target=Node(id='Obesity', type='Condition'), type='INFLUENCES'), +"rel257":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Depression', type='Condition'), type='INCREASES'), +"rel258":Relationship(source=Node(id='Obesity', type='Condition'), target=Node(id='Diabetes', type='Disease'), type='INCREASES_RISK_OF'), +"rel259":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Anxiety', type='Condition'), type='INCREASES'), +"rel260":Relationship(source=Node(id='Diet', type='Activity'), target=Node(id='Anxiety', type='Condition'), type='INFLUENCES'), +"rel261":Relationship(source=Node(id='Immune System', type='Biological system'), target=Node(id='Inflammation', type='Condition'), type='REGULATES'), +"rel262":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Sleep Quality', type='Health aspect'), type='REDUCES'), +"rel263":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Mental Health', type='Health aspect'), type='IMPAIRS'), +"rel264":Relationship(source=Node(id='Diet', type='Activity'), target=Node(id='Diabetes', type='Disease'), type='AFFECTS'), +"rel265":Relationship(source=Node(id='Work Environment', type='Environment'), target=Node(id='Stress', type='Concept'), type='INFLUENCES'), +"rel266":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Job Satisfaction', type='Psychological factor'), type='DECREASES'), +"rel267":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Mental Health', type='Aspect'), type='AFFECTS'), +"rel268":Relationship(source=Node(id='Social Support', type='Activity'), target=Node(id='Mental Health', type='Condition'), type='IMPROVES'), +"rel269":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Work Environment', type='Environment'), type='AFFECTS'), +"rel270":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Learning', type='Condition'), type='IMPAIRS'), +"rel271":Relationship(source=Node(id='Alcohol Consumption', type='Activity'), target=Node(id='Stress', type='Condition'), type='INCREASES'), +"rel272":Relationship(source=Node(id='Mental Health', type='Health aspect'), target=Node(id='Sleep Quality', type='Health aspect'), type='INFLUENCES'), +"rel273":Relationship(source=Node(id='Stress', type='Concept'), target=Node(id='Heart Disease', type='Disease'), type='INCREASES_RISK'), +"rel274":Relationship(source=Node(id='Obesity', type='Condition'), target=Node(id='Diabetes', type='Disease'), type='INCREASES_RISK'), +"rel275":Relationship(source=Node(id='Sleep Quality', type='Health aspect'), target=Node(id='Immune System', type='Biological system'), type='STRENGTHENS'), +"rel276":Relationship(source=Node(id='Inflammation', type='Condition'), target=Node(id='Heart Disease', type='Disease'), type='CONTRIBUTES_TO'), +"rel277":Relationship(source=Node(id='Work Environment', type='Environment'), target=Node(id='Social Support', type='Social factor'), type='AFFECTS'), +"rel278":Relationship(source=Node(id='Diet', type='Lifestyle factor'), target=Node(id='Inflammation', type='Condition'), type='REDUCES'), +"rel279":Relationship(source=Node(id='Genetics', type='Biological factor'), target=Node(id='Stress', type='Concept'), type='INFLUENCES'), +"rel280":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Job Satisfaction', type='Condition'), type='DECREASES'), +"rel281":Relationship(source=Node(id='Diet', type='Behavior'), target=Node(id='Stress', type='Condition'), type='INFLUENCES'), +"rel282":Relationship(source=Node(id='Job Satisfaction', type='Psychological factor'), target=Node(id='Stress', type='Concept'), type='INFLUENCES'), +"rel283":Relationship(source=Node(id='Sleep Quality', type='Health aspect'), target=Node(id='Mental Health', type='Health aspect'), type='IMPROVES'), +"rel284":Relationship(source=Node(id='Physical Activity', type='Activity'), target=Node(id='Heart Disease', type='Disease'), type='REDUCES_RISK'), +"rel285":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Mental Health', type='Health aspect'), type='AFFECTS'), +"rel286":Relationship(source=Node(id='Anxiety', type='Condition'), target=Node(id='Sleep Quality', type='Condition'), type='DECREASES'), +"rel287":Relationship(source=Node(id='Stress', type='Condition'), target=Node(id='Sleep Quality', type='Aspect'), type='DECREASES'), +"rel288":Relationship(source=Node(id='Diet', type='Activity'), target=Node(id='Cognitive Function', type='Condition'), type='INFLUENCES') +} \ No newline at end of file diff --git a/apps/graph_rag_demo/package-lock.json b/apps/graph_rag_demo/package-lock.json new file mode 100644 index 0000000..d4cf70d --- /dev/null +++ b/apps/graph_rag_demo/package-lock.json @@ -0,0 +1,1641 @@ +{ + "name": "kg_graph_rag_mongo", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "@langchain/mongodb": "^0.0.4", + "@langchain/openai": "^0.2.4", + "assert": "^2.1.0", + "axios": "^1.7.2", + "dotenv": "^16.4.5", + "fs": "^0.0.1-security", + "hbase": "^0.6.1", + "langchain": "^0.2.10", + "mongodb": "^6.8.0", + "pdf-parse": "^1.1.1", + "proj4": "^2.11.0", + "readline": "^1.3.0", + "thrift": "^0.20.0" + } + }, + "node_modules/@langchain/core": { + "version": "0.2.34", + "resolved": "https://registry.npmjs.org/@langchain/core/-/core-0.2.34.tgz", + "integrity": "sha512-Hkveq1UcOjUj1DVn5erbqElyRj1t04NORSuSIZAJCtPO7EDkIqomjAarJ5+I5NUpQeIONgbOdnY9TkJ6cKUSVA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^5.0.0", + "camelcase": "6", + "decamelize": "1.2.0", + "js-tiktoken": "^1.0.12", + "langsmith": "^0.1.56-rc.1", + "mustache": "^4.2.0", + "p-queue": "^6.6.2", + "p-retry": "4", + "uuid": "^10.0.0", + "zod": "^3.22.4", + "zod-to-json-schema": "^3.22.3" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@langchain/mongodb": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/@langchain/mongodb/-/mongodb-0.0.4.tgz", + "integrity": "sha512-9cUdoJyQAMNVIKp5EuYypWplZTd8Rdz1J6RuqYKPRbDioLES4JyssUH5+9U+4Ct0VHxEQyd4vbcu8ZtKduigxg==", + "license": "MIT", + "dependencies": { + "@langchain/core": ">0.1.0 <0.3.0", + "mongodb": "^6.3.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@langchain/openai": { + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/@langchain/openai/-/openai-0.2.11.tgz", + "integrity": "sha512-Pu8+WfJojCgSf0bAsXb4AjqvcDyAWyoEB1AoCRNACgEnBWZuitz3hLwCo9I+6hAbeg3QJ37g82yKcmvKAg1feg==", + "license": "MIT", + "dependencies": { + "@langchain/core": ">=0.2.26 <0.3.0", + "js-tiktoken": "^1.0.12", + "openai": "^4.57.3", + "zod": "^3.22.4", + "zod-to-json-schema": "^3.22.3" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@langchain/textsplitters": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/@langchain/textsplitters/-/textsplitters-0.0.3.tgz", + "integrity": "sha512-cXWgKE3sdWLSqAa8ykbCcUsUF1Kyr5J3HOWYGuobhPEycXW4WI++d5DhzdpL238mzoEXTi90VqfSCra37l5YqA==", + "license": "MIT", + "dependencies": { + "@langchain/core": ">0.2.0 <0.3.0", + "js-tiktoken": "^1.0.12" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@mongodb-js/saslprep": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.9.tgz", + "integrity": "sha512-tVkljjeEaAhCqTzajSdgbQ6gE6f3oneVwa3iXR6csiEwXXOFsiC6Uh9iAjAhXPtqa/XMDHWjjeNH/77m/Yq2dw==", + "license": "MIT", + "dependencies": { + "sparse-bitfield": "^3.0.3" + } + }, + "node_modules/@types/node": { + "version": "18.19.51", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.51.tgz", + "integrity": "sha512-IIMkWEIVQDlBpi6pPeGqTqOx7KbzGC3EgIyH8NrxplXOwWw0uVl9vthJUMFrxD7kcEfcRp7jIkgpB28M6JnfWA==", + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/node-fetch": { + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.11.tgz", + "integrity": "sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==", + "license": "MIT", + "dependencies": { + "@types/node": "*", + "form-data": "^4.0.0" + } + }, + "node_modules/@types/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", + "license": "MIT" + }, + "node_modules/@types/uuid": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz", + "integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==", + "license": "MIT" + }, + "node_modules/@types/webidl-conversions": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz", + "integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==", + "license": "MIT" + }, + "node_modules/@types/whatwg-url": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-11.0.5.tgz", + "integrity": "sha512-coYR071JRaHa+xoEvvYqvnIHaVqaYrLPbsufM9BF63HkwI5Lgmy2QR8Q5K/lYDYo5AK82wOvSOS0UsLTpTG7uQ==", + "license": "MIT", + "dependencies": { + "@types/webidl-conversions": "*" + } + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/agentkeepalive": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", + "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", + "license": "MIT", + "dependencies": { + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" + }, + "node_modules/assert": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-2.1.0.tgz", + "integrity": "sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "is-nan": "^1.3.2", + "object-is": "^1.1.5", + "object.assign": "^4.1.4", + "util": "^0.12.5" + } + }, + "node_modules/async-limiter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", + "license": "MIT" + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/axios": { + "version": "1.7.7", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz", + "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, + "node_modules/browser-or-node": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-or-node/-/browser-or-node-1.3.0.tgz", + "integrity": "sha512-0F2z/VSnLbmEeBcUrSuDH5l0HxTXdQQzLjkmBR4cYfvg1zJrKSlmIZFqyFR8oX0NrwPhy3c3HQ6i3OxMbew4Tg==", + "license": "MIT" + }, + "node_modules/bson": { + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/bson/-/bson-6.8.0.tgz", + "integrity": "sha512-iOJg8pr7wq2tg/zSlCCHMi3hMm5JTOxLTagf3zxhcenHsFp+c6uOs6K7W5UE7A4QIJGtqh/ZovFNMP4mOPJynQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=16.20.1" + } + }, + "node_modules/call-bind": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "license": "MIT", + "engines": { + "node": ">=14" + } + }, + "node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "license": "MIT", + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "license": "MIT" + }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "license": "MIT", + "optional": true + }, + "node_modules/follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "license": "MIT", + "dependencies": { + "is-callable": "^1.1.3" + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/form-data-encoder": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz", + "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==", + "license": "MIT" + }, + "node_modules/formdata-node": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", + "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==", + "license": "MIT", + "dependencies": { + "node-domexception": "1.0.0", + "web-streams-polyfill": "4.0.0-beta.3" + }, + "engines": { + "node": ">= 12.20" + } + }, + "node_modules/fs": { + "version": "0.0.1-security", + "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", + "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==", + "license": "ISC" + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hbase": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/hbase/-/hbase-0.6.1.tgz", + "integrity": "sha512-9z+2T2kHUovikZYpPGE1qM9FKBm+/OMqRa4TfFD+2czzs2H4Ahg9ZIAW1VswVcUmTmjCvgWYvvZy4OdKVQ+SBg==", + "license": "MIT", + "engines": { + "node": ">= 0.1.90" + }, + "optionalDependencies": { + "krb5": "^0.5.0" + } + }, + "node_modules/humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.0.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "license": "MIT", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-nan": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", + "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", + "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==", + "license": "MIT", + "dependencies": { + "which-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isomorphic-ws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", + "license": "MIT", + "peerDependencies": { + "ws": "*" + } + }, + "node_modules/js-tiktoken": { + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/js-tiktoken/-/js-tiktoken-1.0.14.tgz", + "integrity": "sha512-Pk3l3WOgM9joguZY2k52+jH82RtABRgB5RdGFZNUGbOKGMVlNmafcPA3b0ITcCZPu1L9UclP1tne6aw7ZI4Myg==", + "license": "MIT", + "dependencies": { + "base64-js": "^1.5.1" + } + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsonpointer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-5.0.1.tgz", + "integrity": "sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/krb5": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/krb5/-/krb5-0.5.5.tgz", + "integrity": "sha512-6Q46L9QWkOhtH7RLwMW7PSVr/ozILbFov9Sy6vUemIHBKB3P0I2QKSgcochF8RgvU56n0YFwLjYIoCx7BkJxjg==", + "hasInstallScript": true, + "license": "BSD-3-Clause", + "optional": true, + "dependencies": { + "bindings": "1.5.0", + "node-addon-api": "1.7.1" + } + }, + "node_modules/langchain": { + "version": "0.2.20", + "resolved": "https://registry.npmjs.org/langchain/-/langchain-0.2.20.tgz", + "integrity": "sha512-tbels6Rr524iMM3VOQ4aTGnEOOjAA1BQuBR8u/8gJ2yT48lMtIQRAN32Y4KVjKK+hEWxHHlmLBrtgLpTphFjNA==", + "license": "MIT", + "dependencies": { + "@langchain/core": ">=0.2.21 <0.3.0", + "@langchain/openai": ">=0.1.0 <0.3.0", + "@langchain/textsplitters": "~0.0.0", + "binary-extensions": "^2.2.0", + "js-tiktoken": "^1.0.12", + "js-yaml": "^4.1.0", + "jsonpointer": "^5.0.1", + "langsmith": "^0.1.56-rc.1", + "openapi-types": "^12.1.3", + "p-retry": "4", + "uuid": "^10.0.0", + "yaml": "^2.2.1", + "zod": "^3.22.4", + "zod-to-json-schema": "^3.22.3" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@aws-sdk/client-s3": "*", + "@aws-sdk/client-sagemaker-runtime": "*", + "@aws-sdk/client-sfn": "*", + "@aws-sdk/credential-provider-node": "*", + "@azure/storage-blob": "*", + "@browserbasehq/sdk": "*", + "@gomomento/sdk": "*", + "@gomomento/sdk-core": "*", + "@gomomento/sdk-web": "^1.51.1", + "@langchain/anthropic": "*", + "@langchain/aws": "*", + "@langchain/cohere": "*", + "@langchain/google-genai": "*", + "@langchain/google-vertexai": "*", + "@langchain/groq": "*", + "@langchain/mistralai": "*", + "@langchain/ollama": "*", + "@mendable/firecrawl-js": "*", + "@notionhq/client": "*", + "@pinecone-database/pinecone": "*", + "@supabase/supabase-js": "*", + "@vercel/kv": "*", + "@xata.io/client": "*", + "apify-client": "*", + "assemblyai": "*", + "axios": "*", + "cheerio": "*", + "chromadb": "*", + "convex": "*", + "couchbase": "*", + "d3-dsv": "*", + "epub2": "*", + "fast-xml-parser": "*", + "handlebars": "^4.7.8", + "html-to-text": "*", + "ignore": "*", + "ioredis": "*", + "jsdom": "*", + "mammoth": "*", + "mongodb": "*", + "node-llama-cpp": "*", + "notion-to-md": "*", + "officeparser": "*", + "pdf-parse": "*", + "peggy": "^3.0.2", + "playwright": "*", + "puppeteer": "*", + "pyodide": ">=0.24.1 <0.27.0", + "redis": "*", + "sonix-speech-recognition": "*", + "srt-parser-2": "*", + "typeorm": "*", + "weaviate-ts-client": "*", + "web-auth-library": "*", + "ws": "*", + "youtube-transcript": "*", + "youtubei.js": "*" + }, + "peerDependenciesMeta": { + "@aws-sdk/client-s3": { + "optional": true + }, + "@aws-sdk/client-sagemaker-runtime": { + "optional": true + }, + "@aws-sdk/client-sfn": { + "optional": true + }, + "@aws-sdk/credential-provider-node": { + "optional": true + }, + "@azure/storage-blob": { + "optional": true + }, + "@browserbasehq/sdk": { + "optional": true + }, + "@gomomento/sdk": { + "optional": true + }, + "@gomomento/sdk-core": { + "optional": true + }, + "@gomomento/sdk-web": { + "optional": true + }, + "@langchain/anthropic": { + "optional": true + }, + "@langchain/aws": { + "optional": true + }, + "@langchain/cohere": { + "optional": true + }, + "@langchain/google-genai": { + "optional": true + }, + "@langchain/google-vertexai": { + "optional": true + }, + "@langchain/groq": { + "optional": true + }, + "@langchain/mistralai": { + "optional": true + }, + "@langchain/ollama": { + "optional": true + }, + "@mendable/firecrawl-js": { + "optional": true + }, + "@notionhq/client": { + "optional": true + }, + "@pinecone-database/pinecone": { + "optional": true + }, + "@supabase/supabase-js": { + "optional": true + }, + "@vercel/kv": { + "optional": true + }, + "@xata.io/client": { + "optional": true + }, + "apify-client": { + "optional": true + }, + "assemblyai": { + "optional": true + }, + "axios": { + "optional": true + }, + "cheerio": { + "optional": true + }, + "chromadb": { + "optional": true + }, + "convex": { + "optional": true + }, + "couchbase": { + "optional": true + }, + "d3-dsv": { + "optional": true + }, + "epub2": { + "optional": true + }, + "faiss-node": { + "optional": true + }, + "fast-xml-parser": { + "optional": true + }, + "handlebars": { + "optional": true + }, + "html-to-text": { + "optional": true + }, + "ignore": { + "optional": true + }, + "ioredis": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "mammoth": { + "optional": true + }, + "mongodb": { + "optional": true + }, + "node-llama-cpp": { + "optional": true + }, + "notion-to-md": { + "optional": true + }, + "officeparser": { + "optional": true + }, + "pdf-parse": { + "optional": true + }, + "peggy": { + "optional": true + }, + "playwright": { + "optional": true + }, + "puppeteer": { + "optional": true + }, + "pyodide": { + "optional": true + }, + "redis": { + "optional": true + }, + "sonix-speech-recognition": { + "optional": true + }, + "srt-parser-2": { + "optional": true + }, + "typeorm": { + "optional": true + }, + "weaviate-ts-client": { + "optional": true + }, + "web-auth-library": { + "optional": true + }, + "ws": { + "optional": true + }, + "youtube-transcript": { + "optional": true + }, + "youtubei.js": { + "optional": true + } + } + }, + "node_modules/langsmith": { + "version": "0.1.60", + "resolved": "https://registry.npmjs.org/langsmith/-/langsmith-0.1.60.tgz", + "integrity": "sha512-xchy/7PynZTkYXhismEYc+0XuDNDTzreKIyc/V3ohq4vnG79Iu+nPjDifvtICLHPCXTU8KSVno+PJX39XwhSjg==", + "license": "MIT", + "dependencies": { + "@types/uuid": "^10.0.0", + "commander": "^10.0.1", + "p-queue": "^6.6.2", + "p-retry": "4", + "semver": "^7.6.3", + "uuid": "^10.0.0" + }, + "peerDependencies": { + "openai": "*" + }, + "peerDependenciesMeta": { + "openai": { + "optional": true + } + } + }, + "node_modules/memory-pager": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", + "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", + "license": "MIT" + }, + "node_modules/mgrs": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/mgrs/-/mgrs-1.0.0.tgz", + "integrity": "sha512-awNbTOqCxK1DBGjalK3xqWIstBZgN6fxsMSiXLs9/spqWkF2pAhb2rrYCFSsr1/tT7PhcDGjZndG8SWYn0byYA==", + "license": "MIT" + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mongodb": { + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.9.0.tgz", + "integrity": "sha512-UMopBVx1LmEUbW/QE0Hw18u583PEDVQmUmVzzBRH0o/xtE9DBRA5ZYLOjpLIa03i8FXjzvQECJcqoMvCXftTUA==", + "license": "Apache-2.0", + "dependencies": { + "@mongodb-js/saslprep": "^1.1.5", + "bson": "^6.7.0", + "mongodb-connection-string-url": "^3.0.0" + }, + "engines": { + "node": ">=16.20.1" + }, + "peerDependencies": { + "@aws-sdk/credential-providers": "^3.188.0", + "@mongodb-js/zstd": "^1.1.0", + "gcp-metadata": "^5.2.0", + "kerberos": "^2.0.1", + "mongodb-client-encryption": ">=6.0.0 <7", + "snappy": "^7.2.2", + "socks": "^2.7.1" + }, + "peerDependenciesMeta": { + "@aws-sdk/credential-providers": { + "optional": true + }, + "@mongodb-js/zstd": { + "optional": true + }, + "gcp-metadata": { + "optional": true + }, + "kerberos": { + "optional": true + }, + "mongodb-client-encryption": { + "optional": true + }, + "snappy": { + "optional": true + }, + "socks": { + "optional": true + } + } + }, + "node_modules/mongodb-connection-string-url": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.1.tgz", + "integrity": "sha512-XqMGwRX0Lgn05TDB4PyG2h2kKO/FfWJyCzYQbIhXUxz7ETt0I/FqHjUeqj37irJ+Dl1ZtU82uYyj14u2XsZKfg==", + "license": "Apache-2.0", + "dependencies": { + "@types/whatwg-url": "^11.0.2", + "whatwg-url": "^13.0.0" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/mustache": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", + "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==", + "license": "MIT", + "bin": { + "mustache": "bin/mustache" + } + }, + "node_modules/node-addon-api": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.1.tgz", + "integrity": "sha512-2+DuKodWvwRTrCfKOeR24KIc5unKjOh8mz17NCzVnHWfjAdDqbfbjqh7gUT+BkXBRQM52+xCHciKWonJ3CbJMQ==", + "license": "MIT", + "optional": true + }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "license": "MIT", + "engines": { + "node": ">=10.5.0" + } + }, + "node_modules/node-ensure": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/node-ensure/-/node-ensure-0.0.0.tgz", + "integrity": "sha512-DRI60hzo2oKN1ma0ckc6nQWlHU69RH6xN0sjQTjMpChPfTYvKZdcQFfdYK2RWbJcKyUizSIy/l8OTGxMAM1QDw==", + "license": "MIT" + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-fetch/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" + }, + "node_modules/node-fetch/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" + }, + "node_modules/node-fetch/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "license": "MIT" + }, + "node_modules/object-is": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.6.tgz", + "integrity": "sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz", + "integrity": "sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/openai": { + "version": "4.63.0", + "resolved": "https://registry.npmjs.org/openai/-/openai-4.63.0.tgz", + "integrity": "sha512-Y9V4KODbmrOpqiOmCDVnPfMxMqKLOx8Hwcdn/r8mePq4yv7FSXGnxCs8/jZKO7zCB/IVPWihpJXwJNAIOEiZ2g==", + "license": "Apache-2.0", + "dependencies": { + "@types/node": "^18.11.18", + "@types/node-fetch": "^2.6.4", + "abort-controller": "^3.0.0", + "agentkeepalive": "^4.2.1", + "form-data-encoder": "1.7.2", + "formdata-node": "^4.3.2", + "node-fetch": "^2.6.7" + }, + "bin": { + "openai": "bin/cli" + }, + "peerDependencies": { + "zod": "^3.23.8" + }, + "peerDependenciesMeta": { + "zod": { + "optional": true + } + } + }, + "node_modules/openapi-types": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.1.3.tgz", + "integrity": "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==", + "license": "MIT" + }, + "node_modules/p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/p-queue": { + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.6.2.tgz", + "integrity": "sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==", + "license": "MIT", + "dependencies": { + "eventemitter3": "^4.0.4", + "p-timeout": "^3.2.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-retry": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.6.2.tgz", + "integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==", + "license": "MIT", + "dependencies": { + "@types/retry": "0.12.0", + "retry": "^0.13.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-timeout": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz", + "integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==", + "license": "MIT", + "dependencies": { + "p-finally": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pdf-parse": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pdf-parse/-/pdf-parse-1.1.1.tgz", + "integrity": "sha512-v6ZJ/efsBpGrGGknjtq9J/oC8tZWq0KWL5vQrk2GlzLEQPUDB1ex+13Rmidl1neNN358Jn9EHZw5y07FFtaC7A==", + "license": "MIT", + "dependencies": { + "debug": "^3.1.0", + "node-ensure": "^0.0.0" + }, + "engines": { + "node": ">=6.8.1" + } + }, + "node_modules/possible-typed-array-names": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", + "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/proj4": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/proj4/-/proj4-2.12.1.tgz", + "integrity": "sha512-vmhP3hmstjXjzFwg8QXJwpoj4n7GVrXk3ZW3DzNK/Ur4cuwXq7ZiMXaWYvLYLQbX8n4MXgbwTr4lthOUZltBpA==", + "license": "MIT", + "dependencies": { + "mgrs": "1.0.0", + "wkt-parser": "^1.3.3" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "license": "MIT" + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/q": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", + "integrity": "sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==", + "deprecated": "You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other.\n\n(For a CapTP with native promises, see @endo/eventual-send and @endo/captp)", + "license": "MIT", + "engines": { + "node": ">=0.6.0", + "teleport": ">=0.2.0" + } + }, + "node_modules/readline": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/readline/-/readline-1.3.0.tgz", + "integrity": "sha512-k2d6ACCkiNYz222Fs/iNze30rRJ1iIicW7JuX/7/cozvih6YCkFZH+J6mAFDVgv0dRBaAyr4jDqC95R2y4IADg==", + "license": "BSD" + }, + "node_modules/retry": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/sparse-bitfield": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", + "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", + "license": "MIT", + "dependencies": { + "memory-pager": "^1.0.2" + } + }, + "node_modules/thrift": { + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/thrift/-/thrift-0.20.0.tgz", + "integrity": "sha512-oSmJTaoIAGolpupVHFfsWcmdEKX81fcDI6ty0hhezzdgZvp0XyXgMe9+1YusI8Ahy0HK4n8jlNrkPjOPeHZjdQ==", + "license": "Apache-2.0", + "dependencies": { + "browser-or-node": "^1.2.1", + "isomorphic-ws": "^4.0.1", + "node-int64": "^0.4.0", + "q": "^1.5.0", + "ws": "^5.2.3" + }, + "engines": { + "node": ">= 10.18.0" + } + }, + "node_modules/tr46": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz", + "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==", + "license": "MIT", + "dependencies": { + "punycode": "^2.3.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "license": "MIT" + }, + "node_modules/util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, + "node_modules/uuid": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz", + "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/web-streams-polyfill": { + "version": "4.0.0-beta.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", + "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-url": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-13.0.0.tgz", + "integrity": "sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig==", + "license": "MIT", + "dependencies": { + "tr46": "^4.1.1", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz", + "integrity": "sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==", + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/wkt-parser": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/wkt-parser/-/wkt-parser-1.3.3.tgz", + "integrity": "sha512-ZnV3yH8/k58ZPACOXeiHaMuXIiaTk1t0hSUVisbO0t4RjA5wPpUytcxeyiN2h+LZRrmuHIh/1UlrR9e7DHDvTw==", + "license": "MIT" + }, + "node_modules/ws": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.4.tgz", + "integrity": "sha512-fFCejsuC8f9kOSu9FYaOw8CdO68O3h5v0lg4p74o8JqWpwTf9tniOD+nOB78aWoVSS6WptVUmDrp/KPsMVBWFQ==", + "license": "MIT", + "dependencies": { + "async-limiter": "~1.0.0" + } + }, + "node_modules/yaml": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.1.tgz", + "integrity": "sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==", + "license": "ISC", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/zod": { + "version": "3.23.8", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", + "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-to-json-schema": { + "version": "3.23.3", + "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.23.3.tgz", + "integrity": "sha512-TYWChTxKQbRJp5ST22o/Irt9KC5nj7CdBKYB/AosCRdj/wxEMvv4NNaj9XVUHDOIp53ZxArGhnw5HMZziPFjog==", + "license": "ISC", + "peerDependencies": { + "zod": "^3.23.3" + } + } + } +} diff --git a/apps/graph_rag_demo/package.json b/apps/graph_rag_demo/package.json new file mode 100644 index 0000000..6f83057 --- /dev/null +++ b/apps/graph_rag_demo/package.json @@ -0,0 +1,18 @@ +{ + "type": "module", + "dependencies": { + "@langchain/mongodb": "^0.0.4", + "@langchain/openai": "^0.2.4", + "assert": "^2.1.0", + "axios": "^1.7.2", + "dotenv": "^16.4.5", + "fs": "^0.0.1-security", + "hbase": "^0.6.1", + "langchain": "^0.2.10", + "mongodb": "^6.8.0", + "pdf-parse": "^1.1.1", + "proj4": "^2.11.0", + "readline": "^1.3.0", + "thrift": "^0.20.0" + } + } \ No newline at end of file diff --git a/apps/graph_rag_demo/user-interaction.html b/apps/graph_rag_demo/user-interaction.html new file mode 100644 index 0000000..167fc28 --- /dev/null +++ b/apps/graph_rag_demo/user-interaction.html @@ -0,0 +1,178 @@ + + + + + + + \ No newline at end of file From ba7db42006bad01fdc621a9325e605d791a2de9e Mon Sep 17 00:00:00 2001 From: Richmond Alake Date: Thu, 16 Jan 2025 18:46:51 +0000 Subject: [PATCH 2/4] Update addEmbeddings.js --- apps/graph_rag_demo/addEmbeddings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/graph_rag_demo/addEmbeddings.js b/apps/graph_rag_demo/addEmbeddings.js index 4962a69..7981e1c 100644 --- a/apps/graph_rag_demo/addEmbeddings.js +++ b/apps/graph_rag_demo/addEmbeddings.js @@ -6,7 +6,7 @@ import { PDFLoader } from "langchain/document_loaders/fs/pdf"; import dotenv from "dotenv"; dotenv.config(); -const client = new MongoClient(process.env.ATLAS_CONNECTION_STRING); +const client = new MongoClient(process.env.ATLAS_CONNECTION_STRING, appname="devrel.showcase.apps.graph_rag_demo"); process.env.OPENAI_API_KEY = process.env.OPENAI_API_KEY1; async function run() { From ddb662ed97cb9df3c728345f3ced5fde08845bff Mon Sep 17 00:00:00 2001 From: Richmond Alake Date: Thu, 16 Jan 2025 18:47:24 +0000 Subject: [PATCH 3/4] Update addTags.js --- apps/graph_rag_demo/addTags.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/graph_rag_demo/addTags.js b/apps/graph_rag_demo/addTags.js index d037d3f..de235e0 100644 --- a/apps/graph_rag_demo/addTags.js +++ b/apps/graph_rag_demo/addTags.js @@ -3,7 +3,7 @@ import dotenv from "dotenv"; dotenv.config(); async function findAllDocuments(dbName, collectionName1, collectionName2) { - const client = new MongoClient(process.env.ATLAS_CONNECTION_STRING); + const client = new MongoClient(process.env.ATLAS_CONNECTION_STRING, appname="devrel.showcase.apps.graph_rag_demo"); try { await client.connect(); console.log('Connected to MongoDB'); @@ -66,4 +66,4 @@ async function findAllDocuments(dbName, collectionName1, collectionName2) { } } -findAllDocuments('langchain_db', 'nodes_relationships', 'knowledge_graph').catch(console.dir); \ No newline at end of file +findAllDocuments('langchain_db', 'nodes_relationships', 'knowledge_graph').catch(console.dir); From ee16519bc56f2b7c6ff97c0c66f989ae7644be23 Mon Sep 17 00:00:00 2001 From: Richmond Alake Date: Thu, 16 Jan 2025 18:48:14 +0000 Subject: [PATCH 4/4] Update do_graphlookup.py --- apps/graph_rag_demo/do_graphlookup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/graph_rag_demo/do_graphlookup.py b/apps/graph_rag_demo/do_graphlookup.py index ba2e499..7d4fb8f 100644 --- a/apps/graph_rag_demo/do_graphlookup.py +++ b/apps/graph_rag_demo/do_graphlookup.py @@ -9,7 +9,7 @@ def graph_lookup(node_name,max_depth): graph_lookup_docs = [] try: uri = os.getenv("ATLAS_CONNECTION_STRING") - client = MongoClient(uri) + client = MongoClient(uri, appname="devrel.showcase.apps.graph_rag_demo") database = client["langchain_db"] collection = database["nodes_relationships"] pipeline = [ @@ -38,4 +38,4 @@ def graph_lookup(node_name,max_depth): finally: client.close() pprint(graph_lookup_docs) - return graph_lookup_docs \ No newline at end of file + return graph_lookup_docs