Skip to content

Commit

Permalink
Adding chatbot example with multiquery
Browse files Browse the repository at this point in the history
  • Loading branch information
Samiul-TheSoccerFan authored and afoucret committed Feb 1, 2024
1 parent ea994c3 commit bc42f8e
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand All @@ -37,11 +37,11 @@
}
],
"source": [
"!python3 -m pip install -qU jq lark elasticsearch langchain_openai tiktoken\n",
"!python3 -m pip install -qU lark elasticsearch langchain openai\n",
"\n",
"from langchain_openai.embeddings import OpenAIEmbeddings\n",
"from langchain.embeddings.openai import OpenAIEmbeddings\n",
"from langchain.vectorstores import ElasticsearchStore\n",
"from langchain_openai.llms import OpenAI\n",
"from langchain.llms import OpenAI\n",
"from langchain.retrievers.multi_query import MultiQueryRetriever\n",
"from getpass import getpass"
]
Expand All @@ -61,7 +61,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -79,7 +79,7 @@
"vectorstore = ElasticsearchStore(\n",
" es_cloud_id=ELASTIC_CLOUD_ID, \n",
" es_api_key=ELASTIC_API_KEY,\n",
" index_name=\"chatbot-multi-query-demo\",\n",
" index_name=\"elasticsearch-multi-query-demo\",\n",
" embedding= embeddings,\n",
")"
]
Expand All @@ -94,7 +94,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -125,7 +125,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -167,14 +167,14 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"documents = vectorstore.from_documents(\n",
" docs, \n",
" embeddings, \n",
" index_name=\"chatbot-multi-query-demo\",\n",
" index_name=\"elasticsearch-multi-query-demo\",\n",
" es_cloud_id=ELASTIC_CLOUD_ID,\n",
" es_api_key=ELASTIC_API_KEY\n",
")\n",
Expand All @@ -195,7 +195,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand Down

0 comments on commit bc42f8e

Please sign in to comment.