Close httplib2 connections.
generateInsights(body=None, x__xgafv=None)
Analyzes cost data for a billing account and/or specific projects. Returns a natural language summary and supporting datasets.
close()
Close httplib2 connections.
generateInsights(body=None, x__xgafv=None)
Analyzes cost data for a billing account and/or specific projects. Returns a natural language summary and supporting datasets.
Args:
body: object, The request body.
The object takes the form of:
{ # Request for GenerateInsights.
"filter": "A String", # Optional. Filters cost data by service id. Follows https://google.aip.dev/160 for the filter syntax. eg. filter: "service = 'C7E2-9256-1C43'"
"overriddenMaxIterationCounts": 42, # Optional. Overrides the maximum iterations for any selected strategy.
"parents": [ # Optional. The billing account or projects to analyze.
{ # Specifies a Billing data resource that can be used for authorization to access billing data.
"billingAccount": "A String", # Optional. If not provided the billing account currently associated with the resource will be used.
"resource": "A String", # Required. Resource name for an entitity that can be used for authorization to access billing data such as `projects/{project}` or `billingAccounts/{billing_account}`
},
],
"prompt": "A String", # Required. The natural language prompt from the user.
"userContext": { # Additional context for personalization (e.g., user persona, role). # Optional. Additional context for personalization (e.g., user persona, role).
"persona": "A String", # Optional. The user's persona (e.g., FinOps Manager, Developer).
"role": "A String", # Optional. The user's role (e.g., Billing Admin, Project Owner, etc.).
},
}
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # Response for GenerateInsights.
"finalResult": { # Encapsulates all structured data and the completed summary. # Output only. The final structured results and metadata. Usually sent as the final message in the stream.
"dataSets": [ # Output only. Data sets used to support the insights, suitable for UI rendering (tables/charts).
{ # A dataset used to support an insight, suitable for UI rendering (tables/charts).
"billingData": { # Encapsulates billing data. # Output only. Actual billing data returned from the Data Mart. Uses the formal message from the Billing Data Service.
"columnInfo": [ # Information about columns.
{ # Represents a column header.
"column": "A String", # Name of the column.
},
],
"rows": [ # Rows.
{ # Represents a row in the query result.
"values": [ # Values for a row in the column order.
{ # This is a copy of storage/googlesql/public/value.proto. ValueProto represents the serialized form of the googlesql::Value. The intention is to support multiple languages including Java and C++, so we must be sensitive to the distinction between Java Strings and byte arrays or ByteStrings. We also want to support use-cases which do not want to serialize a copy of the GoogleSQL type for every instance (which might be very repetitive). Therefore, unlike googlesql::Value, ValueProto does not carry full type information with every instance, and can only be fully interpreted with an associated TypeProto.
"ValueProtoSwitchMustHaveADefault": True or False, # User code that switches on this oneoff enum must have a default case so builds won't break when new fields are added.
"arrayValue": { # An ordered collection of elements of arbitrary count. # An array of value
"element": [ # The elements of the array.
# Object with schema name: ValueProto
],
},
"bignumericValue": "A String", # Encoded bignumeric value. For the encoding format see documentation for BigNumericValue::SerializeAsProtoBytes().
"boolValue": True or False, # Primitive for bool.
"bytesValue": "A String", # Primitive for bytes.
"dateValue": 42, # Primitive for date.
"datetimeValue": { # A datetime value. # primitive for datetime
"bitFieldDatetimeSeconds": "A String", # Represents bit field encoding of year/month/day/hour/minute/second. See class DatetimeValue in civil_time.h for details of encoding.
"nanos": 42, # Non-negative fractions of a second at nanosecond resolution.
},
"doubleValue": 3.14, # Primitive for double.
"enumValue": 42, # Tag 11 was used for specifying micros timestamps as int64, now obsolete.
"floatValue": 3.14, # Primitive for float.
"geographyValue": "A String", # Geography encoded using ::stlib::STGeographyEncoder
"int32Value": 42, # Primitive value for int32.
"int64Value": "A String", # Primitive for int64.
"intervalValue": "A String", # Encoded interval value. For the encoding format see documentation for IntervalValue::SerializeAsBytes().
"jsonValue": "A String", # Tag 22 was used for json value as bytes, now obsolete. Json value represented as a string document.
"mapValue": { # An unordered mapping from key to value, represented as a collection of map entries. # Encoded map value. See go/googlesql_map.
"entry": [ # Represents the map entries in the map.
{ # A single entry in a Map, representing the mapping between `key` and `value`.
"key": # Object with schema name: ValueProto # Represents the serialized map key for the entry.
"value": # Object with schema name: ValueProto # Represents the serialized map value of the entry.
},
],
},
"numericValue": "A String", # Encoded numeric value. For the encoding format see documentation for NumericValue::SerializeAsProtoBytes().
"protoValue": "A String", # Stores a serialized protocol message.
"rangeValue": { # A range of values, bounded by the values 'start' (inclusive) and 'end' (exclusive). A range has an element type, and values must be of this element type. A range is contiguous, ie it contains all values of the given element type starting at 'start' and ending before 'end'. A "null" value on start or end represents an unbounded start or end value respectively. Start and end values must always be present. # Encoded range value. See go/googlesql_range.
"end": # Object with schema name: ValueProto # Represents the end of the range.
"start": # Object with schema name: ValueProto # Represents the start of the range.
},
"stringValue": "A String", # Primitive for string.
"structValue": { # A collection of fields. The count, order, and type of the fields is determined by the type associated with this value. # A struct of values
"field": [ # The fields in the struct
# Object with schema name: ValueProto
],
},
"timeValue": "A String", # Bit field encoding of hour/minute/second/nanos. See TimeValue class for details.
"timestampPicoValue": "A String", # Encoded timestamp_pico value. For the encoding format see documentation for googlesql::TimestampPico::SerializeAsBytes().
"timestampValue": "A String", # primitive for timestamp
"tokenlistValue": "A String", # Encoded tokenlist value. copybara:strip_begin(internal-comment) See //search/tokens:token_list. copybara:strip_end
"uint32Value": 42, # Primitive for uint32.
"uint64Value": "A String", # Primitive for uint64.
"uuidValue": "A String", # Encoded uuid value. For the encoding format see documentation for UuidValue::SerializeAsBytes().
},
],
},
],
},
"queryInfo": { # A local representation of the query used to fetch the data. This is used instead of the raw QueryBillingDataRequest to avoid pulling in Cloud Policy Enforcement (CPE) resource_type annotations into the response payload, which causes ESF validation failures. # Output only. The query used to fetch this data.
"columns": "A String", # The columns queried.
"filter": "A String", # The filter applied to the query.
"groupBy": "A String", # The group-by clause applied to the query.
"limit": 42, # The row limit applied to the query.
"orderBy": "A String", # The order-by clause applied to the query.
"parents": [ # The parents (e.g. projects, billing accounts) queried.
"A String",
],
"view": "A String", # The view queried.
},
"suggestedChart": { # A suggested chart for the data set, used for UI rendering. # Output only. A suggested chart for the data set, used for UI rendering.
"chartTitle": "A String", # The title of the chart.
"chartType": "A String", # The type of the chart.
"seriesField": "A String", # The field used for the series (e.g., color-coding). Optional, but recommended for time-series data.
"xAxisField": "A String", # The field used for the x-axis.
"xAxisLabel": "A String", # The label of the x-axis.
"yAxisField": "A String", # The field used for the y-axis.
"yAxisLabel": "A String", # The label of the y-axis.
},
},
],
"fullAnalysis": "A String", # Output only. Contains the full natural language analysis, including thoughts, reasoning, and references.
"insights": [ # Output only. A list of discrete insights gleaned from the data.
{ # e.g. insight: title: "Cost Increase (The Explanation)" description: "Your cost increase was driven by Vertex AI Online Prediction in us-central1..." severity: INFO
"description": "A String", # Output only. The description of the insight.
"severity": "A String", # Output only. The severity of the insight, used for UI rendering (e.g., color-coding).
"title": "A String", # Output only. The title of the insight.
},
],
"interopLinks": [ # Output only. Links to interoperable tools (e.g., pre-filtered Cost Reports or BQE queries).
{ # A link to interoperable tools (e.g., pre-filtered Cost Reports, BQE queries).
"label": "A String", # Output only. The label of the link, suitable for UI rendering.
"linkType": "A String", # Output only. The type of the interop link, e.g., "COST_REPORT", "BQE_QUERY", etc.
"url": "A String", # Output only. The URL of the link.
},
],
"suggestedQueries": [ # Output only. A list of suggested follow-up queries for the user.
{ # A suggested follow-up query for the user.
"query": "A String", # The natural language query.
},
],
"summary": "A String", # Output only. The full natural language summary (re-sent for consistency).
},
"rejection": { # Encapsulates details about why a request was rejected. # Output only. The request was rejected (e.g. out of scope).
"displayMessage": "A String", # Output only. A user-facing message explaining the rejection.
"reason": "A String", # Output only. The reason for the rejection.
},
"summaryChunk": "A String", # Output only. A chunk of the natural language summary (customer-facing). The UI can append these chunks to provide a real-time "typing" effect.
"thoughtChunk": "A String", # Output only. A chunk of the agent's internal reasoning process. The UI can use this to render a "Thinking..." log or status.
}