Skip to main content

Code

The OpenAI tools / tool_calls schema is forwarded as-is by the gateway. The upstream Workers AI model must support function calling. @cf/zai-org/glm-4.7-flash does.
tool_use.py

Usage

1

Set up your virtual environment

2

Set your environment variables

3

Install dependencies

4

Run Agent

Save the code above as tool_use.py, then run: