OpenAI Assistant API

 

This guide explores the UChat integration with the OpenAI Assistant, allowing you to leverage the power of OpenAI directly within your chatbots. The OpenAI Assistant is a virtual assistant trained on your specific business data, enabling it to answer user inquiries effectively.

Key Concepts

  • OpenAI Assistant: A virtual assistant trained on your uploaded business files, functioning like a searchable knowledge base.

  • Assistant ID: A unique identifier for your OpenAI Assistant within UChat.

  • Model: The specific OpenAI model used by your assistant (e.g., gpt-4 turbo).

  • Instructions: Additional prompts or guidelines provided to the assistant for refining its responses.

  • File Uploads: Business-related documents uploaded for the assistant's training.

Setting Up the OpenAI Assistant

  1. Access the Integration: In your UChat dashboard, navigate to "Integrations" and select "OpenAI."

  2. API Key: Include your OpenAI API key within the settings.

  3. Uploading Files: Use the "Files" tab to upload relevant documents for training your assistant. You can upload via a button or by file URL, with a 200 MB size limit recommended.

  4. Creating an Assistant: Click "New" to create a new assistant. Choose a name, description, and model (default: gpt-4 turbo).

  5. Providing Instructions: In the "Instructions" field, set the desired tone and response style for your assistant. You can include emojis and use a first-person voice. (Character limit: 20,000)

  6. Attaching Files: Select the uploaded files relevant to the assistant's function.

  7. Saving and Syncing: Click "Create" to generate the assistant. It will also be synced with your OpenAI account.

Using the Assistant in Your Flow

  1. Building the Flow: Create a flow within UChat to incorporate the assistant.

  2. Question Block: Add a question block prompting user input, such as "What can I help you with today?"

  3. OpenAI Assistant Integration: Under "Integrations," choose "OpenAI" and select "Create Assistant Completion."

  4. Remember History: Using the "Remember History" option is optional. If you mark "No", the assistant will not have access to the conversation history, which may limit its ability to provide contextually relevant responses.

  5. Assistant ID: Enter the ID for your chosen assistant, obtainable from the UChat interface.

  6. Model: Using the "Model" in UChat is optional.this will override the model associated with the assistant. Model: gpt-4-1106-preview, gpt-4-vision-preview, gpt-4, gpt-4-32k, gpt-3.5-turbo-1106 and more.

  7. User Input: Rename the "Content" label to "User Input" or a similar term to clarify its purpose.

  8. Additional Instructions (Optional): If the default instructions aren't sufficient, provide more specific prompts within the "Content" field.

  9. Testing and Saving: Enter a test question ("What is your offer?") and observe the assistant's response. Save the completion once satisfied.

 

Mapping the Assistant Response

In the "Create Assistant Completion" block, after carrying out the "Test Request", go to the "Sample data" section.

  1. Click the "Map" icon and select the assistant reply value

  2. Assign a descriptive name to the mapped variable, such as "assistant_reply" in a custom field of text type..

  3. Click "Save".

 

Advanced Usage and Considerations

  • UChat offers various individual OpenAI actions for more granular control (e.g., list assistant files, create assistant).

  • Consider looping back to the assistant completion within your flow to facilitate conversation-like interactions.

  • You can use the assistant reply in your text messages such a custom field.

 

By leveraging the UChat OpenAI Assistant integration, you can create powerful chatbots equipped to answer user questions directly from your business knowledge base.

This enhances user experience and streamlines information retrieval. Don't hesitate to explore the assistant's capabilities and experiment with UChat's OpenAI actions to unlock its full potential.