File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed
Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 1717# [START generativeaionvertexai_embedding_code_retrieval]
1818from vertexai .language_models import TextEmbeddingInput , TextEmbeddingModel
1919
20- MODEL_NAME = "text-embedding-preview-0815 "
20+ MODEL_NAME = "text-embedding-005 "
2121DIMENSIONALITY = 256
2222
2323
2424def embed_text (
2525 texts : list [str ] = ["Retrieve a function that adds two numbers" ],
2626 task : str = "CODE_RETRIEVAL_QUERY" ,
27- model_name : str = "text-embedding-preview-0815 " ,
27+ model_name : str = "text-embedding-005 " ,
2828 dimensionality : int | None = 256 ,
2929) -> list [list [float ]]:
3030 """Embeds texts with a pre-trained, foundational model."""
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ def embed_text() -> list[list[float]]:
3232 # The task type for embedding. Check the available tasks in the model's documentation.
3333 task = "RETRIEVAL_DOCUMENT"
3434
35- model = TextEmbeddingModel .from_pretrained ("text-embedding-004 " )
35+ model = TextEmbeddingModel .from_pretrained ("text-embedding-005 " )
3636 inputs = [TextEmbeddingInput (text , task ) for text in texts ]
3737 kwargs = dict (output_dimensionality = dimensionality ) if dimensionality else {}
3838 embeddings = model .get_embeddings (inputs , ** kwargs )
Original file line number Diff line number Diff line change 2121
2222def tune_embedding_model (
2323 api_endpoint : str ,
24- base_model_name : str = "text-embedding-004 " ,
24+ base_model_name : str = "text-embedding-005 " ,
2525 corpus_path : str = "gs://cloud-samples-data/ai-platform/embedding/goog-10k-2024/r11/corpus.jsonl" ,
2626 queries_path : str = "gs://cloud-samples-data/ai-platform/embedding/goog-10k-2024/r11/queries.jsonl" ,
2727 train_label_path : str = "gs://cloud-samples-data/ai-platform/embedding/goog-10k-2024/r11/train.tsv" ,
You can’t perform that action at this time.
0 commit comments