openai-cookbook
openai-cookbook copied to clipboard
[PROBLEM] Semantic text search using embeddings cookbook has confusing imports for embeddings_utils
trafficstars
[optional format]
Identify the file to be fixed Semantic_text_search_using_embeddings.ipynb
Describe the problem
from utils.embeddings_utils import get_embedding, cosine_similarity
This import line is failing in the cookbook. Not sure if it's intended as a relative import
Describe a solution A clear and concise description of what a fixed version should do.
For cosine_similarity, we could use scipy tools:
from scipy.spatial import distance
distance.cosine()
For get_embedding, we could write it out for clarity:
def get_embedding(text, model):
...
Screenshots
Additional context General suggestion here is to remove the relative importing so that people can get to "Hello World" faster here