HumanFirst icon

HumanFirst

Call HumanFirst playbook API

Overview

This node integrates with the HumanFirst platform to manage prompts within playbooks. Specifically, the Create Prompt operation allows users to create a new prompt in a specified playbook under a given namespace. This is useful for automating the management of conversational AI prompts, enabling dynamic updates or additions to your playbook content without manual intervention.

Typical use cases include:

  • Automatically adding new prompts during a CI/CD pipeline for conversational AI.
  • Creating customized prompts based on external data or user input.
  • Managing prompt versions programmatically in large-scale conversational systems.

For example, you might use this node to add a new question prompt to a customer support playbook whenever a new product feature is released.

Properties

Name Meaning
Namespace The namespace under which the playbook exists. This groups related playbooks and resources. Required.
Playbook ID Identifier of the playbook where the prompt will be created. Required.
Name The name of the prompt. Defaults to "Prompt". If left as default, the node appends a timestamp to ensure uniqueness.
Contents The textual content of the prompt. Required.
Temperature Controls randomness in text generation (NLG). Numeric value, typically between 0 and 1. Default is 1.
Top-P Controls nucleus sampling probability in NLG. Numeric value, typically between 0 and 1. Default is 1.
Max Tokens Maximum number of tokens to generate in response. Numeric value. Default is 0 (no limit).
Stop Sequences (JSON Array) JSON array of strings that indicate where the generation should stop, e.g., ["\n","END"].
Frequency Penalty Penalizes new tokens based on their existing frequency in the text so far. Numeric value. Default is 0.
Presence Penalty Penalizes new tokens based on whether they appear in the text so far. Numeric value. Default is 0.
Post-Processing Defines how the output should be post-processed. Options: Default, None, Newlines, Conversations, Key-Value, Delimiter. Default is None.
Delimiter (if Post-Processing = Delimiter) String delimiter used if post-processing is set to "Delimiter".
Run Mode Determines execution mode: Run Once (entire stash) or Run on Each Item (default). Default is Run on Each Item.
Parent Prompt ID Optional ID of a parent prompt to establish hierarchy.
Position Numeric position index of the prompt within the playbook. Default is 0.
Metadata (JSON) Arbitrary metadata as a JSON object associated with the prompt.
Source (JSON) JSON object describing the source information for the prompt.
Parameters (JSON Array) JSON array of parameters relevant to the prompt.
NLG Timeout (ISO Duration) Optional timeout duration for natural language generation operations, expressed in ISO 8601 duration format.

Output

The node outputs a JSON object representing the newly created prompt as returned by the HumanFirst API. This includes all details of the prompt such as its ID, contents, model parameters, metadata, and other properties.

The output structure is:

{
  "json": {
    // Full prompt object as returned by the API, including:
    "id": "string",
    "name": "string",
    "contents": "string",
    "nlg_model_parameters": {
      "temperature": number,
      "top_p": number,
      "max_tokens": number,
      "stop_sequences": [ "string" ],
      "frequency_penalty": number,
      "presence_penalty": number
    },
    "post_processing": number,
    "run_mode": number,
    "parent_id": "string",
    "position": number,
    "metadata": { /* arbitrary JSON */ },
    "source": { /* arbitrary JSON */ },
    "post_processing_delimiter": "string",
    "parameters": [ /* array of parameter objects */ ],
    "nlg_timeout": "string"
    // ... other fields as provided by the API
  }
}

No binary data is output by this operation.

Dependencies

  • Requires an API key credential for the HumanFirst platform to authenticate requests.
  • The node makes HTTP POST requests to the HumanFirst API endpoint for creating prompts.
  • Proper configuration of the namespace and playbook ID is necessary.
  • The node expects valid JSON strings for certain properties (e.g., stop sequences, metadata, source, parameters).

Troubleshooting

  • Invalid JSON Errors: If JSON fields like stop_sequences, metadata, source, or parameters are not valid JSON strings, the node throws an error indicating invalid JSON. Ensure these inputs are correctly formatted JSON.
  • Missing Required Fields: Namespace, Playbook ID, and Contents are required. Omitting them will cause errors.
  • API Authentication Errors: If the API key is missing or invalid, the request will fail. Verify the API key credential is configured correctly.
  • Name Conflicts: If the prompt name is left as the default "Prompt", the node appends a timestamp to avoid conflicts. However, providing unique names is recommended.
  • Post-Processing Delimiter: If post-processing is set to "Delimiter" but no delimiter string is provided, the prompt creation may fail or behave unexpectedly. Provide a valid delimiter string in this case.

Links and References

Discussion