OpenAI Analytics icon

OpenAI Analytics

Use OpenAI Analytics API

Overview

The "Create Assistant" operation in this node allows users to create a new AI assistant using the OpenAI Analytics API or the standard OpenAI API. This assistant can be customized with a name, description, system instructions, and a choice of AI model. Additional capabilities such as code interpretation, file retrieval, function calling, and file attachments can also be enabled. Advanced generation parameters like temperature and top-p can be adjusted for fine-tuning the assistant's response behavior.

This node is beneficial when you want to programmatically set up AI assistants tailored to specific tasks or workflows within n8n, such as customer support bots, content generation helpers, or data analysis assistants. For example, you could create an assistant that uses GPT-4o with custom system instructions and attached files to provide specialized knowledge responses.

Properties

Name Meaning
Authentication Choose between using dedicated OpenAI Analytics API credentials or existing OpenAI API credentials.
Assistant Name The name of the assistant to create (required).
Description Optional description providing details about the assistant.
System Instructions Optional system-level instructions that guide the assistant's behavior.
Model The AI model used by the assistant, loaded dynamically from available completion models (e.g., GPT-4o, GPT-3.5 Turbo) (required).
Tools Notice field indicating tools the assistant can use (informational only).
Use Code Interpreter Boolean flag to enable code interpreter functionality.
Use Retrieval (File Search) Boolean flag to enable file retrieval capability for searching files.
Use Function Calling Boolean flag to enable function calling capability.
Function Definitions JSON array defining functions the assistant can call; shown only if function calling is enabled.
Response Format Format for the assistant's response: Auto (default), Text, or JSON Object.
Advanced Settings Boolean flag to enable advanced generation parameters.
Temperature Controls randomness of responses (0 = deterministic, 2 = very random); shown only if advanced settings are enabled.
Top P Controls diversity via nucleus sampling (0 to 1); shown only if advanced settings are enabled.
Metadata JSON metadata associated with the assistant; shown only if advanced settings are enabled.
Use File Attachments Boolean flag to attach files to the assistant.
File IDs List of file IDs to attach to the assistant; shown only if file attachments are enabled.

Output

The node outputs a JSON object representing the created assistant. The exact structure depends on the API response but typically includes fields such as the assistant's ID, name, description, model, and configuration details.

If any error occurs during creation, the output will contain an error message in the json.error field.

No binary data output is indicated for this operation.

Dependencies

  • Requires valid API credentials for either the OpenAI Analytics API or the standard OpenAI API.
  • The node dynamically loads available AI models from the OpenAI API.
  • If file attachments are used, the node requires access to files previously uploaded to OpenAI.
  • No additional environment variables beyond API credentials are explicitly required.

Troubleshooting

  • Credential Errors: If the node cannot load credentials, it logs errors and returns an empty list for model or file options. Ensure that the API key credential is correctly configured and has necessary permissions.
  • Unsupported Resource Error: If the resource parameter is not set to "assistant" or another supported value, the node throws an error.
  • Invalid Function Definitions: When enabling function calling, ensure the JSON array of function definitions is well-formed; otherwise, the assistant creation may fail.
  • File Attachment Issues: If file IDs specified do not exist or lack proper permissions, the assistant creation might fail or files won't be attached.
  • Model Availability: If the selected model is not available or deprecated, the node falls back to default models. Verify model availability in your OpenAI account.

Links and References

Discussion