Skip to content

Commit

Permalink
update notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewfulton9 committed Jan 17, 2025
1 parent e35def6 commit 4675682
Showing 1 changed file with 7 additions and 50 deletions.
57 changes: 7 additions & 50 deletions preprocessing_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,47 +51,6 @@
"md_files = list(docs_path.glob(\"**/*.md\"))"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "8c2c65be-03fb-45dd-b9a2-4c9684e09b83",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting openai\n",
" Downloading openai-1.59.7-py3-none-any.whl.metadata (27 kB)\n",
"Requirement already satisfied: anyio<5,>=3.5.0 in /home/andrew/micromamba/envs/ragna-dev/lib/python3.10/site-packages (from openai) (4.8.0)\n",
"Collecting distro<2,>=1.7.0 (from openai)\n",
" Using cached distro-1.9.0-py3-none-any.whl.metadata (6.8 kB)\n",
"Requirement already satisfied: httpx<1,>=0.23.0 in /home/andrew/micromamba/envs/ragna-dev/lib/python3.10/site-packages (from openai) (0.28.1)\n",
"Collecting jiter<1,>=0.4.0 (from openai)\n",
" Downloading jiter-0.8.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.2 kB)\n",
"Requirement already satisfied: pydantic<3,>=1.9.0 in /home/andrew/micromamba/envs/ragna-dev/lib/python3.10/site-packages (from openai) (2.10.5)\n",
"Requirement already satisfied: sniffio in /home/andrew/micromamba/envs/ragna-dev/lib/python3.10/site-packages (from openai) (1.3.1)\n",
"Requirement already satisfied: tqdm>4 in /home/andrew/micromamba/envs/ragna-dev/lib/python3.10/site-packages (from openai) (4.67.1)\n",
"Requirement already satisfied: typing-extensions<5,>=4.11 in /home/andrew/micromamba/envs/ragna-dev/lib/python3.10/site-packages (from openai) (4.12.2)\n",
"Requirement already satisfied: exceptiongroup>=1.0.2 in /home/andrew/micromamba/envs/ragna-dev/lib/python3.10/site-packages (from anyio<5,>=3.5.0->openai) (1.2.2)\n",
"Requirement already satisfied: idna>=2.8 in /home/andrew/micromamba/envs/ragna-dev/lib/python3.10/site-packages (from anyio<5,>=3.5.0->openai) (3.10)\n",
"Requirement already satisfied: certifi in /home/andrew/micromamba/envs/ragna-dev/lib/python3.10/site-packages (from httpx<1,>=0.23.0->openai) (2024.12.14)\n",
"Requirement already satisfied: httpcore==1.* in /home/andrew/micromamba/envs/ragna-dev/lib/python3.10/site-packages (from httpx<1,>=0.23.0->openai) (1.0.7)\n",
"Requirement already satisfied: h11<0.15,>=0.13 in /home/andrew/micromamba/envs/ragna-dev/lib/python3.10/site-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai) (0.14.0)\n",
"Requirement already satisfied: annotated-types>=0.6.0 in /home/andrew/micromamba/envs/ragna-dev/lib/python3.10/site-packages (from pydantic<3,>=1.9.0->openai) (0.7.0)\n",
"Requirement already satisfied: pydantic-core==2.27.2 in /home/andrew/micromamba/envs/ragna-dev/lib/python3.10/site-packages (from pydantic<3,>=1.9.0->openai) (2.27.2)\n",
"Downloading openai-1.59.7-py3-none-any.whl (454 kB)\n",
"Using cached distro-1.9.0-py3-none-any.whl (20 kB)\n",
"Downloading jiter-0.8.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (345 kB)\n",
"Installing collected packages: jiter, distro, openai\n",
"Successfully installed distro-1.9.0 jiter-0.8.2 openai-1.59.7\n"
]
}
],
"source": [
"!pip install openai"
]
},
{
"cell_type": "code",
"execution_count": 11,
Expand Down Expand Up @@ -132,7 +91,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 29,
"id": "861713ce-bb5f-484b-b7e3-e96b9b8775ab",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -172,7 +131,9 @@
" def ask_assistant(self, prompt):\n",
" instruction = (\"take the following prompt and \"\n",
" \"improve it so that it will be \"\n",
" \"better for querying a database: \" + prompt)\n",
" \"better for querying a database. \"\n",
" \"Only give the reformatted prompt. \"\n",
" \"do not give any other context.: \" + prompt)\n",
" \n",
" assistant_answer = stream_openai(client, \"user\", instruction)\n",
" return assistant_answer\n",
Expand All @@ -198,7 +159,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 30,
"id": "e0966f19-a524-49ce-9769-75e486231c60",
"metadata": {},
"outputs": [],
Expand All @@ -208,7 +169,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 31,
"id": "4a9af3eb-5efe-4d17-875d-5480f928c94d",
"metadata": {
"scrolled": true
Expand All @@ -225,11 +186,7 @@
"\n",
"Your last prompt was:\n",
"\n",
"> To improve the prompt for querying a database, it's important to specify the context, the type of events you're interested in, and any relevant parameters. Here’s a refined version:\n",
"\n",
"\"Can you provide a summary of significant events that occurred in the year 2022, including their dates, locations, and categories (e.g., economic, social, political, or environmental)?\"\n",
"\n",
"This version clarifies the timeframe and the specific details you want to obtain, which will facilitate more accurate database queries.\n",
"> What events or occurrences took place in the year 2022?\n",
"\n",
"These are the sources I was given:\n",
"\n",
Expand Down

0 comments on commit 4675682

Please sign in to comment.