Data Visualization Expert

Data Visualization Expert · GPT 작업

Data Visualization Expert

API for performing data manipulations, visualizations, and basic image interpretations using `matplotlib`, Pandas, and text extraction.

  • POST /execute-python-codeExecute Python code

    Executes a Python script for data manipulation, analysis, or visualization.

  • POST /display-dataframeDisplay a Pandas DataFrame to the user

    Displays a Pandas DataFrame by name for the user to view.

  • POST /generate-chartGenerate a data visualization

    Creates a visualization (line, bar, scatter, histogram) based on input data.

  • POST /interpret-imageInterpret an uploaded image

    Performs text extraction or basic object recognition on the provided image.

  • POST /natural-language-queryRespond to natural language questions

    Provides answers to user queries or guidance on data analysis and visualization.

원본 API 스키마
{
  "openapi": "3.1.0",
  "info": {
    "title": "Data Visualization Expert",
    "description": "API for performing data manipulations, visualizations, and basic image interpretations using `matplotlib`, Pandas, and text extraction.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://localhost",
      "description": "Local server for data analysis and visualization"
    }
  ],
  "paths": {
    "/execute-python-code": {
      "post": {
        "operationId": "executePythonCode",
        "summary": "Execute Python code",
        "description": "Executes a Python script for data manipulation, analysis, or visualization.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "The Python code to be executed."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully executed code",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "output": {
                      "type": "string",
                      "description": "The standard output or result of the code execution."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input data or syntax error in code"
          },
          "500": {
            "description": "Error during code execution or timeout"
          }
        }
      }
    },
    "/display-dataframe": {
      "post": {
        "operationId": "displayDataframe",
        "summary": "Display a Pandas DataFrame to the user",
        "description": "Displays a Pandas DataFrame by name for the user to view.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "A descriptive name for the DataFrame."
                  },
                  "dataframe": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "description": "JSON representation of the Pandas DataFrame to be displayed."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully displayed DataFrame",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string",
                  "description": "Confirmation message or DataFrame identifier"
                }
              }
            }
          },
          "400": {
            "description": "Invalid DataFrame structure"
          }
        }
      }
    },
    "/generate-chart": {
      "post": {
        "operationId": "generateChart",
        "summary": "Generate a data visualization",
        "description": "Creates a visualization (line, bar, scatter, histogram) based on input data.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chart_type": {
                    "type": "string",
                    "enum": [
                      "line",
                      "bar",
                      "scatter",
                      "histogram"
                    ],
                    "description": "Type of chart to generate."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "x": {
                        "type": "array",
                        "items": {
                          "type": "number"
                        },
                        "description": "Array of x-values for the chart."
                      },
                      "y": {
                        "type": "array",
                        "items": {
                          "type": "number"
                        },
                        "description": "Array of y-values for the chart."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully generated chart",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                },
                "description": "Returns the generated chart as a PNG binary image."
              }
            }
          },
          "400": {
            "description": "Invalid chart data or unsupported chart type"
          },
          "500": {
            "description": "Error during chart generation"
          }
        }
      }
    },
    "/interpret-image": {
      "post": {
        "operationId": "interpretImage",
        "summary": "Interpret an uploaded image",
        "description": "Performs text extraction or basic object recognition on the provided image.",
        "requestBody": {
          "required": true,
          "content": {
            "image/png": {
              "schema": {
                "type": "string",
                "format": "binary",
                "description": "PNG image file to be interpreted"
              }
            },
            "image/jpeg": {
              "schema": {
                "type": "string",
                "format": "binary",
                "description": "JPEG image file to be interpreted"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully interpreted image",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "text": {
                      "type": "string",
                      "description": "Extracted text from the image, if available."
                    },
                    "objects": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "List of recognized objects in the image, if applicable."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unsupported image format"
          },
          "500": {
            "description": "Error during image interpretation"
          }
        }
      }
    },
    "/natural-language-query": {
      "post": {
        "operationId": "naturalLanguageQuery",
        "summary": "Respond to natural language questions",
        "description": "Provides answers to user queries or guidance on data analysis and visualization.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "description": "The natural language query or question to answer."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully generated response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "answer": {
                      "type": "string",
                      "description": "Response to the user’s question"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid or empty query"
          },
          "500": {
            "description": "Error in generating response"
          }
        }
      }
    }
  }
}