Skip to content

Commit

Permalink
Suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishtiwari1993 committed Jan 25, 2024
1 parent a05ed9b commit 58cb37c
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"id": "2a3143e8-3949-4ecc-905c-8333a43c9c87",
"metadata": {},
"source": [
"# Question Answering using Gemini, Langchain & Elasticsearch \n",
"# Question Answering using Gemini, Langchain & Elasticsearch\n",
"\n",
"This tutorial demonstrates how to use the [Gemini API](https://ai.google.dev/docs) to create [embeddings](https://ai.google.dev/docs/embeddings_guide) and store them in Elasticsearch. We will learn how to connect Gemini to private data stored in Elasticsearch and build question/answer capabilities over it using [LangChain](https://python.langchain.com/docs/get_started/introduction)."
"This tutorial demonstrates how to use the [Gemini API](https://ai.google.dev/docs) to create [embeddings](https://ai.google.dev/docs/embeddings_guide) and store them in Elasticsearch. We will learn how to connect Gemini to private data stored in Elasticsearch and build question/answer capabilities over it using [LangChian](https://python.langchain.com/docs/get_started/introduction)."
]
},
{
Expand Down Expand Up @@ -60,13 +60,14 @@
"from getpass import getpass\n",
"from urllib.request import urlopen\n",
"\n",
"from langchain.prompts import ChatPromptTemplate\n",
"from langchain.schema.output_parser import StrOutputParser\n",
"from langchain.schema.runnable import RunnablePassthrough\n",
"from langchain.text_splitter import CharacterTextSplitter\n",
"from elasticsearch import Elasticsearch, helpers\n",
"from langchain.vectorstores import ElasticsearchStore\n",
"from langchain.text_splitter import CharacterTextSplitter\n",
"from langchain_google_genai import GoogleGenerativeAIEmbeddings\n",
"from langchain_google_genai import ChatGoogleGenerativeAI\n",
"from langchain_google_genai import GoogleGenerativeAIEmbeddings",
"from langchain.prompts import ChatPromptTemplate\n",
"from langchain.schema.output_parser import StrOutputParser\n",
"from langchain.schema.runnable import RunnablePassthrough"
]
},
{
Expand Down Expand Up @@ -165,7 +166,7 @@
"metadata": {},
"outputs": [],
"source": [
"embedding = GoogleGenerativeAIEmbeddings(\n",
"query_embedding = GoogleGenerativeAIEmbeddings(\n",
" model=\"models/embedding-001\", task_type=\"retrieval_document\"\n",
")\n",
"\n",
Expand All @@ -174,7 +175,7 @@
" es_cloud_id=ELASTIC_CLOUD_ID,\n",
" es_api_key=ELASTIC_API_KEY,\n",
" index_name=elastic_index_name,\n",
" embedding=embedding\n",
" embedding=query_embedding\n",
")"
]
},
Expand All @@ -193,14 +194,14 @@
"metadata": {},
"outputs": [],
"source": [
"embedding = GoogleGenerativeAIEmbeddings(\n",
"query_embedding = GoogleGenerativeAIEmbeddings(\n",
" model=\"models/embedding-001\", task_type=\"retrieval_query\"\n",
")\n",
"\n",
"es = ElasticsearchStore(\n",
" es_cloud_id=ELASTIC_CLOUD_ID,\n",
" es_api_key=ELASTIC_API_KEY,\n",
" embedding=embedding,\n",
" embedding=query_embedding,\n",
" index_name=elastic_index_name\n",
")\n",
"\n",
Expand Down

0 comments on commit 58cb37c

Please sign in to comment.