Function Editor
Sometimes it's necessary to translate (i.e. map) data in ways that defy a good visual programming experience. Examples include:
- Building a specialized prompt payload from the current context
- Performing a custom mapping from an LLM completion to a series actions
- Building an API request payload from the current context
- Translating an API response into a series of actions
Functions allow you to incorporate these types of translations into your assistant's flow and are maintained in the Function Editor. Functions are easily bootstrapped with the correct signatures from the Flow Editor and you can jump to a function's definition from anywhere that it's referenced in the flow:
Functions in AI Studio are technically 'pure' functions - meaning they are pure transformations of their inputs to an output without any reliance on external state (e.g. network calls). However, because Functions operate on the context and the context is always up-to-date with any state changes, search results, or API results accumulated earlier in the flow, Functions can easily consider external data in their mappings.
Function Runtimes
- Python | Runtime Reference
You can find a list of example functions here.
Updated 8 months ago