bigframes.bigquery.ai.score#
- bigframes.bigquery.ai.score(prompt: str | Series | Series | List[str | Series | Series] | Tuple[str | Series | Series, ...], *, connection_id: str | None = None, endpoint: str | None = None, max_error_ratio: float | None = None) Series[source]#
Computes a score based on rubrics described in natural language. It will return a double value. There is no fixed range for the score returned. To get high quality results, provide a scoring rubric with examples in the prompt.
Examples:
>>> import bigframes.pandas as bpd >>> import bigframes.bigquery as bbq >>> animal = bpd.Series(["Tiger", "Rabbit", "Blue Whale"]) >>> bbq.ai.score(("Rank the relative weights of ", animal, " on the scale from 1 to 3")) 0 2.0 1 1.0 2 3.0 dtype: Float64
- Parameters:
prompt (str | Series | List[str|Series] | Tuple[str|Series, ...]) – A mixture of Series and string literals that specifies the prompt to send to the model. The Series can be BigFrames Series or pandas Series.
connection_id (str, optional) – Specifies the connection to use to communicate with the model. For example, myproject.us.myconnection. If not provided, the query uses your end-user credential.
endpoint (str, optional) – Specifies the Vertex AI endpoint to use for the model. For example “gemini-2.5-flash”. You can specify any generally available or preview Gemini model. If you specify the model name, BigQuery ML automatically identifies and uses the full endpoint of the model. If you don’t specify an endpoint value, BigQuery ML dynamically chooses a model based on your query to have the best cost to quality tradeoff for the task.
max_error_ratio (float, optional) – A value between 0.0 and 1.0 that contains the maximum acceptable ratio of row-level inference failures to rows processed on this function. If this value is exceeded, then the query fails.
- Returns:
A new series of double (float) values.
- Return type: