-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |