How to Insert Images in AI Responses?
Incorporating images in AskHandle AI responses enhances user engagement by providing visual context alongside text. Follow this guide to automate image inclusion in your AI responses based on specific keywords.
Step 1: Prepare the Image Sources
Start by creating a CSV file that contains keywords and corresponding image URLs. For example, if your AI handles questions about New York tourist attractions, you can link images to keywords like "Manhattan," "Central Park," and "Statue of Liberty."
Your CSV file should have two columns:
- Keyword: The word or phrase that triggers image insertion.
- Picture URL: The direct Unsplash or image link.
Here’s an example CSV:
Keyword | Picture URL |
---|---|
Manhattan | https://images.unsplash.com/photo-1485738422979-f5c462d49f74 |
Times Square | https://images.unsplash.com/photo-1533577116850-9cc66cad8a9b |
Central Park | https://images.unsplash.com/photo-1528747045269-390fe33c19e1 |
Brooklyn Bridge | https://images.unsplash.com/photo-1559582792-cb2137b2ad63 |
Statue of Liberty | https://images.unsplash.com/photo-1559170054-0762eaff38c2 |
Step 2: Upload the CSV File
Once your CSV is ready, upload it to the AskHandle system. The AI will use this file to match keywords in user queries with image URLs.
Step 3: Guide the AI for Image Handling
Create a text guide in custom prompt
to instruct the AI on how and when to insert images. Define that the AI should check for keywords and display the corresponding image before the text response using Markdown format.
Example Guide:
If the AI detects keywords such as "Manhattan," "Times Square," or "Central Park," it should:
- Retrieve the related image from the CSV file.
- Insert the image before the text response using the Markdown format.
Example:Markdown
Step 4: Integrate Files into AI
With the uploaded CSV file and your custom prompt, the AskHandle AI will be trained to:
- Search for Keywords: Scan user queries for keywords in the CSV file.
- Insert Pictures: Retrieve and display the associated image using Markdown syntax.
- Format the Response: Ensure the image appears above the text response, sized with the
w=230
parameter for consistency.
Step 5: Test AI Responses
Test the AI to verify that images are inserted correctly. Below are sample responses:
Example 1: Query about Manhattan
Markup
Example 2: Query about Brooklyn Bridge
Markup
Example 3: Query about Statue of Liberty
Markup
By following this guide, you can enhance AI responses with visuals, providing users with a more engaging and informative experience.