diff --git a/01-getting-started/end-to-end-example.ipynb b/01-getting-started/end-to-end-example.ipynb index bf5e3fe..a32c814 100644 --- a/01-getting-started/end-to-end-example.ipynb +++ b/01-getting-started/end-to-end-example.ipynb @@ -123,9 +123,9 @@ "outputs": [], "source": [ "if not os.path.exists('data/Apple.pdf'):\n", - " print(f\"Fetching data/fin_train.jsonl\")\n", - " response = requests.get(\"https://raw.githubusercontent.com/ContextualAI/examples/refs/heads/main/01-getting-started/data/fin_train.jsonl\")\n", - " with open('data/fin_train.jsonl', 'wb') as f:\n", + " print(f\"Fetching data/Apple.pdf\")\n", + " response = requests.get(\"https://raw.githubusercontent.com/ContextualAI/examples/refs/heads/main/01-getting-started/data/Apple.pdf\")\n", + " with open('data/Apple.pdf', 'wb') as f:\n", " f.write(response.content)" ] }, @@ -135,7 +135,7 @@ "metadata": {}, "outputs": [], "source": [ - "with open('Apple.pdf', 'rb') as f:\n", + "with open('data/Apple.pdf', 'rb') as f:\n", " ingestion_result = client.datastores.documents.ingest(datastore_id, file=f)\n", " document_id = ingestion_result.id\n", " print(f\"Successfully uploaded to datastore {datastore_id}\")" diff --git a/02-hands-on-lab/lab1_create_agent.ipynb b/02-hands-on-lab/lab1_create_agent.ipynb index 74f815f..bf0f968 100644 --- a/02-hands-on-lab/lab1_create_agent.ipynb +++ b/02-hands-on-lab/lab1_create_agent.ipynb @@ -74,6 +74,7 @@ "outputs": [], "source": [ "import os\n", + "import requests\n", "from contextual import ContextualAI\n", "from IPython.display import display, Markdown" ] @@ -167,6 +168,19 @@ "I am using a example PDF. You can also use your own documents here. If you have very long documents (hundreds of pages), processing can take longer." ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "if not os.path.exists('data/Apple.pdf'):\n", + " print(f\"Fetching data/Apple.pdf\")\n", + " response = requests.get(\"https://raw.githubusercontent.com/ContextualAI/examples/refs/heads/main/02-hands-on-lab/data/Apple.pdf\")\n", + " with open('data/Apple.pdf', 'wb') as f:\n", + " f.write(response.content)" + ] + }, { "cell_type": "code", "execution_count": 6, diff --git a/02-hands-on-lab/lab2_evalulate_agent.ipynb b/02-hands-on-lab/lab2_evalulate_agent.ipynb index b7e2415..d761fb7 100644 --- a/02-hands-on-lab/lab2_evalulate_agent.ipynb +++ b/02-hands-on-lab/lab2_evalulate_agent.ipynb @@ -36,6 +36,7 @@ "import os\n", "import json\n", "import ast\n", + "import requests\n", "import pandas as pd\n", "from contextual import ContextualAI" ] @@ -158,6 +159,19 @@ "Let's start with an evaluation dataset:" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "if not os.path.exists('data/eval_short.csv'):\n", + " print(f\"Fetching data/eval_short.csv\")\n", + " response = requests.get(\"https://raw.githubusercontent.com/ContextualAI/examples/refs/heads/main/01-hands-on-lab/data/eval_short.csv\")\n", + " with open('data/eval_short.csv', 'wb') as f:\n", + " f.write(response.content)" + ] + }, { "cell_type": "code", "execution_count": 23, @@ -715,6 +729,19 @@ "- prompt field should be a question or statement that the model should respond to." ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "if not os.path.exists('data/fin_train.jsonl'):\n", + " print(f\"Fetching data/fin_train.jsonl\")\n", + " response = requests.get(\"https://raw.githubusercontent.com/ContextualAI/examples/refs/heads/main/01-hands-on-lab/data/fin_train.jsonl\")\n", + " with open('data/fin_train.jsonl', 'wb') as f:\n", + " f.write(response.content)" + ] + }, { "cell_type": "code", "execution_count": null, @@ -730,13 +757,6 @@ "!head data/fin_train.jsonl" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "markdown", "metadata": { diff --git a/02-hands-on-lab/lab3_improve_agent.ipynb b/02-hands-on-lab/lab3_improve_agent.ipynb index 4bdbcbb..4dc7e16 100644 --- a/02-hands-on-lab/lab3_improve_agent.ipynb +++ b/02-hands-on-lab/lab3_improve_agent.ipynb @@ -18,6 +18,7 @@ "outputs": [], "source": [ "import os\n", + "import requests\n", "from contextual import ContextualAI\n", "from IPython.display import display, Markdown" ] @@ -192,6 +193,19 @@ "Now that you have updated the agent, go try running another evaluation job. You will see the performance has improved." ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "if not os.path.exists('data/eval_short.csv'):\n", + " print(f\"Fetching data/eval_short.csv\")\n", + " response = requests.get(\"https://raw.githubusercontent.com/ContextualAI/examples/refs/heads/main/02-hands-on-lab/data/eval_short.csv\")\n", + " with open('data/eval_short.csv', 'wb') as f:\n", + " f.write(response.content)" + ] + }, { "cell_type": "code", "execution_count": 28,