asco/get_emb.py

6 lines
185 B
Python
Raw Permalink Normal View History

import openai
def get_embedding(text, model="text-embedding-ada-002"):
client = openai.OpenAI();
return client.embeddings.create(input = [text], model=model).data[0].embedding