Examples and guides for using the OpenAI API
rename image file
simonpfishaf7239bfda55
diff --git a/examples/Question_answering_using_a_search_API.ipynb b/examples/Question_answering_using_a_search_API.ipynbindex e1190b5a..2f029449 100644--- a/examples/Question_answering_using_a_search_API.ipynb+++ b/examples/Question_answering_using_a_search_API.ipynb@@ -18,7 +18,7 @@"\n","By combining these approaches, and drawing inspiration from [re-ranking](https://www.sbert.net/examples/applications/retrieve_rerank/README.html) methods, we identify an approach that sits in the middle. **This approach can be implemented on top of any existing search system, like the Slack search API, or an internal ElasticSearch instance with private data**. Here’s how it works:\n","\n",- "\n",+ "\n","\n","**Step 1: Search**\n","\n",@@ -93,7 +93,7 @@"\n","def embeddings(input: list[str]) -> list[list[str]]:\n"," response = openai.Embedding.create(model=\"text-embedding-ada-002\", input=input)\n",- " return [data.embedding for data in response.data]\n"+ " return [data.embedding for data in response.data]"]},{@@ -113,7 +113,7 @@"outputs": [],"source": ["# User asks a question\n",- "USER_QUESTION = \"Who won the NBA championship? And who was the MVP? Tell me a bit about the last game.\"\n"+ "USER_QUESTION = \"Who won the NBA championship? And who was the MVP? Tell me a bit about the last game.\""]},{@@ -179,7 +179,7 @@"# Let's include the original question as well for good measure\n","queries.append(USER_QUESTION)\n","\n",- "queries\n"+ "queries"]},{@@ -282,7 +282,7 @@" print(\"Title:\", article[\"title\"])\n"," print(\"Description:\", article[\"description\"])\n"," print(\"Content:\", article[\"content\"][0:100] + \"...\")\n",- " print()"+ " print()\n"]},{@@ -326,7 +326,7 @@"\n","hypothetical_answer = json_gpt(HA_INPUT)[\"hypotheticalAnswer\"]\n","\n",- "hypothetical_answer"+ "hypothetical_answer\n"]},{@@ -376,7 +376,7 @@"for article_embedding in article_embeddings:\n"," cosine_similarities.append(dot(hypothetical_answer_embedding, article_embedding))\n","\n",- "cosine_similarities[0:10]"+ "cosine_similarities[0:10]\n"]},{@@ -440,7 +440,7 @@" print(\"Description:\", article[\"description\"])\n"," print(\"Content:\", article[\"content\"][0:100] + \"...\")\n"," print(\"Score:\", score)\n",- " print()"+ " print()\n"]},{@@ -500,7 +500,7 @@"for chunk in completion:\n"," text += chunk.choices[0].delta.get(\"content\", \"\")\n"," display.clear_output(wait=True)\n",- " display.display(display.Markdown(text))\n"+ " display.display(display.Markdown(text))"]}],diff --git a/images/search_augmentation_embeddings.png b/images/search_rerank_answer.pngsimilarity index 100%rename from images/search_augmentation_embeddings.pngrename to images/search_rerank_answer.png