Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b2f4217

Browse filesBrowse files
authored
docs(samples): Change sample to use Gemini Embedding model (GoogleCloudPlatform#13368)
1 parent 16ebde7 commit b2f4217
Copy full SHA for b2f4217

File tree

Expand file treeCollapse file tree

1 file changed

+3
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-7
lines changed

‎genai/embeddings/embeddings_docretrieval_with_txt.py

Copy file name to clipboardExpand all lines: genai/embeddings/embeddings_docretrieval_with_txt.py
+3-7Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,11 @@ def embed_content() -> str:
2020

2121
client = genai.Client()
2222
response = client.models.embed_content(
23-
model="text-embedding-005",
24-
contents=[
25-
"How do I get a driver's license/learner's permit?",
26-
"How do I renew my driver's license?",
27-
"How do I change my address on my driver's license?",
28-
],
23+
model="gemini-embedding-001",
24+
contents="How do I get a driver's license/learner's permit?",
2925
config=EmbedContentConfig(
3026
task_type="RETRIEVAL_DOCUMENT", # Optional
31-
output_dimensionality=768, # Optional
27+
output_dimensionality=3072, # Optional
3228
title="Driver's License", # Optional
3329
),
3430
)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.