From ae45a48de36beb050f9ea279552e0a0492ce795f Mon Sep 17 00:00:00 2001 From: Scott Leibrand Date: Fri, 23 Dec 2022 12:30:26 -0800 Subject: [PATCH] Only get_embedding once https://github.com/openai/openai-cookbook/commit/fd181ec78fa57e14583e27915ccdad3a084296ae updated what was previously two different get_embedding() calls w/ different models to be two identical calls. Rather than doing the same API call twice in a row, we can now just set the second variable to be equal to the first one. --- examples/Obtain_dataset.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/Obtain_dataset.ipynb b/examples/Obtain_dataset.ipynb index 74783d9..47afcfb 100644 --- a/examples/Obtain_dataset.ipynb +++ b/examples/Obtain_dataset.ipynb @@ -162,7 +162,7 @@ "\n", "# This will take just between 5 and 10 minutes\n", "df['ada_similarity'] = df.combined.apply(lambda x: get_embedding(x, engine='text-embedding-ada-002'))\n", - "df['ada_search'] = df.combined.apply(lambda x: get_embedding(x, engine='text-embedding-ada-002'))\n", + "df['ada_search'] = df['ada_similarity']\n", "df.to_csv('data/fine_food_reviews_with_embeddings_1k.csv')" ] }