|
|
|
@ -105,7 +105,7 @@
|
|
|
|
|
"import pinecone\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"# I've set this to our new embeddings model, this can be changed to the embedding model of your choice\n",
|
|
|
|
|
"EMBEDDING_MODEL = \"text-embedding-3-small\"\n",
|
|
|
|
|
"EMBEDDING_MODEL = \"text-embedding-ada-002\"\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"# Ignore unclosed SSL socket warnings - optional in case you get these errors\n",
|
|
|
|
|
"import warnings\n",
|
|
|
|
@ -532,7 +532,7 @@
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 13,
|
|
|
|
|
"execution_count": null,
|
|
|
|
|
"id": "3c8c2aa1",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
@ -548,9 +548,9 @@
|
|
|
|
|
" )[\"data\"][0]['embedding']\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" # Query namespace passed as parameter using title vector\n",
|
|
|
|
|
" query_result = index.query(embedded_query, \n",
|
|
|
|
|
" namespace=namespace, \n",
|
|
|
|
|
" top_k=top_k)\n",
|
|
|
|
|
" query_result = index.query(vector=embedded_query, \n",
|
|
|
|
|
" namespace=namespace, \n",
|
|
|
|
|
" top_k=top_k)\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" # Print query results \n",
|
|
|
|
|
" print(f'\\nMost similar results to {query} in \"{namespace}\" namespace:\\n')\n",
|
|
|
|
@ -567,7 +567,7 @@
|
|
|
|
|
" })\n",
|
|
|
|
|
" \n",
|
|
|
|
|
" counter = 0\n",
|
|
|
|
|
" for k,v in df.iterrows():\n",
|
|
|
|
|
" for _,v in df.iterrows():\n",
|
|
|
|
|
" counter += 1\n",
|
|
|
|
|
" print(f'{v.title} (score = {v.score})')\n",
|
|
|
|
|
" \n",
|
|
|
|
@ -629,14 +629,6 @@
|
|
|
|
|
"source": [
|
|
|
|
|
"content_query_output = query_article(\"Famous battles in Scottish history\",'content')"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": null,
|
|
|
|
|
"id": "0119d87a",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": []
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|