Compare commits

...
Author SHA1 Message Date
Kewen Tang 88278b81cf remove preview models in description 2024-05-06 21:20:42 +00:00
@@ -72,7 +72,7 @@
"source": [
"## Overview\n",
"\n",
"This notebook is a code example for how to call our newly released text emebedding models (text-embedding-preview-0409 and text-multilingual-embedding-preview-0409).\n",
"This notebook is a code example for how to call our newly released text emebedding models (text-embedding-004, text-multilingual-embedding-002).\n",
"\n",
"Learn more about [text embedding api](https://cloud.google.com/vertex-ai/docs/generative-ai/embeddings/get-text-embeddings#api_changes_to_models_released_in_or_after_august_2023)."
]
@@ -85,8 +85,7 @@
"source": [
"### Objective\n",
"\n",
"In this tutorial, you learn how to call text embedding latest APIs on two\n",
"new models, text-embedding-preview-0409 and text-multilingual-embedding-preview-0409:\n",
"In this tutorial, you learn how to call text embedding latest APIs on two new GA models text-embedding-004 and text-multilingual-embedding-002\n",
"\n",
"This tutorial uses the following Google Cloud ML services and resources:\n",
"\n",
@@ -328,8 +327,10 @@
"### Generate embeddings\n",
"\n",
"1. Set the model name. The latest models are\n",
" * \"text-embedding-preview-0409\" for English.\n",
" * \"text-multilingual-embedding-preview-0409\" for i18n. See the [language coverage](https://cloud.google.com/vertex-ai/generative-ai/docs/embeddings/get-text-embeddings#language_coverage_for_textembedding-gecko-multilingual_models) for the list of supported languages.\n",
" * \"text-embedding-004\" for English.\n",
" * \"text-multilingual-embedding-002\" for i18n.\n",
" \n",
" See the [language coverage](https://cloud.google.com/vertex-ai/generative-ai/docs/embeddings/get-text-embeddings#language_coverage_for_textembedding-gecko-multilingual_models) for the list of supported languages.\n",
" \n",
" See [the public doc](https://cloud.google.com/vertex-ai/generative-ai/docs/embeddings/get-text-embeddings) for the full list of supported models.\n",
"2. Set the task type, text, and title (*optional and valid only for task type \"RETRIEVAL_DOCUMENT\"*). The valid task types are:\n",
@@ -353,7 +354,7 @@
"outputs": [],
"source": [
"# @title { run: \"auto\" }\n",
"MODEL = \"text-embedding-preview-0409\" # @param [\"text-embedding-preview-0409\", \"text-multilingual-embedding-preview-0409\", \"textembedding-gecko@003\", \"textembedding-gecko-multilingual@001\"]\n",
"MODEL = \"text-embedding-004\" # @param [\"text-embedding-004\", \"text-multilingual-embedding-002\",\"text-embedding-preview-0409\", \"text-multilingual-embedding-preview-0409\", \"textembedding-gecko@003\", \"textembedding-gecko-multilingual@001\"]\n",
"TASK = \"RETRIEVAL_DOCUMENT\" # @param [\"RETRIEVAL_QUERY\", \"RETRIEVAL_DOCUMENT\", \"SEMANTIC_SIMILARITY\", \"CLASSIFICATION\", \"CLUSTERING\", \"QUESTION_ANSWERING\", \"FACT_VERIFICATION\"]\n",
"TEXT = \"Banana Muffin?\" # @param {type:\"string\"}\n",
"TITLE = \"\" # @param {type:\"string\"}\n",
@@ -366,11 +367,15 @@
"if TITLE and TASK != \"RETRIEVAL_DOCUMENT\":\n",
" raise ValueError(\"TITLE can only be specified for TASK 'RETRIEVAL_DOCUMENT'\")\n",
"if OUTPUT_DIMENSIONALITY is not None and MODEL not in [\n",
" \"text-embedding-004\",\n",
" \"text-multilingual-embedding-002\",\n",
" \"text-embedding-preview-0409\",\n",
" \"text-multilingual-embedding-preview-0409\",\n",
"]:\n",
" raise ValueError(f\"OUTPUT_DIMENTIONALITY cannot be specified for model '{MODEL}'.\")\n",
"if TASK in [\"QUESTION_ANSWERING\", \"FACT_VERIFICATION\"] and MODEL not in [\n",
" \"text-embedding-004\",\n",
" \"text-multilingual-embedding-002\",\n",
" \"text-embedding-preview-0409\",\n",
" \"text-multilingual-embedding-preview-0409\",\n",
"]:\n",