Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit 6fbc6c1

Browse files
Fix to Chat call to use correct documents
1 parent 22100e2 commit 6fbc6c1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

notebooks/Cohere_Elastic_Guide.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,8 @@
469469
"ranked_documents = []\n",
470470
"for document in response.body[\"rerank\"]:\n",
471471
" ranked_documents.append({\n",
472-
" \"title\": documents[document[\"index\"]][\"title\"],\n",
473-
" \"text\": documents[document[\"index\"]][\"text\"]\n",
472+
" \"title\": raw_documents[int(document[\"index\"])][\"_source\"][\"title\"],\n",
473+
" \"text\": raw_documents[int(document[\"index\"])][\"_source\"][\"text\"]\n",
474474
" })\n",
475475
"\n",
476476
"# Print the top 10 results\n",
@@ -528,7 +528,7 @@
528528
"source": [
529529
"response = co.chat(\n",
530530
" message=query,\n",
531-
" documents=documents,\n",
531+
" documents=ranked_documents,\n",
532532
" model='command-r-plus'\n",
533533
")\n",
534534
"\n",

0 commit comments

Comments
 (0)