Skip to content

AIChat Node ​

The AIChat node enables interaction with a configured AI service (e.g., OpenAI) using a custom user prompt and optional context window. It returns the result of the AI response and stores it in a named output variable.

This node is useful when dynamic, intelligent responses or code generation are required based on contextual data and user input within your workflow.


🧠 Functionality ​

This node sends a request to the AI service using:

  • A prompt (User Input)
  • A context block (Context Window)
  • A flag to return only structured code if required (Request Code Only)

It returns the AI response and optionally parses it as JSON.


πŸ› οΈ Inputs ​

LabelTypeRequiredDescription
User Inputtextβœ…The main instruction or question for the AI (e.g., β€œGenerate a C# class for a user object”).
Context Windowtextβœ…A block of context to give the AI additional information before the prompt (e.g., system state, variables).
Request Code Onlycheckbox (boolean)βœ…If true, AI is prompted to return only code. Useful for generation tasks.
ServiceAccount-OpenAIserviceAccountβœ…References the ID of the configured OpenAI service account (used for authentication).
Save to Variable Nametextβœ…The name of the output variable to store the AI response in. The response will be parsed to JSON if Request Code Only is checked.

βœ… Output ​

The AI's response is saved to the variable name defined in Save to Variable Name. If the response is JSON-compatible and Request Code Only is enabled, the response will be deserialized.


πŸ’‘ Example Use Case ​

You could use the AIChat node to:

  • Generate code snippets dynamically
  • Provide explanations or summaries of technical content
  • Return formatted JSON objects based on prompts

For example:

  • User Input: Generate a class called Employee with Name, ID, and Department fields.
  • Context Window: The project is written in C# and uses PascalCase naming.
  • Request Code Only: true
  • Save to Variable Name: generatedCode

The variable generatedCode will contain the C# class definition returned by the AI.


πŸ›‘ Error Handling ​

If the AI request fails or the service account is misconfigured:

  • taskSuccess = false
  • statusReturn = "Fail"
  • taskMessage will include the failure message

βš™οΈ Execution Notes ​

  • Adds current DateTime and user's country code to the context block automatically.
  • Uses AISingleRequest() from the internal AIService class.
  • Attempts to deserialize the AI output into an object if Request Code Only is checked.

🚧 Limitations / Manual Review ​

  • Ensure that the ServiceAccount-OpenAI is correctly configured in your environment.
  • ⚠️ Manual Confirmation Required: Whether other AI services besides OpenAI are supported.
  • If AI returns invalid JSON, deserialization will fall back to storing as a raw string.

Tentech 2024