X.AI Integration

http://x.AI Integration

The http://x.AI integration empowers your UChat chatbot with dynamic AI capabilities, enabling personalized, context-aware responses and advanced automation. 

 

This documentation will guide you through setting up your http://x.AI API key, configuring the integration, and building tailored chatbot flows to meet your business needs. 

Step 1: Create Your http://x.AI API Key

To start using the http://x.AI integration, you first need to create an API key. In your browser navigate to the http://x.AI platform and within your account you can follow the instructions in the image below to generate your unique API key.

Step 2: Copy Your API Key and Wait for Provisioning

Once you’ve generated the API key, copy it and wait until the provisioning process is completed. This may take a few moments. Ensure that the status indicates the key is ready to use before proceeding.

Step 3: Configure the API Key in UChat

  1. Go to the Integrations section in your UChat dashboard.

  2. Navigate to http://x.AI and paste the copied API key into the designated field.

  3. Click Save and confirm that the status changes to “Verified.”

Once verified, you’re all set to start using http://x.AI in your chatbot flows.

Using http://x.AI in Your Flows

To incorporate http://x.AI in your chatbot workflows:

  1. Open your bot in UChat.

  2. Navigate to an Action Node in your flow.

  3. Select Integrations and choose http://x.AI .

From here, you can configure the http://x.AI integration to perform various actions, including Chat Completions.

Key Features and Configuration Options

Chat Completion

This feature allows you to interact with http://x.AI to generate dynamic responses for user interactions. Below are the configuration fields and their descriptions:

Input Parameters

 

 

System Message:
This optional field provides context about your business or bot. For example, if you're creating a restaurant chatbot you can use something similar to this:
System: You are a UChat steak restaurant helpful assistant. You will handle customer support, guide users, and book reservations. The restaurant operates from 9 am to 8 pm Monday to Saturday. No pets are allowed. Always offer the coupon code if applicable.

  • This helps the AI generate responses aligned with your business rules.

Message:
This is the main user input or prompt for which you want the AI to generate a response. For example:
User: How I can make a reservation? 

  • You can use the system field {{last_text_input}} to dynamically pass user input.

  • System JSON Field ({{XAi}}):
    This field tracks the entire conversation history, including system setup and user interactions. The JSON is limited to 20,000 characters. Older entries will be deleted once this limit is reached.

Model

Select the AI model to use. By default, the system uses grok-beta.

Max Tokens

Limits the number of tokens consumed during a task. This is useful for controlling response length and token usage.

Temperature

Controls the randomness of responses.

  • Higher values (e.g., 1.0) produce more creative answers.

  • Lower values (e.g., 0.2) result in more deterministic answers.

Presence Penalty

Encourages the AI to generate unique phrases. Higher values reduce repetition.

Frequency Penalty

Controls how much to penalize new tokens based on their frequency in the text so far.

  • Default Value: 0

  • Behavior:

    • A higher value discourages the AI from repeating lines or phrases verbatim.

    • A value of 0 allows responses to have natural repetitions.

Recommendation: Adjust this if you want less repetitive responses.

 

Stop Sequences

Defines up to 4 sequences where the AI will stop generating tokens.

Number of Completions

Specifies how many responses the AI should generate for a single prompt.

  • Default Value: 1

  • Caution: Setting a higher value will consume more tokens and API quota.

Best used when you want multiple variations of the response for comparison.

Example Usage: Generate 3 options to pick the most suitable reply for a customer query.

Testing the Configuration

  1. Make a test request.

  2. Map the assistant's response to a Custom User Field (e.g., a text field).

  3. Save your configuration.

Sample Response:

json

 

{

  "id": "3b52aa21-8cba-4499-9732-2133d4bbe1f2",

  "object": "chat.completion",

  "created": 1732584765,

  "model": "grok-beta",

  "choices": [

    {

      "index": 0,

      "message": {

        "role": "assistant",

        "content": "To make a reservation at our steak restaurant, please provide me with the following details: - Date and Time for your reservation - The number of people in your party - Your name - A contact number or email address for confirmation. Once I have this information, I can check availability and proceed with booking your reservation."

      },

      "finish_reason": "stop"

    }

  ],

  "usage": {

    "prompt_tokens": 78,

    "completion_tokens": 139,

    "total_tokens": 217

  }

}

 

 

Building a Chatbot Flow

Once the http://x.AI integration is configured, you can build advanced chatbot flows. For example:

  1. Add a Text Question Node to send the http://x.AI response and capture the user input.

  1. Use the </> symbol to search for the Custom User Field that stores the http://x.AI response.

 

This flow is an example of a simple flow that can be used as a standard response. You can use your creativity to create flows according to your use case:

 

Creative Use Cases

This integration can be tailored to your business needs. For instance:

  • Automating restaurant bookings.

  • Answering FAQs with dynamic, context-aware responses.

  • Offering personalized recommendations based on user input.

By leveraging http://x.AI ’s capabilities, you can build efficient, intuitive, and highly responsive chatbot experiences for your users.