th4ruka / text-to-image-bot

A chatbot API for a GAN-based text-to-image synthesizer.
MIT License
0 stars 2 forks source link

Update API response schema #3

Open th4ruka opened 2 months ago

th4ruka commented 2 months ago

Description:

Currently, format of the API response is as follows:

{
ai_msg: <message of the AI chat-bot>
url: null
}

Problem:

API response should be updated as follows:

{
ai_msg: <message of the AI chat-bot>
url: <null if there is no URL of an image> | <if there is an image, the URL>
}

Example for the current scenario:

  1. Human Message (API request body):
    {
    "human_msg": "Hi! Can you generate an image of a car for me?"
    }
  2. Chat-bot Response:
    {
    "ai_msg": "Sure! I'd be happy to help you with that. Could you please provide me with some details about the car you'd like to see in the image? For example, the color of the car, the background, the type of car (e.g., sports car, vintage car, SUV), and any other specific details you have in mind.",
    "url": null
    }
  3. Human Message:
    {
    "human_msg": "I want a black BMW car riding on a country road."
    }
  4. Chat-bot Response:
    {
    "ai_msg": "Here is the image of a black BMW car riding on a country road. \n[Click here to view the image](https://storage.googleapis.com/text-to-image-bot-657bb.appspot.com/20240507_041456.jpg?X-Goog-Signature=410383542f70a11d4b6a74254b41e5e7525f63026c683b017e66f45f6b6bd4e939bd58408b8bdf09cf5bad97055e9ccc26a4006409dc80c9c9878)\n\nIs there anything specific you would like to add or modify in the image?",
    "url": null
    }
    • As you can see in the final chat-bot's response (step 4), the URL for the image is also embedded inside the ai_msg rather than including it in the url field.

Enhancement:

Create a Langchain chat agent to adapt the above scenario.

Refer Lanchain chat models structured output section.

th4ruka commented 2 months ago

Returning structured outputs from agents