This Jupyter Notebook showcases the integration of the Code Interpreter tool which executes Python code dynamically within applications.
The latest released Assistants API by OpenAI allows users to build AI
assistants within their own applications. The Assistants API currently
supports three types of tools: Code Interpreter, Retrieval, and Function
calling. In this notebook, we demonstrate how to enable
GPTAssistantAgent
to use code interpreter.
AG2 requires Python>=3.9
. To run this notebook example, please
install:
The
config_list_from_json
function loads a list of configurations from an environment variable or
a json file.
Learn more about configuring LLMs for agents here.
We demonstrate task solving using GPTAssistantAgent
with code
interpreter. Pass code_interpreter
in tools
parameter to enable
GPTAssistantAgent
with code interpreter. It will write code and
automatically execute it in a sandbox. The agent will receive the
results from the sandbox environment and act accordingly.
In this example, we demonstrate how to use code interpreter to solve math problems.
Code Interpreter can outputs files, such as generating image diagrams. In this example, we demonstrate how to draw figures and download it.
Now we have the file id. We can download and display it.
This Jupyter Notebook showcases the integration of the Code Interpreter tool which executes Python code dynamically within applications.
The latest released Assistants API by OpenAI allows users to build AI
assistants within their own applications. The Assistants API currently
supports three types of tools: Code Interpreter, Retrieval, and Function
calling. In this notebook, we demonstrate how to enable
GPTAssistantAgent
to use code interpreter.
AG2 requires Python>=3.9
. To run this notebook example, please
install:
The
config_list_from_json
function loads a list of configurations from an environment variable or
a json file.
Learn more about configuring LLMs for agents here.
We demonstrate task solving using GPTAssistantAgent
with code
interpreter. Pass code_interpreter
in tools
parameter to enable
GPTAssistantAgent
with code interpreter. It will write code and
automatically execute it in a sandbox. The agent will receive the
results from the sandbox environment and act accordingly.
In this example, we demonstrate how to use code interpreter to solve math problems.
Code Interpreter can outputs files, such as generating image diagrams. In this example, we demonstrate how to draw figures and download it.
Now we have the file id. We can download and display it.