Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-run notebooks #302

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
199 changes: 49 additions & 150 deletions docs/source/apis.ipynb

Large diffs are not rendered by default.

727 changes: 473 additions & 254 deletions docs/source/document_extraction.ipynb

Large diffs are not rendered by default.

80 changes: 47 additions & 33 deletions docs/source/nested_objects.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,24 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 24,
"id": "0b4597b2-2a43-4491-8830-bf9f79428074",
"metadata": {
"nbsphinx": "hidden",
"tags": [
"remove-cell"
]
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
]
}
],
"source": [
"%load_ext autoreload\n",
"%autoreload 2\n",
Expand All @@ -34,7 +43,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 25,
"id": "718c66a7-6186-4ed8-87e9-5ed28e3f209e",
"metadata": {
"tags": []
Expand All @@ -48,15 +57,15 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 26,
"id": "9bc98f35-ea5f-4b74-a32e-a300a22c0c89",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"llm = ChatOpenAI(\n",
" model_name=\"gpt-3.5-turbo\",\n",
" model_name=\"gpt-4o\",\n",
" temperature=0,\n",
" max_tokens=2000,\n",
")"
Expand All @@ -74,7 +83,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 27,
"id": "f75990e6-5973-4618-9f15-f3b60a14bfa5",
"metadata": {
"tags": []
Expand Down Expand Up @@ -138,7 +147,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 28,
"id": "54a199a5-24b4-442c-8907-1449e437a880",
"metadata": {
"tags": []
Expand All @@ -152,7 +161,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 29,
"id": "193e257b-df01-45ec-af77-076d2070533b",
"metadata": {
"tags": []
Expand All @@ -162,14 +171,14 @@
"data": {
"text/plain": [
"{'information': [{'person_name': 'Alice Doe',\n",
" 'from_address': {'city': 'New York'},\n",
" 'to_address': {'city': 'Boston', 'state': 'MA'}},\n",
" 'from_address': {'city': 'New York', 'state': 'NY', 'country': 'USA'},\n",
" 'to_address': {'city': 'Boston', 'state': 'MA', 'country': 'USA'}},\n",
" {'person_name': 'Bob Smith',\n",
" 'from_address': {'city': 'Boston', 'state': 'MA'},\n",
" 'to_address': {'city': 'New York'}}]}"
" 'from_address': {'city': 'Boston', 'state': 'MA', 'country': 'USA'},\n",
" 'to_address': {'city': 'New York', 'state': 'NY', 'country': 'USA'}}]}"
]
},
"execution_count": 6,
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -182,7 +191,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 30,
"id": "c8295f36-f986-4db2-97bc-ef2e6cdbcc87",
"metadata": {
"tags": []
Expand All @@ -192,20 +201,23 @@
"data": {
"text/plain": [
"{'information': [{'person_name': 'Alice Doe',\n",
" 'from_address': {'city': 'New York'},\n",
" 'to_address': {'city': 'Boston'}},\n",
" 'from_address': {'city': 'New York', 'state': 'NY', 'country': 'USA'},\n",
" 'to_address': {'city': 'Boston', 'state': 'MA', 'country': 'USA'}},\n",
" {'person_name': 'Bob Smith',\n",
" 'from_address': {'city': 'New York'},\n",
" 'to_address': {'city': 'Boston'}},\n",
" {'person_name': 'Andrew', 'to_address': {'city': 'Boston'}},\n",
" {'person_name': 'Joana', 'to_address': {'city': 'Boston'}},\n",
" {'person_name': 'Paul', 'to_address': {'city': 'Boston'}},\n",
" 'from_address': {'city': 'New York', 'state': 'NY', 'country': 'USA'},\n",
" 'to_address': {'city': 'Boston', 'state': 'MA', 'country': 'USA'}},\n",
" {'person_name': 'Andrew',\n",
" 'to_address': {'city': 'Boston', 'state': 'MA', 'country': 'USA'}},\n",
" {'person_name': 'Joana',\n",
" 'to_address': {'city': 'Boston', 'state': 'MA', 'country': 'USA'}},\n",
" {'person_name': 'Paul',\n",
" 'to_address': {'city': 'Boston', 'state': 'MA', 'country': 'USA'}},\n",
" {'person_name': 'Betty',\n",
" 'from_address': {'city': 'Boston'},\n",
" 'to_address': {'city': 'New York'}}]}"
" 'from_address': {'city': 'Boston', 'state': 'MA', 'country': 'USA'},\n",
" 'to_address': {'city': 'New York', 'state': 'NY', 'country': 'USA'}}]}"
]
},
"execution_count": 7,
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -235,7 +247,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 31,
"id": "e528f20c-46d3-40b6-b1ba-11024002deb8",
"metadata": {
"tags": []
Expand Down Expand Up @@ -288,7 +300,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 32,
"id": "23b81b06-118a-4ebe-9e20-5df1bf269ce3",
"metadata": {
"tags": []
Expand All @@ -300,7 +312,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 33,
"id": "29219fae-41cb-4235-92fa-07b16ded2296",
"metadata": {
"tags": []
Expand All @@ -310,14 +322,16 @@
"data": {
"text/plain": [
"{'information': [{'person_name': 'Alice Doe',\n",
" 'from_address': [{'city': 'New York'}],\n",
" 'to_address': [{'city': 'Boston'}]},\n",
" 'from_address': [{'city': 'New York', 'state': 'NY', 'country': 'USA'}],\n",
" 'to_address': [{'city': 'Boston', 'state': 'MA', 'country': 'USA'}]},\n",
" {'person_name': 'Bob Smith',\n",
" 'from_address': [{'city': 'New York'}],\n",
" 'to_address': [{'city': 'Boston'}, {'city': 'LA'}]}]}"
" 'from_address': [{'city': 'New York', 'state': 'NY', 'country': 'USA'},\n",
" {'city': 'Boston', 'state': 'MA', 'country': 'USA'}],\n",
" 'to_address': [{'city': 'Boston', 'state': 'MA', 'country': 'USA'},\n",
" {'city': 'LA', 'state': 'CA', 'country': 'USA'}]}]}"
]
},
"execution_count": 10,
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -345,7 +359,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.9.6"
}
},
"nbformat": 4,
Expand Down
29 changes: 19 additions & 10 deletions docs/source/objects.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"outputs": [],
"source": [
"llm = ChatOpenAI(\n",
" model_name=\"gpt-3.5-turbo\",\n",
" model_name=\"gpt-4o\",\n",
" temperature=0,\n",
" max_tokens=2000,\n",
")"
Expand Down Expand Up @@ -194,6 +194,14 @@
"tags": []
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/eugene/.pyenv/versions/3.9.6/envs/kor/lib/python3.9/site-packages/langchain_core/_api/deprecation.py:119: LangChainDeprecationWarning: The method `Chain.run` was deprecated in langchain 0.1.0 and will be removed in 0.2.0. Use invoke instead.\n",
" warn_deprecated(\n"
]
},
{
"data": {
"text/plain": [
Expand Down Expand Up @@ -221,7 +229,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"{'personal_info': [{'first_name': 'Bob', 'last_name': 'Alice', 'age': ''}]}\n"
"{'personal_info': [{'first_name': 'Bob', 'last_name': 'Alice', 'age': ''}, {'first_name': 'Moana', 'last_name': 'Sunrise', 'age': '10'}]}\n"
]
}
],
Expand Down Expand Up @@ -254,7 +262,7 @@
{
"data": {
"text/plain": [
"{'personal_info': [{'first_name': '', 'last_name': '', 'age': ''}]}"
"{'personal_info': []}"
]
},
"execution_count": 8,
Expand Down Expand Up @@ -325,7 +333,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 12,
"id": "5c694d79-e72c-4712-b891-111bc0279032",
"metadata": {
"tags": []
Expand All @@ -334,11 +342,12 @@
{
"data": {
"text/plain": [
"{'personal_info': [{'first_name': 'Bob', 'last_name': 'Alice', 'age': ''},\n",
" {'first_name': 'Moana', 'last_name': 'Sunrise', 'age': '10'}]}"
"{'personal_info': [{'first_name': 'Moana',\n",
" 'last_name': 'Sunrise',\n",
" 'age': '20'}]}"
]
},
"execution_count": 10,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -347,7 +356,7 @@
"chain = create_extraction_chain(llm, schema)\n",
"chain.run(\n",
" \"My name is Bob Alice and my phone number is (123)-444-9999. I found my true love one\"\n",
" \" on a blue sunday. Her number was (333)1232832. Her name was Moana Sunrise and she was 10 years old.\"\n",
" \" on a blue sunday. Her number was (333)1232832. Her name was Moana Sunrise and she was 20 years old.\"\n",
")[\"data\"]"
]
},
Expand All @@ -361,7 +370,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 13,
"id": "a2944e8c-4630-4b29-b505-b2ca6fceba01",
"metadata": {
"tags": []
Expand Down Expand Up @@ -419,7 +428,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.9.6"
}
},
"nbformat": 4,
Expand Down
8 changes: 5 additions & 3 deletions docs/source/prompt.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"outputs": [],
"source": [
"llm = ChatOpenAI(\n",
" model_name=\"gpt-3.5-turbo\",\n",
" model_name=\"gpt-4o\",\n",
" temperature=0,\n",
")\n",
"\n",
Expand Down Expand Up @@ -195,7 +195,9 @@
"cell_type": "code",
"execution_count": 7,
"id": "86611975-41c8-41d4-9347-7e3f4ae5247f",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"class CatType(TypeDescriptor):\n",
Expand Down Expand Up @@ -277,7 +279,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.9.6"
}
},
"nbformat": 4,
Expand Down
Loading
Loading