Actions13
Overview
The node integrates with the HumanFirst platform to manage and update prompts within a playbook. Specifically, the Update Prompt operation allows users to modify an existing prompt's properties in a specified playbook namespace. This is useful for workflows that require dynamic updates to prompt configurations such as changing the prompt text, adjusting natural language generation (NLG) parameters, or modifying metadata without recreating the prompt from scratch.
Typical use cases include:
- Updating the content of a prompt to improve conversational AI responses.
- Adjusting NLG model parameters like temperature or max tokens to fine-tune output.
- Changing post-processing options or adding metadata dynamically based on workflow conditions.
Example: A chatbot development pipeline where prompts are updated automatically based on user feedback or analytics data to improve response quality.
Properties
| Name | Meaning |
|---|---|
| Namespace | The namespace under which the playbook and prompt exist. |
| Playbook ID | Identifier of the playbook containing the prompt to update. |
| Prompt ID | Identifier of the specific prompt to update. |
| Update Mask (Comma-Separated) | Comma-separated list of fields to update on the prompt object. Examples include name, contents, nlg_timeout, post_processing, run_mode, and nested fields like nlg_model_parameters.temperature. |
| Contents | The new textual content of the prompt. |
| Name | The display name of the prompt. |
| Temperature | NLG parameter controlling randomness in generated text (float). |
| Top-P | NLG parameter controlling nucleus sampling probability (float). |
| Max Tokens | Maximum number of tokens to generate in the NLG output (integer). |
| Stop Sequences (JSON Array) | JSON array of strings indicating sequences where generation should stop, e.g., ["\n","END"]. |
| Frequency Penalty | NLG parameter penalizing frequent token usage (float). |
| Presence Penalty | NLG parameter penalizing new token presence (float). |
| Post-Processing | Option for how to process the prompt output after generation. Options: Default, None, Newlines, Conversations, Key-Value, Delimiter. |
| Delimiter (if Post-Processing = Delimiter) | String delimiter used if post-processing is set to "Delimiter". |
| Run Mode | How the prompt runs: either once over entire stash or on each item individually. Options: Run Once (Entire Stash), Run on Each Item (Default). |
| Parent Prompt ID | Optional ID of a parent prompt if this prompt is part of a hierarchy. |
| Position | Numeric position/order of the prompt within a list or hierarchy. |
| Metadata (JSON) | Arbitrary JSON object containing additional metadata for the prompt. |
| Source (JSON) | JSON object describing the source information related to the prompt. |
| Parameters (JSON Array) | JSON array of parameters associated with the prompt. |
| NLG Timeout (ISO Duration) | Timeout duration for the NLG process in ISO 8601 duration format (e.g., "PT30S" for 30 seconds). |
Output
The node outputs a single JSON object representing the updated prompt as returned by the HumanFirst API. The structure includes all updated fields of the prompt, reflecting the changes made.
Output example structure (simplified):
{
"id": "promptId",
"name": "Updated Prompt Name",
"contents": "Updated prompt contents",
"nlg_model_parameters": {
"temperature": 0.7,
"top_p": 0.9,
"max_tokens": 100,
"stop_sequences": ["\n", "END"],
"frequency_penalty": 0,
"presence_penalty": 0
},
"post_processing": 1,
"run_mode": 2,
"parent_id": "parentPromptId",
"position": 1,
"metadata": { ... },
"source": { ... },
"parameters": [ ... ],
"nlg_timeout": "PT30S"
}
No binary data is output by this operation.
Dependencies
- Requires an API key credential for authenticating with the HumanFirst API.
- The node makes HTTP PUT requests to the HumanFirst API endpoint for updating prompts.
- The base URL and API version are obtained from the configured credentials.
- No other external dependencies are required.
Troubleshooting
Error: "update_mask must be a non-empty comma-separated list of field paths"
This error occurs if theUpdate Maskproperty is empty or missing. Ensure you provide a valid comma-separated list of fields to update.Invalid JSON errors for properties like
stop_sequences,metadata,source, orparameters
These fields expect valid JSON input. If invalid JSON is provided, the node throws an error specifying which property has invalid JSON. Validate your JSON syntax before running.Authentication errors
If the API key credential is missing or invalid, requests will fail. Verify that the API key is correctly configured and has necessary permissions.HTTP request failures
Network issues or incorrect namespace/playbook/prompt IDs can cause failures. Double-check all identifiers and network connectivity.
Links and References
- HumanFirst API Documentation (general reference for API endpoints and prompt management)
- n8n Expressions Documentation (for using expressions in property values)
If you need details about other operations or resources, please let me know!