Skip to content

Commit

Permalink
migrate to tools namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
rgbkrk committed Mar 4, 2024
1 parent 1e6311f commit 5df8612
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 64 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,5 @@ Untitled*.ipynb
lcov.info

ops.ipynb

.jupyter_ystore.db
10 changes: 5 additions & 5 deletions chatlab/builtins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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",
Expand Down
11 changes: 11 additions & 0 deletions chatlab/tools/__init__.py
Original file line number Diff line number Diff line change
@@ -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",
]

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion notebooks/basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "chatlab-0EWIBOuo-py3.11",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand Down
17 changes: 13 additions & 4 deletions notebooks/color-picker.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -68,7 +77,7 @@
]
},
"metadata": {
"role": "assistant"
"role": "assistant"
},
"output_type": "display_data"
}
Expand Down Expand Up @@ -146,7 +155,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "chatlab-3kMKfU-i-py3.11",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand Down
Loading

0 comments on commit 5df8612

Please sign in to comment.