Skip to content

Commit

Permalink
Update notebooks (#215)
Browse files Browse the repository at this point in the history
Re-running notebooks with pydantic v2 to verify everything works
  • Loading branch information
eyurtsev authored Sep 6, 2023
1 parent 3ede2f6 commit 29595bc
Show file tree
Hide file tree
Showing 13 changed files with 174 additions and 248 deletions.
105 changes: 44 additions & 61 deletions docs/source/apis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"id": "0b4597b2-2a43-4491-8830-bf9f79428074",
"metadata": {
"nbsphinx": "hidden",
Expand All @@ -35,7 +35,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"id": "c719e4fc-3ccf-4633-a787-b2fe0d1eac65",
"metadata": {
"tags": []
Expand All @@ -48,36 +48,17 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"id": "f1313c02-d415-4ce6-bff0-3df537cc06c2",
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING! frequency_penalty is not default parameter.\n",
" frequency_penalty was transferred to model_kwargs.\n",
" Please confirm that frequency_penalty is what you intended.\n",
"WARNING! presence_penalty is not default parameter.\n",
" presence_penalty was transferred to model_kwargs.\n",
" Please confirm that presence_penalty is what you intended.\n",
"WARNING! top_p is not default parameter.\n",
" top_p was transferred to model_kwargs.\n",
" Please confirm that top_p is what you intended.\n"
]
}
],
"outputs": [],
"source": [
"llm = ChatOpenAI(\n",
" model_name=\"gpt-3.5-turbo\",\n",
" temperature=0,\n",
" max_tokens=2000,\n",
" frequency_penalty=0,\n",
" presence_penalty=0,\n",
" top_p=1.0,\n",
")"
]
},
Expand All @@ -99,7 +80,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"id": "f61c94db-c05d-43ba-9ffc-b58552c715c3",
"metadata": {
"tags": []
Expand Down Expand Up @@ -156,7 +137,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"id": "ff9ad27f-7a81-4123-8d0b-1e14802df67e",
"metadata": {
"tags": []
Expand All @@ -176,7 +157,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 6,
"id": "760baa5f-9368-4b5a-abc0-6ac65c34b7a7",
"metadata": {
"tags": []
Expand All @@ -188,7 +169,7 @@
"{'player': {'action': 'stop'}}"
]
},
"execution_count": 7,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -199,7 +180,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 7,
"id": "462303c0-e83a-4e39-86cd-cab6875b40ef",
"metadata": {
"tags": []
Expand All @@ -211,7 +192,7 @@
"{'player': {'action': 'play'}}"
]
},
"execution_count": 8,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -222,7 +203,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 8,
"id": "02c7f1e5-1c8d-4e9f-82e6-c37a41d6de14",
"metadata": {
"tags": []
Expand All @@ -234,7 +215,7 @@
"{'player': {'album': ['the lion king soundtrack']}}"
]
},
"execution_count": 9,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -245,7 +226,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 9,
"id": "7a6d918c-53fe-426b-b37e-eec2abb8a704",
"metadata": {
"tags": []
Expand All @@ -260,7 +241,7 @@
" 'validated_data': {}}"
]
},
"execution_count": 10,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -271,7 +252,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 10,
"id": "b18acf0a-d99e-48de-ace5-fb01bded5a41",
"metadata": {
"tags": []
Expand All @@ -283,7 +264,7 @@
"{'player': {'action': 'previous'}}"
]
},
"execution_count": 11,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -304,7 +285,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 11,
"id": "c50b080b-7179-4bbe-b234-83ce59e2d215",
"metadata": {
"tags": []
Expand Down Expand Up @@ -351,7 +332,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 12,
"id": "404e4f1a-d316-41f2-ab94-040e22001fc4",
"metadata": {
"tags": []
Expand All @@ -363,7 +344,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 13,
"id": "73c31ace-32dd-4a33-ae39-475db6934f6d",
"metadata": {
"tags": []
Expand All @@ -373,24 +354,22 @@
"data": {
"text/plain": [
"{'action': {'sport': 'baseball',\n",
" 'location': 'LA',\n",
" 'location': 'LA area',\n",
" 'price_range': {'price_max': '100', 'currency': '$'}}}"
]
},
"execution_count": 14,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"chain.run(\n",
" \"I want to buy tickets for a baseball game in LA area under $100\"\n",
")[\"data\"]"
"chain.run(\"I want to buy tickets for a baseball game in LA area under $100\")[\"data\"]"
]
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 14,
"id": "78e3b3af-bfa8-4503-854a-b83a7f8f49e6",
"metadata": {
"tags": []
Expand All @@ -404,7 +383,7 @@
" 'price_range': {'price_min': '20', 'price_max': '40', 'currency': '$'}}}"
]
},
"execution_count": 16,
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -431,7 +410,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 15,
"id": "2b0bcf09-a3ae-4a8a-9ce3-f86834ce6ca2",
"metadata": {
"tags": []
Expand Down Expand Up @@ -594,7 +573,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 16,
"id": "7b389d20-ae6b-4764-9209-3cd3c2f0a715",
"metadata": {
"tags": []
Expand All @@ -614,7 +593,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 17,
"id": "b203ac4a-4f9f-45c6-a509-39b9a6cfd98f",
"metadata": {
"tags": []
Expand All @@ -626,7 +605,7 @@
"{}"
]
},
"execution_count": 19,
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -641,7 +620,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 18,
"id": "398377bf-5d30-4b4c-b637-e9af969d16a4",
"metadata": {
"tags": []
Expand All @@ -657,7 +636,7 @@
" 'attribute_selection': ['revenue', 'eps']}}"
]
},
"execution_count": 20,
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -672,7 +651,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 19,
"id": "2a620246-4c85-4256-8f58-0acbcc9455a3",
"metadata": {
"tags": []
Expand All @@ -686,7 +665,7 @@
" 'value': ['red', 'blue']}]}}"
]
},
"execution_count": 21,
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -698,7 +677,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 20,
"id": "4745517e-507e-4d1a-97e0-d143fa34cea2",
"metadata": {
"tags": []
Expand All @@ -713,7 +692,7 @@
" 'attribute_selection': ['revenue']}}"
]
},
"execution_count": 22,
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -725,7 +704,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 25,
"id": "b206407f-57e0-4212-8e75-970cb49b52e5",
"metadata": {
"tags": []
Expand All @@ -734,25 +713,29 @@
{
"data": {
"text/plain": [
"{}"
"{'search_for_companies': {'attribute_filter': [{'attribute': 'market cap',\n",
" 'op': '>',\n",
" 'value': '1000000'},\n",
" {'attribute': 'building color', 'op': 'in', 'value': ['red', 'blue']}],\n",
" 'attribute_selection': ['revenue', 'eps']}}"
]
},
"execution_count": 23,
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"text = (\n",
" \"revenue, eps of indian companies that have market cap of over 1 million, \"\n",
" \"but less than 50 employees and own red and blue buildings\"\n",
" \"that own red and blue buildings\"\n",
")\n",
"chain.run(text)[\"data\"]"
]
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 22,
"id": "a1025f99-eb0a-4d96-923e-35f36e4ac6b2",
"metadata": {
"tags": []
Expand Down Expand Up @@ -867,7 +850,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 29595bc

Please sign in to comment.