I am new to OpenAI and I am using it for document search after the embedding process. In the given example from the blog, I need to ask questions individually. However, in my use case, I have more than 10 questions and I would like to use a prompt to run the top 4 questions all together. Can someone help me modify the code to accommodate all my 10 questions in “res = search_docs”?
The blog I am using: https://learn.microsoft.com/en-us/azure/ai-services/openai/tutorials/embeddings?tabs=command-line
The code snippet I need help on :
# search through the reviews for a specific product
def search_docs(df, user_query, top_n=3, to_print=True):
embedding = get_embedding(
user_query,
engine="text-embedding-ada-002" # engine should be set to the deployment name you chose when you deployed the text-embedding-ada-002 (Version 2) model
)
df["similarities"] = df.ada_v2.apply(lambda x: cosine_similarity(x, embedding))
res = (
df.sort_values("similarities", ascending=False)
.head(top_n)
)
if to_print:
display(res)
return res
res = search_docs(df_bills, "Can I get information on cable company tax revenue?", top_n=4)