Skip to content

Commit

Permalink
example of notebooks working
Browse files Browse the repository at this point in the history
  • Loading branch information
MadcowD committed Nov 21, 2024
1 parent 56af99a commit 36ca5ee
Showing 1 changed file with 130 additions and 0 deletions.
130 changes: 130 additions & 0 deletions examples/notebook.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import ell\n",
"ell.init(verbose=True, store='./logdir')"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"╔══════════════════════════════════════════════════════════════════════════════╗\n",
"║ hello_world(world)\n",
"╠══════════════════════════════════════════════════════════════════════════════╣\n",
"║ Prompt:\n",
"╟──────────────────────────────────────────────────────────────────────────────╢\n",
"│ user: Say hello, world!\n",
"╟──────────────────────────────────────────────────────────────────────────────╢\n",
"║ Output:\n",
"╟──────────────────────────────────────────────────────────────────────────────╢\n",
"│ assistant: Hello, world! 🌍\n",
"╚══════════════════════════════════════════════════════════════════════════════╝\n"
]
},
{
"data": {
"text/plain": [
"'Hello, world! 🌍'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@ell.simple(model=\"gpt-4o-mini\")\n",
"def hello_world(input_text: str):\n",
" return f\"Say hello, {input_text}!\"\n",
"\n",
"hello_world(\"world\")"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"╔══════════════════════════════════════════════════════════════════════════════╗\n",
"║ hello_world(world)\n",
"╠══════════════════════════════════════════════════════════════════════════════╣\n",
"║ Prompt:\n",
"╟──────────────────────────────────────────────────────────────────────────────╢\n",
"│ user: Say hello, world!\n",
"╟──────────────────────────────────────────────────────────────────────────────╢\n",
"║ Output:\n",
"╟──────────────────────────────────────────────────────────────────────────────╢\n",
"│ assistant: Hello, world! 😊 How can I assist you today?\n",
"╚══════════════════════════════════════════════════════════════════════════════╝\n",
"╔══════════════════════════════════════════════════════════════════════════════╗\n",
"║ my_other_lmp(world)\n",
"╠══════════════════════════════════════════════════════════════════════════════╣\n",
"║ Prompt:\n",
"╟──────────────────────────────────────────────────────────────────────────────╢\n",
"│ user: Summarize Hello, world! 😊 How can I assist you today?\n",
"╟──────────────────────────────────────────────────────────────────────────────╢\n",
"║ Output:\n",
"╟──────────────────────────────────────────────────────────────────────────────╢\n",
"│ assistant: \"Hello, world! 😊 How can I assist you today?\" is a\n",
"│ friendly greeting that expresses openness and willingness to\n",
"│ help.\n",
"╚══════════════════════════════════════════════════════════════════════════════╝\n"
]
},
{
"data": {
"text/plain": [
"'\"Hello, world! 😊 How can I assist you today?\" is a friendly greeting that expresses openness and willingness to help.'"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@ell.simple(model=\"gpt-4o-mini\")\n",
"def sentiment(input_text: str):\n",
" return f\"assess the sentiment {hello_world(input_text)}\"\n",
"\n",
"my_other_lmp(\"world\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "ell-ai-lj28Ksf3-py3.12",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit 36ca5ee

Please sign in to comment.