Skip to content

Commit 9487dcb

Browse files
committed
edit imports in .ipynb
1 parent 5b699b5 commit 9487dcb

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

use_cases/question_answering/chatbot.ipynb

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,24 @@
2020
"metadata": {},
2121
"outputs": [],
2222
"source": [
23-
"# Import needed modules from LightRAGfrom adalflow.core.component import Component\n",
23+
"from IPython.display import clear_output\n",
24+
"!pip install -U adalflow[openai,groq,faiss-cpu]\n",
25+
"clear_output()"
26+
]
27+
},
28+
{
29+
"cell_type": "code",
30+
"execution_count": null,
31+
"metadata": {},
32+
"outputs": [],
33+
"source": [
34+
"# Import needed modules from Adalflow\n",
35+
"import os\n",
36+
"from getpass import getpass\n",
37+
"from adalflow.core.component import Component\n",
2438
"from adalflow.core.generator import Generator\n",
25-
"from adalflow.components.memory.memory import Memory"
39+
"from adalflow.components.memory.memory import Memory\n",
40+
"from adalflow.components.model_client import OpenAIClient # Here, we use the OpenAIClient as an example, but you can use any other clients (with the corresponding API Key as needed), such as AnthropicAPIClient"
2641
]
2742
},
2843
{
@@ -31,9 +46,11 @@
3146
"metadata": {},
3247
"outputs": [],
3348
"source": [
34-
"# Here, we use the OpenAIClient as an example, but you can use any other clients (with the corresponding API Key as needed), such as AnthropicAPIClient\n",
35-
"from adalflow.components.model_client import OpenAIClient\n",
36-
"OPENAI_API_KEY=\"YOUR_API_KEY\" # Replace with your OpenAI API Key, or you can put it in a .env file"
49+
"# Prompt user to enter their API keys securely\n",
50+
"openai_api_key = getpass(\"Please enter your OpenAI API key: \")\n",
51+
"# Set environment variables\n",
52+
"os.environ['OPENAI_API_KEY'] = openai_api_key\n",
53+
"# Replace with your OpenAI API Key, or you can put it in a .env file"
3754
]
3855
},
3956
{
@@ -48,7 +65,7 @@
4865
" super().__init__()\n",
4966
" self.generator = Generator(\n",
5067
" model_client=OpenAIClient(),\n",
51-
" model_kwargs={'model': 'gpt-3.5-turbo'}\n",
68+
" model_kwargs={'model': 'gpt-4o-mini'}\n",
5269
" )\n",
5370
" self.chat_history = Memory() # Memory to store the chat history\n",
5471
" \n",

0 commit comments

Comments
 (0)