bigframes.bigquery.ml.generate_embedding#

bigframes.bigquery.ml.generate_embedding(model: BaseEstimator | str | Series, input_: DataFrame | DataFrame | str, *, flatten_json_output: bool | None = None, task_type: str | None = None, output_dimensionality: int | None = None) DataFrame[source]#

Generates text embedding using a BigQuery ML model.

See the BigQuery ML GENERATE_EMBEDDING function syntax for additional reference.

Parameters:
  • model (bigframes.ml.base.BaseEstimator or str) – The model to use for text embedding.

  • input (Union[bigframes.pandas.DataFrame, str]) – The DataFrame or query to use for text embedding.

  • flatten_json_output (bool, optional) – A BOOL value that determines the content of the generated JSON column.

  • task_type (str, optional) – A STRING value that specifies the intended downstream application task. Supported values are: - RETRIEVAL_QUERY - RETRIEVAL_DOCUMENT - SEMANTIC_SIMILARITY - CLASSIFICATION - CLUSTERING - QUESTION_ANSWERING - FACT_VERIFICATION - CODE_RETRIEVAL_QUERY

  • output_dimensionality (int, optional) – An INT64 value that specifies the size of the output embedding.

Returns:

The generated text embedding.

Return type:

bigframes.pandas.DataFrame