Files
chromadb-admin/script/get_openai_embedding.py

15 lines
251 B
Python
Raw Normal View History

2026-03-29 22:02:22 -04:00
import openai
import os
openai.api_key = "YOUR OPENAI API KEY"
text = "唐朝总共多少年"
response = openai.Embedding.create(
input=text,
model="text-embedding-ada-002"
)
embeddings = response['data'][0]['embedding']
print(embeddings)