Skip to main content

Overview

The update() and aupdate() methods allow you to modify an existing prompt’s name or description. Use update() for synchronous operations and aupdate() for asynchronous operations.

Usage example

Parameters

Core Parameters

string
The unique identifier of the prompt to update (passed as first positional argument).
dict
Dictionary containing the fields to update (passed as second positional argument).Supported Fields:
  • name (string, optional): New name for the prompt
  • description (string, optional): New description for the prompt

Returns

Returns a prompt object with the following attributes:
  • id (string): The prompt’s unique identifier
  • name (string): The prompt’s name
  • description (string): The prompt’s description
  • content (string): The prompt’s content
  • variables (list): List of variables in the prompt
  • metadata (dict): Additional metadata
  • created_at (string): Creation timestamp
  • updated_at (string): Last update timestamp

Examples

Basic Synchronous Example

Asynchronous Example

Update Name Only

Update Description Only

Error Handling

Convenience Functions

You can also use the convenience function to create a PromptAPI client: