From 3a09c2bd625692c319c640277730c30bcce28647 Mon Sep 17 00:00:00 2001 From: Sidharth Mohanty Date: Thu, 21 Dec 2023 10:32:47 +0530 Subject: [PATCH] [docs] add a faq on how to persist data (#1040) --- docs/get-started/faq.mdx | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/docs/get-started/faq.mdx b/docs/get-started/faq.mdx index a0c6dcb9..15aa5837 100644 --- a/docs/get-started/faq.mdx +++ b/docs/get-started/faq.mdx @@ -144,6 +144,45 @@ response = app.query("What is the net worth of Elon Musk?") ``` + + + Set up the app by adding an `id` in the config file. This keeps the data for future use. You can include this `id` in the yaml config or input it directly in `config` dict. + ```python app1.py + import os + from embedchain import Pipeline as App + + os.environ['OPENAI_API_KEY'] = 'sk-xxx' + + app1 = App.from_config(config={ + "app": { + "config": { + "id": "your-app-id", + } + } + }) + + app1.add("https://www.forbes.com/profile/elon-musk") + + response = app1.query("What is the net worth of Elon Musk?") + ``` + ```python app2.py + import os + from embedchain import Pipeline as App + + os.environ['OPENAI_API_KEY'] = 'sk-xxx' + + app2 = App.from_config(config={ + "app": { + "config": { + # this will persist and load data from app1 session + "id": "your-app-id", + } + } + }) + + response = app2.query("What is the net worth of Elon Musk?") + ``` + #### Still have questions?