Skip to content

Commit

Permalink
autoformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
maxhniebergall committed Aug 29, 2024
1 parent 0e3587e commit 2737b60
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"source": [
"Now you can instantiate the Python Elasticsearch client.\n",
"\n",
"First provide your password and Cloud ID.\n",
"First provide your API key and Serverless Endpoint.\n",
"Then create a `client` object that instantiates an instance of the `Elasticsearch` class."
]
},
Expand Down Expand Up @@ -625,13 +625,21 @@
"\n",
" input.append(\"Query:\" + str(query))\n",
"\n",
" # Use semantic search with our previously configured reranker to find our small set of matching recipes\n",
" recipes = extract_recipe_as_string(semantic_search_with_reranking(query))\n",
" if len(recipes) > 0:\n",
" # if at least one recipe matched our query, combine them into a single string, with each recipe seperated by two new lines.\n",
" input.append(\"Recipes:\" + \"\\n\\n\".join(recipes))\n",
"\n",
" # combine the Context, Query, and Recipes sections (each seperated by three new lines) into a single string\n",
" input_as_string = \"\\n\\n\\n\".join(input)\n",
"\n",
" # pass the full combined instructions and recipes to the Command+R model\n",
" chat_completion = client.inference.inference(\n",
" inference_id=\"cohere_completion\", input=\"\\n\\n\\n\".join(input)\n",
" inference_id=\"cohere_completion\", input=input_as_string\n",
" )\n",
"\n",
" # print the response which should contain our recipe\n",
" print(chat_completion[\"completion\"][0][\"result\"])\n",
" else:\n",
" print(\"No hits\")"
Expand Down

0 comments on commit 2737b60

Please sign in to comment.