Skip to content

Commit

Permalink
edit imports in .ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
fm1320 committed Dec 4, 2024
1 parent 5b699b5 commit 9487dcb
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions use_cases/question_answering/chatbot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,24 @@
"metadata": {},
"outputs": [],
"source": [
"# Import needed modules from LightRAGfrom adalflow.core.component import Component\n",
"from IPython.display import clear_output\n",
"!pip install -U adalflow[openai,groq,faiss-cpu]\n",
"clear_output()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Import needed modules from Adalflow\n",
"import os\n",
"from getpass import getpass\n",
"from adalflow.core.component import Component\n",
"from adalflow.core.generator import Generator\n",
"from adalflow.components.memory.memory import Memory"
"from adalflow.components.memory.memory import Memory\n",
"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"
]
},
{
Expand All @@ -31,9 +46,11 @@
"metadata": {},
"outputs": [],
"source": [
"# 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",
"from adalflow.components.model_client import OpenAIClient\n",
"OPENAI_API_KEY=\"YOUR_API_KEY\" # Replace with your OpenAI API Key, or you can put it in a .env file"
"# Prompt user to enter their API keys securely\n",
"openai_api_key = getpass(\"Please enter your OpenAI API key: \")\n",
"# Set environment variables\n",
"os.environ['OPENAI_API_KEY'] = openai_api_key\n",
"# Replace with your OpenAI API Key, or you can put it in a .env file"
]
},
{
Expand All @@ -48,7 +65,7 @@
" super().__init__()\n",
" self.generator = Generator(\n",
" model_client=OpenAIClient(),\n",
" model_kwargs={'model': 'gpt-3.5-turbo'}\n",
" model_kwargs={'model': 'gpt-4o-mini'}\n",
" )\n",
" self.chat_history = Memory() # Memory to store the chat history\n",
" \n",
Expand Down

0 comments on commit 9487dcb

Please sign in to comment.