diff --git a/.gitignore b/.gitignore index 4e7361d..c05c12f 100644 --- a/.gitignore +++ b/.gitignore @@ -112,3 +112,5 @@ Untitled*.ipynb lcov.info ops.ipynb + +.jupyter_ystore.db diff --git a/chatlab/builtins/__init__.py b/chatlab/builtins/__init__.py index 5d4a2da..40bd6d9 100644 --- a/chatlab/builtins/__init__.py +++ b/chatlab/builtins/__init__.py @@ -2,9 +2,11 @@ from deprecation import deprecated -from .files import chat_functions as file_functions -from .python import get_python_docs, run_python -from .shell import chat_functions as shell_functions +from ..tools import run_python, get_python_docs, file_functions, shell_functions + +# TODO: Deprecate extra namespace +# compose all the file, shell, and python functions into one list for ease of use +os_functions = file_functions + shell_functions + [run_python, get_python_docs] # To prevent naming confusion, the builtin that isn't really running a cell # is deprecated. @@ -14,8 +16,6 @@ details="run_cell is deprecated. Use run_python instead for same-session execution.", )(run_python) -# compose all the file, shell, and python functions into one list for ease of use -os_functions = file_functions + shell_functions + [run_python, get_python_docs] __all__ = [ "run_python", diff --git a/chatlab/tools/__init__.py b/chatlab/tools/__init__.py new file mode 100644 index 0000000..c884756 --- /dev/null +++ b/chatlab/tools/__init__.py @@ -0,0 +1,11 @@ +from .files import chat_functions as file_functions +from .python import get_python_docs, run_python +from .shell import chat_functions as shell_functions + +__all__ = [ + "file_functions", + "get_python_docs", + "run_python", + "shell_functions", +] + diff --git a/chatlab/builtins/_mediatypes.py b/chatlab/tools/_mediatypes.py similarity index 100% rename from chatlab/builtins/_mediatypes.py rename to chatlab/tools/_mediatypes.py diff --git a/chatlab/builtins/colors.py b/chatlab/tools/colors.py similarity index 100% rename from chatlab/builtins/colors.py rename to chatlab/tools/colors.py diff --git a/chatlab/builtins/files.py b/chatlab/tools/files.py similarity index 100% rename from chatlab/builtins/files.py rename to chatlab/tools/files.py diff --git a/chatlab/builtins/python.py b/chatlab/tools/python.py similarity index 100% rename from chatlab/builtins/python.py rename to chatlab/tools/python.py diff --git a/chatlab/builtins/shell.py b/chatlab/tools/shell.py similarity index 100% rename from chatlab/builtins/shell.py rename to chatlab/tools/shell.py diff --git a/notebooks/basics.ipynb b/notebooks/basics.ipynb index ab662c5..a334434 100644 --- a/notebooks/basics.ipynb +++ b/notebooks/basics.ipynb @@ -639,7 +639,7 @@ ], "metadata": { "kernelspec": { - "display_name": "chatlab-0EWIBOuo-py3.11", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, diff --git a/notebooks/color-picker.ipynb b/notebooks/color-picker.ipynb index 83889ee..7c57a71 100644 --- a/notebooks/color-picker.ipynb +++ b/notebooks/color-picker.ipynb @@ -4,10 +4,19 @@ "cell_type": "code", "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/kylekelley/.pyenv/versions/3.11.7/lib/python3.11/site-packages/pydantic/main.py:1455: RuntimeWarning: fields may not start with an underscore, ignoring \"__required__\"\n", + " warnings.warn(f'fields may not start with an underscore, ignoring \"{f_name}\"', RuntimeWarning)\n" + ] + } + ], "source": [ "from chatlab import Chat, models, system\n", - "from chatlab.builtins.colors import show_colors\n", + "from chatlab.tools.colors import show_colors\n", "\n", "chat = Chat(\n", " system(\"Format responses in markdown,. You are a skilled designer.\"),\n", @@ -68,7 +77,7 @@ ] }, "metadata": { - "role": "assistant" + "role": "assistant" }, "output_type": "display_data" } @@ -146,7 +155,7 @@ ], "metadata": { "kernelspec": { - "display_name": "chatlab-3kMKfU-i-py3.11", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, diff --git a/notebooks/streaming-updates.ipynb b/notebooks/streaming-updates.ipynb index 8ec730e..a53a458 100644 --- a/notebooks/streaming-updates.ipynb +++ b/notebooks/streaming-updates.ipynb @@ -2,9 +2,17 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 4, "metadata": {}, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/kylekelley/Library/Caches/pypoetry/virtualenvs/chatlab-0EWIBOuo-py3.11/lib/python3.11/site-packages/pydantic/main.py:1455: RuntimeWarning: fields may not start with an underscore, ignoring \"__required__\"\n", + " warnings.warn(f'fields may not start with an underscore, ignoring \"{f_name}\"', RuntimeWarning)\n" + ] + }, { "data": { "application/vdom.v1+json": { @@ -76,7 +84,7 @@ } }, "children": [ - "25" + "19" ], "tagName": "span" } @@ -104,7 +112,7 @@ } }, "children": [ - "Sole Survivor" + "Protagonist" ], "tagName": "span" } @@ -132,7 +140,7 @@ } }, "children": [ - "Vault-Tec Corporation" + "Vault 13" ], "tagName": "span" } @@ -162,7 +170,7 @@ } }, "children": [ - "Lone Wanderer" + "Dogmeat" ], "tagName": "h1" }, @@ -187,7 +195,7 @@ } }, "children": [ - "21" + "5" ], "tagName": "span" } @@ -215,7 +223,7 @@ } }, "children": [ - "Wasteland Wanderer" + "Companion" ], "tagName": "span" } @@ -243,7 +251,7 @@ } }, "children": [ - "Brotherhood of Steel" + "Lone Wanderer" ], "tagName": "span" } @@ -273,7 +281,7 @@ } }, "children": [ - "Courier" + "Preston Garvey" ], "tagName": "h1" }, @@ -298,7 +306,7 @@ } }, "children": [ - "30" + "26" ], "tagName": "span" } @@ -326,7 +334,7 @@ } }, "children": [ - "Delivery Person" + "Companion" ], "tagName": "span" } @@ -354,7 +362,7 @@ } }, "children": [ - "New California Republic" + "Minutemen" ], "tagName": "span" } @@ -384,7 +392,7 @@ } }, "children": [ - "Sole Survivor" + "Nick Valentine" ], "tagName": "h1" }, @@ -409,7 +417,7 @@ } }, "children": [ - "35" + "100" ], "tagName": "span" } @@ -437,7 +445,7 @@ } }, "children": [ - "Survivor" + "Companion" ], "tagName": "span" } @@ -465,7 +473,7 @@ } }, "children": [ - "Minutemen" + "Detective Agency" ], "tagName": "span" } @@ -495,7 +503,7 @@ } }, "children": [ - "Chosen One" + "Piper Wright" ], "tagName": "h1" }, @@ -520,7 +528,7 @@ } }, "children": [ - "28" + "23" ], "tagName": "span" } @@ -548,7 +556,7 @@ } }, "children": [ - "Savior of Arroyo" + "Companion" ], "tagName": "span" } @@ -576,7 +584,7 @@ } }, "children": [ - "Arroyo Tribe" + "Publick Occurrences" ], "tagName": "span" } @@ -606,7 +614,7 @@ } }, "children": [ - "Sole Survivor" + "Cait" ], "tagName": "h1" }, @@ -631,7 +639,7 @@ } }, "children": [ - "40" + "26" ], "tagName": "span" } @@ -659,7 +667,7 @@ } }, "children": [ - "Parent searching for their child" + "Companion" ], "tagName": "span" } @@ -687,7 +695,7 @@ } }, "children": [ - "Railroad" + "Combat Zone" ], "tagName": "span" } @@ -717,7 +725,7 @@ } }, "children": [ - "Sole Survivor" + "Codsworth" ], "tagName": "h1" }, @@ -742,7 +750,7 @@ } }, "children": [ - "32" + "200" ], "tagName": "span" } @@ -770,7 +778,7 @@ } }, "children": [ - "Mercenary" + "Companion" ], "tagName": "span" } @@ -798,7 +806,7 @@ } }, "children": [ - "The Institute" + "Sole Survivor" ], "tagName": "span" } @@ -828,7 +836,7 @@ } }, "children": [ - "Sole Survivor" + "Deacon" ], "tagName": "h1" }, @@ -853,7 +861,7 @@ } }, "children": [ - "27" + "35" ], "tagName": "span" } @@ -881,7 +889,7 @@ } }, "children": [ - "Explorer" + "Companion" ], "tagName": "span" } @@ -909,7 +917,7 @@ } }, "children": [ - "The Railroad" + "Railroad" ], "tagName": "span" } @@ -939,7 +947,7 @@ } }, "children": [ - "Sole Survivor" + "John Hancock" ], "tagName": "h1" }, @@ -964,7 +972,7 @@ } }, "children": [ - "33" + "250" ], "tagName": "span" } @@ -992,7 +1000,7 @@ } }, "children": [ - "Settler" + "Companion" ], "tagName": "span" } @@ -1020,7 +1028,7 @@ } }, "children": [ - "Commonwealth Minutemen" + "Goodneighbor" ], "tagName": "span" } @@ -1050,7 +1058,7 @@ } }, "children": [ - "Sole Survivor" + "Robert MacCready" ], "tagName": "h1" }, @@ -1075,7 +1083,7 @@ } }, "children": [ - "29" + "22" ], "tagName": "span" } @@ -1103,7 +1111,7 @@ } }, "children": [ - "Scavenger" + "Companion" ], "tagName": "span" } @@ -1131,7 +1139,7 @@ } }, "children": [ - "The Enclave" + "Gunners" ], "tagName": "span" } @@ -1161,7 +1169,7 @@ } }, "children": [ - "Sole Survivor" + "Paladin Danse" ], "tagName": "h1" }, @@ -1186,7 +1194,7 @@ } }, "children": [ - "31" + "35" ], "tagName": "span" } @@ -1214,7 +1222,7 @@ } }, "children": [ - "Trader" + "Companion" ], "tagName": "span" } @@ -1242,7 +1250,7 @@ } }, "children": [ - "The Pitt Raiders" + "Brotherhood of Steel" ], "tagName": "span" } @@ -1272,7 +1280,7 @@ } }, "children": [ - "Sole Survivor" + "Strong" ], "tagName": "h1" }, @@ -1297,7 +1305,7 @@ } }, "children": [ - "26" + "10" ], "tagName": "span" } @@ -1325,7 +1333,7 @@ } }, "children": [ - "Gunslinger" + "Companion" ], "tagName": "span" } @@ -1353,7 +1361,7 @@ } }, "children": [ - "The Kings" + "Super Mutants" ], "tagName": "span" } @@ -1370,10 +1378,10 @@ "tagName": "div" }, "text/html": [ - "
Age: 25
Role: Sole Survivor
Affiliation: Vault-Tec Corporation
Age: 21
Role: Wasteland Wanderer
Affiliation: Brotherhood of Steel
Age: 30
Role: Delivery Person
Affiliation: New California Republic
Age: 35
Role: Survivor
Affiliation: Minutemen
Age: 28
Role: Savior of Arroyo
Affiliation: Arroyo Tribe
Age: 40
Role: Parent searching for their child
Affiliation: Railroad
Age: 32
Role: Mercenary
Affiliation: The Institute
Age: 27
Role: Explorer
Affiliation: The Railroad
Age: 33
Role: Settler
Affiliation: Commonwealth Minutemen
Age: 29
Role: Scavenger
Affiliation: The Enclave
Age: 31
Role: Trader
Affiliation: The Pitt Raiders
Age: 26
Role: Gunslinger
Affiliation: The Kings
Age: 19
Role: Protagonist
Affiliation: Vault 13
Age: 5
Role: Companion
Affiliation: Lone Wanderer
Age: 26
Role: Companion
Affiliation: Minutemen
Age: 100
Role: Companion
Affiliation: Detective Agency
Age: 23
Role: Companion
Affiliation: Publick Occurrences
Age: 26
Role: Companion
Affiliation: Combat Zone
Age: 200
Role: Companion
Affiliation: Sole Survivor
Age: 35
Role: Companion
Affiliation: Railroad
Age: 250
Role: Companion
Affiliation: Goodneighbor
Age: 22
Role: Companion
Affiliation: Gunners
Age: 35
Role: Companion
Affiliation: Brotherhood of Steel
Age: 10
Role: Companion
Affiliation: Super Mutants
Age: 25
Role: Sole Survivor
Affiliation: Vault-Tec Corporation
Age: 21
Role: Wasteland Wanderer
Affiliation: Brotherhood of Steel
Age: 30
Role: Delivery Person
Affiliation: New California Republic
Age: 35
Role: Survivor
Affiliation: Minutemen
Age: 28
Role: Savior of Arroyo
Affiliation: Arroyo Tribe
Age: 40
Role: Parent searching for their child
Affiliation: Railroad
Age: 32
Role: Mercenary
Affiliation: The Institute
Age: 27
Role: Explorer
Affiliation: The Railroad
Age: 33
Role: Settler
Affiliation: Commonwealth Minutemen
Age: 29
Role: Scavenger
Affiliation: The Enclave
Age: 31
Role: Trader
Affiliation: The Pitt Raiders
Age: 26
Role: Gunslinger
Affiliation: The Kings
Age: 19
Role: Protagonist
Affiliation: Vault 13
Age: 5
Role: Companion
Affiliation: Lone Wanderer
Age: 26
Role: Companion
Affiliation: Minutemen
Age: 100
Role: Companion
Affiliation: Detective Agency
Age: 23
Role: Companion
Affiliation: Publick Occurrences
Age: 26
Role: Companion
Affiliation: Combat Zone
Age: 200
Role: Companion
Affiliation: Sole Survivor
Age: 35
Role: Companion
Affiliation: Railroad
Age: 250
Role: Companion
Affiliation: Goodneighbor
Age: 22
Role: Companion
Affiliation: Gunners
Age: 35
Role: Companion
Affiliation: Brotherhood of Steel
Age: 10
Role: Companion
Affiliation: Super Mutants