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

Fix function call notebook to make sure title is displayed. #2403

Merged
merged 3 commits into from
Apr 17, 2024
Merged
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
88 changes: 42 additions & 46 deletions notebook/agentchat_function_call_code_writing.ipynb
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "ae1f50ec",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"<a href=\"https://colab.research.google.com/github/microsoft/autogen/blob/main/notebook/agentchat_function_call_currency_calculator.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand All @@ -32,11 +17,18 @@
"The default way of creating code in Autogen is its built-in code extractor. Although it allows for creating and executing simple scripts fast, that way of creating code is not suitable for developing advanced software applications, according to my experiences. The process of developing an application is mostly the process of introducing changes into existing files rather than creating new files with code. And in my experience, the code extractor is bad at introducing changes as the model often gets lost and can damage existing files.\n",
"\n",
"Properly created functions that can modify code provide us with the ability to have more control over code changes and result in better quality. Additionally, as the scope of possible operations is predefined inside the tools, we can safely use Autogen without Docker, avoiding all the complications related to it.\n",
"## Requirements\n",
"\n",
"```bash\n",
"pip install pyautogen\n",
"```"
"## Requirements"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c528cd6d",
"metadata": {},
"outputs": [],
"source": [
"! pip install pyautogen"
]
},
{
Expand All @@ -51,9 +43,7 @@
"tags": []
},
"source": [
"## Set your API Endpoint\n",
"\n",
"The [`config_list_from_json`](https://microsoft.github.io/autogen/docs/reference/oai/openai_utils#config_list_from_json) function loads a list of configurations from an environment variable or a json file."
"## Set your API Endpoint"
]
},
{
Expand All @@ -73,7 +63,7 @@
"\n",
"import autogen\n",
"\n",
"config_list = [{\"model\": \"gpt-4-turbo-preview\", \"api_key\": os.getenv(\"OPENAI_API_KEY\")}, ...]"
"config_list = [{\"model\": \"gpt-4-turbo-preview\", \"api_key\": os.getenv(\"OPENAI_API_KEY\")}]"
]
},
{
Expand Down Expand Up @@ -224,7 +214,7 @@
"id": "370a9f8d-d5ce-4127-8646-cf0e4effd9f5",
"metadata": {},
"source": [
"```\n",
"```python\n",
"# backend_dir/main.py\n",
"\n",
"from fastapi import FastAPI\n",
Expand All @@ -247,9 +237,11 @@
"metadata": {},
"source": [
"Install needed libraries. We can run our API using:\n",
"```\n",
"\n",
"```bash\n",
"uvicorn main:app --reload\n",
"```\n",
"\n",
"Send a request to 'localhost:8000/cdr_daily_spread' to check if it works.\n",
"\n",
"## Edit code using agents\n",
Expand Down Expand Up @@ -292,7 +284,7 @@
]
},
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
Expand Down Expand Up @@ -331,7 +323,7 @@
]
},
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
Expand Down Expand Up @@ -364,7 +356,7 @@
]
},
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: Let's move spread calculation logic to separate file. Create spread_calculation function with ticker argument in it. in our endpoint, we need to compare daily spread for CD Project Red and 11bits Studio - return difference between them. Start with providing plan of changes. Don't do any changes yet.\n"
Expand Down Expand Up @@ -395,7 +387,7 @@
]
},
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: go with the plan\n"
Expand Down Expand Up @@ -425,7 +417,7 @@
]
},
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
Expand Down Expand Up @@ -467,7 +459,7 @@
]
},
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: Do not change whole the file. concentrate on the concrete lines.\n"
Expand Down Expand Up @@ -506,7 +498,7 @@
]
},
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
Expand Down Expand Up @@ -548,7 +540,7 @@
]
},
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: Check out file first to get actual lines position. Also, change endpoint name.\n"
Expand Down Expand Up @@ -584,7 +576,7 @@
]
},
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
Expand Down Expand Up @@ -626,7 +618,7 @@
]
},
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
Expand Down Expand Up @@ -659,7 +651,7 @@
]
},
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: Good. But add in return some addition description to be understandable which stock change is bigger. Remember to check out main.py first to actualize your knowledge.\n"
Expand Down Expand Up @@ -688,7 +680,7 @@
]
},
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
Expand Down Expand Up @@ -730,7 +722,7 @@
]
},
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
Expand Down Expand Up @@ -763,7 +755,7 @@
]
},
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: ValueError: The truth value of a Series is ambiguous.\n"
Expand Down Expand Up @@ -795,7 +787,7 @@
]
},
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: Cool. Remember to check out file before introducing modifications.\n"
Expand Down Expand Up @@ -824,7 +816,7 @@
]
},
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
Expand Down Expand Up @@ -866,7 +858,7 @@
]
},
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
Expand Down Expand Up @@ -899,7 +891,7 @@
]
},
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: exit\n"
Expand Down Expand Up @@ -930,7 +922,7 @@
"id": "0dec75d5-035d-4cd6-956e-cafb37f304e7",
"metadata": {},
"source": [
"```\n",
"```python\n",
"# backend_dir/main.py\n",
"\n",
"from fastapi import FastAPI\n",
Expand Down Expand Up @@ -977,10 +969,12 @@
"id": "3d52418e-9a67-4ea2-984e-5a14bdd78255",
"metadata": {},
"source": [
"```json\n",
"{\n",
" \"message\": \"11bits Studio has a larger daily spread\",\n",
" \"difference\": 1.7968083865943187\n",
"}"
"}\n",
"```"
]
}
],
Expand All @@ -989,7 +983,9 @@
"description": "Equip your agent with functions that can efficiently implement features into your software application.",
"tags": [
"function call",
"code generation"
"code generation",
"tool use",
"software engineering"
]
},
"kernelspec": {
Expand Down
Loading