Skip to main content

Meta Prompting Service (Python)

This document describes the Flask application serving as a microservice for refining prompts using Google's Gemini model.

Overview

This Flask application provides an API to refine an initial prompt for a specific AI task. It uses Google's Gemini model to make the prompt more effective, clear, and aligned with the task's objectives.

Key Functionalities Exposed:

  • Receiving an initial prompt and a task description.
  • Using Gemini to refine the prompt.
  • Returning the refined prompt.

Technology Stack:

  • Flask: For creating the web server and API endpoints.
  • google-generativeai: The core library for interacting with the Gemini model.

API Endpoints

POST /refine-prompt

Refines a prompt using Gemini.

Request Body:

{
"initial_prompt": "The initial prompt to be refined.",
"task_description": "A description of the task the prompt is for."
}

Responses:

  • 200 OK: A JSON object with the refined prompt.
  • 400 Bad Request: If the request body is invalid.
  • 500 Internal Server Error: If the Gemini API call fails.