Skip to main content
POST
Generate Custom Function
AI-generate a custom function from a natural language description. Provide a description of what the function should do, and optionally provide existing code to improve or a cURL command to convert into a function.

Request Body

query
string
Natural language description of what the function should do (e.g., “fetch stock prices from Yahoo Finance”)
user_function
string
Existing Python code to improve or refactor
import_curl
string
A cURL command to convert into a custom function

Response

custom_function
string
The generated Python source code ready to use with Create Custom Function

Example Request

Notes

  • The generated code includes a xpander_run_action(...) entry point
  • Review the generated code before creating the function
  • You can provide user_function to improve existing code, or import_curl to convert a cURL command

Authorizations

x-api-key
string
header
required

API Key for authentication

Body

application/json

Request model for AI-generating a custom function from a description.

Provide a natural language description of what you need, and the AI will generate the Python source code with proper xpander_run_action signature.

query
string | null
default:""

Natural language description of what the function should do. Examples: 'Calculate compound interest given principal, rate, and years', 'Parse a CSV string and return the headers and first 5 rows'.

user_function
string | null
default:""

Optional existing source code to improve or modify. The AI will use this as a starting point.

import_curl
string | null
default:""

Optional cURL command to convert into a custom function. The AI will parse the cURL and generate a function that makes the equivalent HTTP request.

Response

Successful Response

Response from the AI custom function generator.

custom_function
string
required

Generated Python source code defining xpander_run_action(...).