chore: initial commit
This commit is contained in:
14
script/get_openai_embedding.py
Normal file
14
script/get_openai_embedding.py
Normal file
@@ -0,0 +1,14 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user