mirror of
https://github.com/pinecone-io/examples.git
synced 2023-10-11 20:04:54 +03:00
fix to openai app with new pinecone api
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -97,13 +97,13 @@
|
||||
" Find most relevant context for a question via Pinecone search\n",
|
||||
" \"\"\"\n",
|
||||
" q_embed = get_embedding(question, engine=f'text-search-{size}-query-001')\n",
|
||||
" res = index.query([q_embed], top_k=5, include_metadata=True)\n",
|
||||
" res = index.query(q_embed, top_k=5, include_metadata=True)\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" cur_len = 0\n",
|
||||
" contexts = []\n",
|
||||
"\n",
|
||||
" for row in res['results'][0]['matches']:\n",
|
||||
" for row in res['matches']:\n",
|
||||
" text = mappings[row['id']]\n",
|
||||
" cur_len += row['metadata']['n_tokens'] + 4\n",
|
||||
" if cur_len < max_len:\n",
|
||||
@@ -457,11 +457,8 @@
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"interpreter": {
|
||||
"hash": "5188bc372fa413aa2565ae5d28228f50ad7b2c4ebb4a82c5900fd598adbb6408"
|
||||
},
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3.8.8 ('ml')",
|
||||
"display_name": "Python 3.9.12 ('ml')",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
@@ -475,9 +472,14 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.8"
|
||||
"version": "3.9.12"
|
||||
},
|
||||
"orig_nbformat": 4
|
||||
"orig_nbformat": 4,
|
||||
"vscode": {
|
||||
"interpreter": {
|
||||
"hash": "b8e7999f96e1b425e2d542f21b571f5a4be3e97158b0b46ea1b2500df63956ce"
|
||||
}
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
|
||||
Reference in New Issue
Block a user