summaryrefslogtreecommitdiff
path: root/setup_cont.py
blob: 360c9f97449922ab50ef7f15f958e9f2b1f9a028 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import ast
from collections import defaultdict
import os
import pandas as pd
import openai 
import tiktoken
from openai.embeddings_utils import get_embedding, cosine_similarity

openai.api_key = os.getenv('END_OF_WORLD')

df=pd.read_csv("setup_dataWithSummary.csv")
embedding_model = "text-embedding-ada-002"
df["embedding_summary"] = df.summary.apply([lambda x: get_embedding(x, engine=embedding_model)])
print(df)

df.to_csv('setup_dataWithSummaryEmbed.csv')