# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

description: "Tests a full, realistic stream about finding the penguin island with the highest body mass."

user_question: "Penguins on which island have the highest average body mass?"

mock_api_stream: |
  [{
    "timestamp": "2025-07-17T17:25:28.231Z",
    "systemMessage": {
      "text": {
        "parts": [
          "Penguins on which island have the highest average body mass?"
        ],
        "textType": "THOUGHT"
      }
    }
  }
  ,
  {
    "timestamp": "2025-07-17T17:25:31.171Z",
    "systemMessage": {
      "data": {
        "generatedSql": "SELECT island, AVG(body_mass_g) AS average_body_mass\nFROM `bigframes-dev-perf`.`bigframes_testing_eu`.`penguins`\nGROUP BY island;"
      }
    }
  }
  ,
  {
    "timestamp": "2025-07-17T17:25:32.664Z",
    "systemMessage": {
      "data": {
        "result": {
          "data": [
            {
              "island": "Biscoe",
              "average_body_mass": "4716.017964071853"
            },
            {
              "island": "Dream",
              "average_body_mass": "3712.9032258064512"
            },
            {
              "island": "Torgersen",
              "average_body_mass": "3706.3725490196075"
            }
          ],
          "name": "average_body_mass_by_island",
          "schema": {
            "fields": [
              {
                "name": "island",
                "type": "STRING",
                "mode": "NULLABLE"
              },
              {
                "name": "average_body_mass",
                "type": "FLOAT",
                "mode": "NULLABLE"
              }
            ]
          }
        }
      }
    }
  }
  ,
  {
    "timestamp": "2025-07-17T17:25:40.018Z",
    "systemMessage": {
      "text": {
        "parts": [
          "Penguins on Biscoe island have the highest average body mass, with an average of 4716.02g."
        ],
        "textType": "FINAL_RESPONSE"
      }
    }
  }
  ]

expected_output:
- text:
    parts:
      - 'Penguins on which island have the highest average body mass?'
    textType: THOUGHT
- data:
    generatedSql: "SELECT island, AVG(body_mass_g) AS average_body_mass\nFROM `bigframes-dev-perf`.`bigframes_testing_eu`.`penguins`\nGROUP BY island;"
- Data Retrieved:
    headers:
      - island
      - average_body_mass
    rows:
      - - Biscoe
        - '4716.017964071853'
      - - Dream
        - '3712.9032258064512'
      - - Torgersen
        - '3706.3725490196075'
    summary: Showing all 3 rows.
- text:
    parts:
      - "Penguins on Biscoe island have the highest average body mass, with an average of 4716.02g."
    textType: FINAL_RESPONSE
