mirror of https://github.com/microsoft/autogen.git
Fix function call notebook to make sure title is displayed. (#2403)
* Fix function call notebook to make sure title is displayed. * Fix formatting * formatting
This commit is contained in:
parent
c4e570393d
commit
3c266c5c01
|
@ -1,20 +1,5 @@
|
||||||
{
|
{
|
||||||
"cells": [
|
"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": {},
|
"attachments": {},
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
|
@ -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",
|
"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",
|
"\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",
|
"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",
|
"\n",
|
||||||
"```bash\n",
|
"## Requirements"
|
||||||
"pip install pyautogen\n",
|
]
|
||||||
"```"
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "c528cd6d",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"! pip install pyautogen"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -51,9 +43,7 @@
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"## Set your API Endpoint\n",
|
"## Set your API Endpoint"
|
||||||
"\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."
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -73,7 +63,7 @@
|
||||||
"\n",
|
"\n",
|
||||||
"import autogen\n",
|
"import autogen\n",
|
||||||
"\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\")}]"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -224,7 +214,7 @@
|
||||||
"id": "370a9f8d-d5ce-4127-8646-cf0e4effd9f5",
|
"id": "370a9f8d-d5ce-4127-8646-cf0e4effd9f5",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"```\n",
|
"```python\n",
|
||||||
"# backend_dir/main.py\n",
|
"# backend_dir/main.py\n",
|
||||||
"\n",
|
"\n",
|
||||||
"from fastapi import FastAPI\n",
|
"from fastapi import FastAPI\n",
|
||||||
|
@ -247,9 +237,11 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"Install needed libraries. We can run our API using:\n",
|
"Install needed libraries. We can run our API using:\n",
|
||||||
"```\n",
|
"\n",
|
||||||
|
"```bash\n",
|
||||||
"uvicorn main:app --reload\n",
|
"uvicorn main:app --reload\n",
|
||||||
"```\n",
|
"```\n",
|
||||||
|
"\n",
|
||||||
"Send a request to 'localhost:8000/cdr_daily_spread' to check if it works.\n",
|
"Send a request to 'localhost:8000/cdr_daily_spread' to check if it works.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"## Edit code using agents\n",
|
"## Edit code using agents\n",
|
||||||
|
@ -292,7 +284,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stdin",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
||||||
|
@ -331,7 +323,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stdin",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
||||||
|
@ -364,7 +356,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stdin",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"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"
|
"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"
|
||||||
|
@ -395,7 +387,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stdin",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"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"
|
"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"
|
||||||
|
@ -425,7 +417,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stdin",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
||||||
|
@ -467,7 +459,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stdin",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"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"
|
"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"
|
||||||
|
@ -506,7 +498,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stdin",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
||||||
|
@ -548,7 +540,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stdin",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"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"
|
"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"
|
||||||
|
@ -584,7 +576,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stdin",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
||||||
|
@ -626,7 +618,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stdin",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
||||||
|
@ -659,7 +651,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stdin",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"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"
|
"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"
|
||||||
|
@ -688,7 +680,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stdin",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
||||||
|
@ -730,7 +722,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stdin",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
||||||
|
@ -763,7 +755,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stdin",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"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"
|
"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"
|
||||||
|
@ -795,7 +787,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stdin",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"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"
|
"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"
|
||||||
|
@ -824,7 +816,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stdin",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
||||||
|
@ -866,7 +858,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stdin",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n"
|
||||||
|
@ -899,7 +891,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stdin",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: exit\n"
|
"Provide feedback to chat_manager. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: exit\n"
|
||||||
|
@ -930,7 +922,7 @@
|
||||||
"id": "0dec75d5-035d-4cd6-956e-cafb37f304e7",
|
"id": "0dec75d5-035d-4cd6-956e-cafb37f304e7",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"```\n",
|
"```python\n",
|
||||||
"# backend_dir/main.py\n",
|
"# backend_dir/main.py\n",
|
||||||
"\n",
|
"\n",
|
||||||
"from fastapi import FastAPI\n",
|
"from fastapi import FastAPI\n",
|
||||||
|
@ -977,10 +969,12 @@
|
||||||
"id": "3d52418e-9a67-4ea2-984e-5a14bdd78255",
|
"id": "3d52418e-9a67-4ea2-984e-5a14bdd78255",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
|
"```json\n",
|
||||||
"{\n",
|
"{\n",
|
||||||
" \"message\": \"11bits Studio has a larger daily spread\",\n",
|
" \"message\": \"11bits Studio has a larger daily spread\",\n",
|
||||||
" \"difference\": 1.7968083865943187\n",
|
" \"difference\": 1.7968083865943187\n",
|
||||||
"}"
|
"}\n",
|
||||||
|
"```"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -989,7 +983,9 @@
|
||||||
"description": "Equip your agent with functions that can efficiently implement features into your software application.",
|
"description": "Equip your agent with functions that can efficiently implement features into your software application.",
|
||||||
"tags": [
|
"tags": [
|
||||||
"function call",
|
"function call",
|
||||||
"code generation"
|
"code generation",
|
||||||
|
"tool use",
|
||||||
|
"software engineering"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
|
|
Loading…
Reference in New Issue