Stock price table as JSON

Generate key information from a stock data table and return as JSON

You can query a model directly and test the results returned when using different parameter values with the Cloud console, or by calling the Vertex AI API directly.

Prompt Freeform

Context:

Date Open price Close price
2024-01-04 19.97 19.05
2024-01-05 19.08 19.54
2024-01-06 19.60 20.51
2024-01-07 20.69 20.56
2024-01-08 20.61 20.05

Query: Extract the date, open price, and close price into a JSON array, with one entry for each day. Also print the "highest_close_price_date" and "lowest_close_price_date" in the last part of the JSON array.

Response

{
  "daily_prices": [
    {
      "date": "2024-01-04",
      "open_price": 19.97,
      "close_price": 19.05
    },
    {
      "date": "2024-01-05",
      "open_price": 19.08,
      "close_price": 19.54
    },
    {
      "date": "2024-01-06",
      "open_price": 19.60,
      "close_price": 20.51
    },
    {
      "date": "2024-01-07",
      "open_price": 20.69,
      "close_price": 20.56
    },
    {
      "date": "2024-01-08",
      "open_price": 20.61,
      "close_price": 20.05
    }
  ],
  "highest_close_price_date": "2024-01-07",
  "lowest_close_price_date": "2024-01-04"
}
Model: gemini-2.5-pro
Temperature: 0.2
Max output tokens: 2048
TopK: 40.0
TopP: 0.95