Closed1
vertex ai vector search
embeddingを作成
def generate_embeddings():
credentials = Credentials.from_service_account_file(
filename="src/scripts/key.json",
# scopes=["https://www.googleapis.com/auth/cloud-platform"],
)
if credentials.expired:
credentials.refresh(Request())
vertexai.init(
project="vector-search-test-439304",
location="us-central1",
credentials=credentials,
)
model = TextEmbeddingModel.from_pretrained("text-embedding-004")
embedding = model.get_embeddings(texts=["test"], output_dimensionality=768)
print(embedding)
このスクラップは1ヶ月前にクローズされました