|
|
@ -93,7 +93,7 @@
|
|
|
|
"from typing import Dict\n",
|
|
|
|
"from typing import Dict\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"from langchain import PromptTemplate, SagemakerEndpoint\n",
|
|
|
|
"from langchain import PromptTemplate, SagemakerEndpoint\n",
|
|
|
|
"from langchain.llms.sagemaker_endpoint import ContentHandlerBase\n",
|
|
|
|
"from langchain.llms.sagemaker_endpoint import LLMContentHandler\n",
|
|
|
|
"from langchain.chains.question_answering import load_qa_chain\n",
|
|
|
|
"from langchain.chains.question_answering import load_qa_chain\n",
|
|
|
|
"import json\n",
|
|
|
|
"import json\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
@ -110,7 +110,7 @@
|
|
|
|
" template=prompt_template, input_variables=[\"context\", \"question\"]\n",
|
|
|
|
" template=prompt_template, input_variables=[\"context\", \"question\"]\n",
|
|
|
|
")\n",
|
|
|
|
")\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"class ContentHandler(ContentHandlerBase):\n",
|
|
|
|
"class ContentHandler(LLMContentHandler):\n",
|
|
|
|
" content_type = \"application/json\"\n",
|
|
|
|
" content_type = \"application/json\"\n",
|
|
|
|
" accepts = \"application/json\"\n",
|
|
|
|
" accepts = \"application/json\"\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|