在RAG中可能面临的最大问题之一是检索器应该检索什么内容?
实际使用中,检索到的上下文并不完全有用,可能检索处理较大的块中只有非常小的一部分与答案相关,还可能对于一个特定的问题需要来自多个块合并来得到答案。
一、什么是上下文压缩?
我们划分文档块的时候,通常不知道用户的查询,这意味着,与查询最相关的信息可能隐藏在一个包含大量不相关文本的文档中,这样输入给LLM,可能会导致更昂贵的LLM调用和较差的响应。
因此,我们可以对上下文进行压缩,大致思路是:
-
使用某种基本的检索器来检索不同的信息;
-
然后将检索到的信息添加到文档压缩器中;
-
压缩器对这些信息进行过滤和处理,只提取对回答问题有用的信息。
二、上下文压缩中遵循的步骤
- 上下文压缩检索器将查询传递给基础检索器;
- 然后,获取初始文档,并将它们传递给文档压缩器;
- 文档压缩器获取文档列表,并通过减少文档内容或完全删除文档来缩短列表
三、准备工作:
Langchain:支持使用LLM创建应用程序的框架
Llmware BLING模型:大型语言模型(实验)
Chromadb:向量数据库
四、代码实现
4.1 安装所需的依赖项
!pip install -qU langchain huggingface_hub chromadb pypdf python-dotenv transformers sentence-transformers
4.2 导入需要的包
from langchain.llms import HuggingFaceHub
from langchain.document_loaders import PyPDFLoader
from langchain.vectorstores import Chroma
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.embeddings import SentenceTransformerEmbeddings
from langchain.prompts import PromptTemplate
from dotenv import load_dotenv
4.3 设置Huggingafechub token
import os
from getpass import getpass
os.environ["HUGGINGFACEHUB_API_TOKEN"] = getpass("Enter HuggingFace Hub Token:")
4.4 导入数据
loader = PyPDFLoader("/content/CommonInsuranceTerms.pdf")
documents = loader.load()
print(len(documents))
print(documents[0].page_content)
#### RESPONSE ####
16
Glossary of Common Insurance Terms
NOTICE: This document is for informational purposes only and is not in tended to alter or replace the
insurance policy. Additionally, this informational sheet is not intended to fully set out your rights and
obligations or the rights and obligations of the insurance comp any. If you have questions about your insurance,
you should consult your insurance agent, the insurance company, or the language of the insurance policy.
A
Accelerated death benefits - An insurance policy with an accelerated death benefits provi sion will pay -
under certain conditions - all or part of the policy death bene fits while the policyholder is still alive. These
conditions include proof that the policyholder is terminally il l, has a specified life-thr eatening disease or is in a
long-term care facility such as a nursing home. By accepting an accelerated benefit payment, a person could be
ruled ineligible for Medicaid or other government benefits. The proceeds may also be taxable.
Accident - An unforeseen, unintended event.
Accident-only policies - Policies that pay only in cas es arising from an accident or injury.
Accidental death benefits - If a life insurance policy includes an accidental death bene fit, the cause of death
will be examined to determine whether the insured´s death meets the policy´s definition of accidental.
Actual cash value (ACV) - The value of your property, based on the current cost to rep lace it minus
depreciation. Also see "replacement cost."
Additional livin g expenses (ALE) - Reimburses the policyholder for the cost of temporary housin g, food, and
other essential living expenses, if the home is damaged by a co vered peril that makes the home temporarily
uninhabitable.
Adjuster - An individual employed by an insurer to evaluate losses and settle policyholder claims.
Administrative expense charge - An amount deducted, usually monthly, from the policy.
Agent - A person who sells insurance policies. Must be licensed by t he Alabama Department of Insurance to
legally sell and transact insurance business.
Annuitant - A person who receives the payments from an annuity during hi s or her lifetime.
4.5 设置文本切分器
text_splitter = RecursiveCharacterTextSplitter(chunk_size=700,chunk_overlap=70)
split_documents = text_splitter.split_documents(documents)
print(len(split_documents))
print(split_documents[0])
##### RESPONSE #####
65
Document(page_content='Glossary of Common Insurance Terms \nNOTICE: This document is for informational purposes only and is not in tended to alter or replace the \ninsurance policy. Additionally, this informational sheet is not intended to fully set out your rights and \nobligations or the rights and obligations of the insurance comp any. If you have questions about your insurance, \nyou should consult your insurance agent, the insurance company, or the language of the insurance policy. \nA \nAccelerated death benefits - An insurance policy with an accelerated death benefits provi sion will pay - \nunder certain conditions - all or part of the policy death bene fits while the policyholder is still alive. These', metadata={'source': '/content/CommonInsuranceTerms (1).pdf', 'page': 0})
在HuggingFace上使用BLING(无GPU之后的最佳小指令)模型系列
(链接:https://huggingface.co/llmware).
4.6 设置嵌入
industry-bert-insurance-v0.1是经过行业微调的sentence_transformer嵌入模型系列中的一个。
industry-bert-insurance-v0.1是一个基于领域微调bert的768参数句子转换器模型,旨在作为保险行业领域嵌入的“替代品”。该模型是根据保险业的广泛公开文件进行培训的。
embeddings = SentenceTransformerEmbeddings(model_name="llmware/industry-bert-insurance-v0.1")
4.7 设置LLM
bling-shared-llama-1.3b-0.1是BLING(“Best Little Instruction-following No-GPU-required”)模型系列的一部分,在Sheared-LLaMA-1.3B基础模型上经过指令微调获得的。
BLING模型使用蒸馏的高质量自定义指令数据集进行微调,针对指令任务的特定子集,目的是在CPU笔记本电脑上提供高质量的指令模型,即使不使用任何高级量化优化,也能“为推理做好准备”。
BLING模型的具体介绍,可以参考https://colab.research.google.com/corgiredirector?site=https%3A%2F%2Fmedium.com%2F%40darrenoberst%2Fsmall-instruct-following-llms-for-rag-use-case-54c55e4b41a8
repo_id ="llmware/bling-sheared-llama-1.3b-0.1"
llm = HuggingFaceHub(repo_id=repo_id,
model_kwargs={"temperature":0.3,"max_length":500})
4.8 打印文档的助手功能
def pretty_print_docs(docs):
print(f"\n{'-'* 100}\n".join([F"Document{i+1}:\n\n" + d.page_content for i,d in enumerate(docs)]))
4.9 设置矢量存储
vectorstore = Chroma.from_documents(split_documents,
embeddings,
collection_metadata={"hnsw:space":"cosine"},
persist_directory="/content/stores/insurance")
vectorstore.persist()
4.10 设置检索器
retriever = vectorstore.as_retriever(search_kwargs={"k":2})
4.11 获取与查询匹配的相关上下文
docs = retriever.get_relevant_documents(query="What is Group life insurance?")
pretty_print_docs(docs)
##### RESPONSE #####
Document1:
or claim payment. Insurance companies also may have grievance p rocedures.
Group life insurance - This type of life insurance provides coverage to a group of people under one contract.
Most group contracts are sold to businesses that w ant to provid e life insurance for their employees. Group life
insurance can also be sold to associations to cover their membe rs and to lending institutions to cover the
amounts of their debtor loans. Most group policies are for term insurance. Generally, the business will be
issued a master policy and each person in the group will receiv e a certificate of insurance.
Group of companies - Several insurance companies u nder common ownership and often common
management.
----------------------------------------------------------------------------------------------------
Document2:
Most group contracts are sold to businesses that w ant to provid e life insurance for their employees. Group life
insurance can also be sold to associations to cover their membe rs and to lending institutions to cover the
amounts of their debtor loans. Most group policies are for term insurance. Generally, the business will be
issued a master policy and each person in the group will receiv e a certificate of insurance.
Group of companies - Several insurance companies u nder common ownership and often common
management.
4.12 使用LLMChainExtractor添加上下文压缩
- 添加LLMChainExtractor以迭代最初返回的文档;
- 仅从每个文档中提取与查询相关的上下文。
from langchain.retrievers import ContextualCompressionRetriever
from langchain.retrievers.document_compressors import LLMChainExtractor
#making the compressor
compressor = LLMChainExtractor.from_llm(llm=llm)
#compressor retriver = base retriever + compressor
compression_retriever = ContextualCompressionRetriever(base_retriever=retriever,
base_compressor=compressor)
默认压缩器提示
print(compressor.llm_chain.prompt.template)
###### RESPONSE #######
Given the following question and context, extract any part of the context *AS IS* that is relevant to answer the question. If none of the context is relevant return NO_OUTPUT.
Remember, *DO NOT* edit the extracted parts of the context.
> Question: {question}
> Context:
>>>
{context}
>>>
Extracted relevant parts:
4.13 向上下文压缩添加过滤器
使用LLMChainFilter选择要传递给LLM的查询
#
from getpass import getpass
import os
from langchain.embeddings import OpenAIEmbeddings
from langchain.retrievers.document_compressors import EmbeddingsFilter
#
os.environ["OPENAI_API_KEY "] = getpass()
#
embdeddings_filter = EmbeddingsFilter(embeddings=embeddings)
compression_retriever_filter = ContextualCompressionRetriever(base_retriever=retriever,
base_compressor=embdeddings_filter)
#
compressed_docs = compression_retriever_filter.get_relevant_documents(query="What is Group Life Insurance?")
pretty_print_docs(compressed_docs)
##### RESPOSNE ######
Document1:
or claim payment. Insurance companies also may have grievance p rocedures.
Group life insurance - This type of life insurance provides coverage to a group of people under one contract.
Most group contracts are sold to businesses that w ant to provid e life insurance for their employees. Group life
insurance can also be sold to associations to cover their membe rs and to lending institutions to cover the
amounts of their debtor loans. Most group policies are for term insurance. Generally, the business will be
issued a master policy and each person in the group will receiv e a certificate of insurance.
Group of companies - Several insurance companies u nder common ownership and often common
management.
----------------------------------------------------------------------------------------------------
Document2:
Most group contracts are sold to businesses that w ant to provid e life insurance for their employees. Group life
insurance can also be sold to associations to cover their membe rs and to lending institutions to cover the
amounts of their debtor loans. Most group policies are for term insurance. Generally, the business will be
issued a master policy and each person in the group will receiv e a certificate of insurance.
Group of companies - Several insurance companies u nder common ownership and often common
management.
使用RetrievalQA链实现问答功能
from langchain.chains import RetrievalQA
qa = RetrievalQA.from_chain_type(llm=llm,
chain_type="stuff",
retriever=compression_retriever_filter,
verbose=True)
#
Ask Question
qa("What is Coinsurance?")
##### RESPONSE #####
> Entering new RetrievalQA chain...
> Finished chain.
{'query': 'What is Coinsurance?',
'result': ' Coinsurance is the percentage of each health care bill a person must pay out of their own pocket. Non-covered charges and deductibles are in addition to this amount. Coinsurance maximum is the most you will have to pay in coinsurance during a policy period (usually a year) before your health plan begins paying 100 percent of the cost of your covered health services. The coinsurance maximum generally does not apply to copayments or other expenses you might be required to pay.\n\nC'}
qa("What is Group Life Insurance?")
###### RESPONSE #######
> Entering new RetrievalQA chain...
> Finished chain.
{'query': 'What is Group Life Insurance?',
'result': ' Group life insurance provides coverage to a group of people under one contract. \nMost group contracts are sold to businesses that w ant to provid e life insurance for their employees. Group life \ninsurance can also be sold to associations to cover their membe rs and to lending institutions to cover the \namounts of their debtor loans. Most group policies are for term insurance. Generally, the business will be \nissued a master policy and each person in the group will receiv e a certificate of insurance. \nGroup of companies - Several insurance companies u nder common ownership and often common \nmanagement'}
五、Pipeline
将压缩器和文档转换器串在一起
embeddings:langchain_core.embeddings.Embeddings[必需]用于嵌入文档内容和查询的嵌入。
k:可选[int]=20要返回的相关文档数。可以设置为“无”,在这种情况下,必须指定similarity_threshold。默认值为20。
similarity_fn:Callable=用于比较文档的相似性函数。函数期望将两个矩阵(List[List[foat]])作为输入,并返回一个分数矩阵,其中值越高表示相似性越大。
similarity_threshold:可选[foat]=无用于确定两个文档何时相似到足以被视为冗余的阈值。如果k设置为“无”,则必须指定默认值“无”。
在这里,我们创建了一个由冗余过滤器+相关过滤器组成的管道,其中冗余过滤器过滤掉重复的上下文,相关过滤器仅提取相关上下文。
EmbeddingsRedundantFilter:我们可以识别类似的文档并过滤掉冗余;
EmbeddingsFilter:通过嵌入文档和查询并只返回那些与查询具有足够相似嵌入的文档,提供了一种更便宜、更快的选择。
from langchain.document_transformers import EmbeddingsRedundantFilter
from langchain.retrievers.document_compressors import DocumentCompressorPipeline
#
redundant_filter = EmbeddingsRedundantFilter(embeddings=embeddings)
relevant_filter = EmbeddingsFilter(embeddings=embeddings,k=5)
#making the pipeline
pipeline_compressor = DocumentCompressorPipeline(transformers=[redundant_filter,relevant_filter])
# compressor retriever
compression_retriever_pipeline = ContextualCompressionRetriever(base_retriever=retriever,
base_compressor=pipeline_compressor)
## print the prompt
print(compression_retriever_pipeline)
## Get relevant documents
compressed_docs = compression_retriever_pipeline.get_relevant_documents(query="What is Coinsurance?")
pretty_print_docs(compressed_docs)
##### RESPOSNE #####
Document1:
Claimant - A person who makes an insurance claim.
Coinsurance - The percentage of each health care bill a person must pay ou t of their own pocket. Non-covered
charges and deductibles are in addition to this amount.
Coinsurance maximum - The most you will have to pay in coinsurance during a policy period (usually a
year) before your health plan begins paying 100 percent of the cost of your covered health services. The
coinsurance maximum generally does not apply to copayments or o ther expenses you might be required to pay.
Collision coverage - Pays for damage to a car with out regard to who caused an acc ident. The company must
compressed_docs = compression_retriever_pipeline.get_relevant_documents(query="What is Earned premium?")
pretty_print_docs(compressed_docs)
##### RESPOSNE #####
Document1:
replacement cost or the actual cash value, which includes depre ciation.
Replacement cost - Insurance coverage that pays the dollar amount needed to rep lace the structure or
damaged personal property without deducting for depreciation bu t limited by the policy's maximum dollar
amount.
Rescission - The termination of an insurance contract by the insurer when material misrepresentation has
occurred.
Return premium - A portion of the premium returned to a policy owner as a res ult of cancelation, rate
adjustment, or a calculation that an advance premium was in exc ess of the actual premium.
compressed_docs = compression_retriever_pipeline.get_relevant_documents(query="What is Group Insurance Policy?")
pretty_print_docs(compressed_docs)
##### RESPONSE #######
5.1 使用llmware/bling-sheared-llama-1.3b-0.1模型实现问答功能
该模型用于生成短文本作为回复,主要有助于聊天机器人类型的应用程序,在这些应用程序中,我们不需要更长的回复。此外,与顶级Zephyr-beta-7b或Openai相比,这种LLM不会产生有效的响应,仅用于实验目的。使用正确的LLM可以增强生成的响应的正确性。
llmware模型的提示格式,如下所示:
from langchain.prompts import PromptTemplate
template ="""
<human>:
Context:{context}
Question:{question}
Use the above Context to answer the user's question.Consider only the Context provided above to formulate response.If the Question asked does not match with the Context provided just say 'I do not know thw answer'.
<bot>:
"""
prompt = PromptTemplate(input_variables=["context","question"],template=template)
chain_type_kwargs = {"prompt":prompt}
print(prompt)
####
from langchain.chains import RetrievalQA
qa = RetrievalQA.from_chain_type(llm=llm,
chain_type="stuff",
retriever=compression_retriever_pipeline,
chain_type_kwargs=chain_type_kwargs,
return_source_documents=True,
verbose=True)
#
qa("What is Group Insurance Policy?")
###### RESPONSE ############
> Entering new RetrievalQA chain...
> Finished chain.
{'query': 'What is Group Insurance Policy?',
'result': '<bot>: Group insurance policy is a policy that covers the life of a group of people. \nIt is usually sold to businesses that want to provide life insurance for their employees. \nIt can also be sold to associations to cover their members and to lending institutions to cover the amount of their debtor loans. \nMost group policies are for term insurance.<|endoftext|> Хронологија Хронологија Хронологија Хронологија Хронологија instanceof instanceof instanceof instanceof instanceof Хронологија Хронологија instanceof instanceof instanceof instanceofbolds Хронологија Narodowecka Narodowecka Narodowecka Narodowecka<|endoftext|><|endoftext|>bolds<|endoftext|>boldstrightarrow</boldsightarrow <|endoftext|></trightarrow',
'source_documents': [_DocumentWithState(page_content='Most group contracts are sold to businesses that w ant to provid e life insurance for their employees. Group life \ninsurance can also be sold to associations to cover their membe rs and to lending institutions to cover the \namounts of their debtor loans. Most group policies are for term insurance. Generally, the business will be \nissued a master policy and each person in the group will receiv e a certificate of insurance. \nGroup of companies - Several insurance companies u nder common ownership and often common \nmanagement.', metadata={'page': 5, 'source': '/content/CommonInsuranceTerms (1).pdf'}, state={'embedded_doc': [0.21783578395843506, 0.10463877022266388, -0.027319835498929024, -0.3879217505455017, 0.40784013271331787, 0.26043280959129333, -0.37868937849998474, -0.254645437002182, -0.36403888463974, 0.3492107689380646, 0.10714895278215408, -0.052755843847990036, 0.559119462966919, -0.20670485496520996, -0.4170210361480713, -0.3751305639743805, -0.3942665755748749, 0.2242078185081482, -0.49813032150268555, 0.1591452807188034, -0.01432145107537508, 0.2629348039627075, 0.48010149598121643, 0.0610065758228302, -0.5170305371284485, 0.1577228158712387, 0.15019835531711578, -0.14634855091571808, 0.1911127120256424, 0.19631560146808624, 0.007989645004272461, -0.12203440815210342, 0.0295584537088871, 0.9609478712081909, 0.36264508962631226, 0.12267930805683136, -0.41251665353775024, -0.5747867822647095, -0.6815201044082642, -0.5977113842964172, -0.1646791696548462, 0.043644167482852936, -0.10767503827810287, 0.4202282130718231, -0.38057780265808105, 0.15373700857162476, -0.1633872538805008, -0.5196858048439026, -0.5954501628875732, 0.4661802649497986, -0.2732030153274536, -0.7002604603767395, -0.28221040964126587, 0.07533325999975204, 0.26006460189819336, 0.7522629499435425, 0.15830279886722565, -0.17314359545707703, -0.6729680299758911, -0.07497794181108475, 0.5267223119735718, -0.26419076323509216, 0.582166314125061, 0.22731003165245056, 0.14059534668922424, 0.02978363260626793, -0.12936897575855255, 0.22162167727947235, -1.122382402420044, -0.6005008816719055, 0.05241786688566208, -0.5721805095672607, -0.1765640527009964, -0.02835044264793396, -0.3237879276275635, 0.41785964369773865, -0.7502347826957703, -0.7821120619773865, 0.17632156610488892, -0.46641090512275696, -0.3842225968837738, 0.20439332723617554, 0.23632799088954926, 0.09749750047922134, 0.3926140367984772, 0.0778302550315857, 0.3361283540725708, 0.2885863184928894, -0.08316017687320709, 0.21454621851444244, 0.9313911199569702, -0.0869627445936203, 0.25881028175354004, -0.9496616125106812, -0.28945818543434143, -0.033450789749622345, -0.14204616844654083, -0.17972292006015778, -0.3491593897342682, 0.45174628496170044, -0.22340178489685059, -0.04250018671154976, -0.7062625288963318, -0.2979270815849304, -0.7390782237052917, 0.47520017623901367, -0.3689270317554474, -0.509217381477356, -0.4594042897224426, -0.29932501912117004, -0.5151299834251404, -0.8029249310493469, -0.18796111643314362, -0.09172102808952332, -0.28082534670829773, -0.12337703257799149, 0.08703265339136124, -0.03549240902066231, -0.2671082317829132, -0.2974316477775574, 0.987377941608429, -0.3782009482383728, -0.03969573602080345, -0.3176284432411194, 0.325689435005188, 0.4515145719051361, -0.46877241134643555, -0.19277633726596832, 0.6005716323852539, -0.4626528322696686, -0.04812261462211609, -0.04806538671255112, -0.4767723083496094, 0.3983921706676483, 0.31389760971069336, -0.05108121037483215, -0.18121078610420227, 0.20340566337108612, 0.056255124509334564, -0.686181366443634, -0.07449732720851898, -0.240057572722435, -0.7116295099258423, 0.14149263501167297, -0.33717668056488037, -0.44883400201797485, -0.14813314378261566, 0.1624627262353897, -0.48334914445877075, -0.006546719465404749, -0.49208953976631165, -0.05241096392273903, 0.5086550712585449, 0.2886364758014679, 0.24938209354877472, -0.009770411998033524, 1.0269724130630493, -0.14296866953372955, 0.23133036494255066, -0.17183949053287506, 0.4204169511795044, -0.08990412205457687, 0.2425605207681656, -0.10113474726676941, -0.05845043808221817, -0.05262190103530884, 0.04109350964426994, 0.3923689126968384, -0.08317427337169647, -0.17933960258960724, -0.44270235300064087, 0.31715625524520874, -0.009307295083999634, -0.7871733903884888, 0.34448114037513733, -0.002340037142857909, -0.2707415223121643, 0.20058420300483704, 0.5633580684661865, 0.30409976840019226, -0.5107570886611938, 0.18152332305908203, 0.28443172574043274, 0.013815316371619701, 0.05333905294537544, -0.09156403690576553, -0.4553470313549042, 0.22235266864299774, 1.1522736549377441, -0.25313329696655273, -0.6144576072692871, 0.44685783982276917, 0.16413071751594543, -0.43104833364486694, -0.7498937249183655, -0.25669118762016296, 0.0868728831410408, 0.06570754945278168, -0.534331738948822, -0.9251134395599365, -0.25223612785339355, 0.12770812213420868, -0.8970874547958374, -0.2686857581138611, -0.005932816304266453, -0.05327504873275757, -0.01307414285838604, 0.2195081114768982, -0.4072721600532532, 0.12476940453052521, 0.5862574577331543, 0.2765903174877167, -0.08557205647230148, -0.4393638074398041, 0.25040480494499207, -0.2974768877029419, -0.542156994342804, 0.5483883619308472, 0.12206105887889862, 0.006237310357391834, 0.3543449342250824, 0.039204563945531845, -0.09390680491924286, 0.1523706465959549, 0.3600161373615265, -0.09808499366044998, -0.3951420783996582, -0.19272445142269135, 1.1402968168258667, 0.7769405245780945, 0.8353460431098938, -0.3183906376361847, 0.790770947933197, -1.0143980979919434, 0.6031673550605774, 0.35854822397232056, -1.547791600227356, -0.980204701423645, -0.18255454301834106, -0.43283554911613464, 0.4610993266105652, 0.09896128624677658, -0.14432387053966522, -0.2509567141532898, 0.4376463294029236, 0.3292214274406433, -0.5002442598342896, -0.45684394240379333, -0.28609704971313477, 0.3554660975933075, 0.34623923897743225, -0.05307651683688164, 0.043452147394418716, -0.2357947826385498, -0.12976448237895966, 0.3541392385959625, -0.2726609408855438, 0.30613642930984497, -0.9174660444259644, 0.12482605874538422, -0.007089627906680107, -0.3222849667072296, -0.5660061836242676, 0.3302139937877655, 0.2930227518081665, -0.8047681450843811, -0.07196889072656631, 0.15009132027626038, -0.7410541772842407, -0.4131682813167572, 0.5798733830451965, 0.15825872123241425, -0.23715388774871826, 0.016199259087443352, -0.052957020699977875, 0.013874148949980736, 0.35623273253440857, 0.279319167137146, 0.049530595541000366, 0.3978852927684784, -0.40779343247413635, -0.26608407497406006, 0.05751802772283554, -0.7443807721138, -0.27998289465904236, -0.11587149649858475, -0.5936230421066284, 0.07047465443611145, -0.4890064597129822, 0.37885141372680664, 0.3834211230278015, 0.46199414134025574, -0.25660935044288635, 0.28313976526260376, 0.13206864893436432, -0.3712634742259979, -0.31254178285598755, 0.5788912773132324, -0.32726410031318665, 0.05089356005191803, -0.12430734932422638, -0.45790091156959534, 0.11863510310649872, -0.8232219815254211, 0.05173077806830406, -0.1920519471168518, -0.0034158709459006786, 0.595331072807312, -1.6990983486175537, 0.057145725935697556, -0.17377658188343048, -0.33558934926986694, 0.928251326084137, -0.11298363655805588, 0.790782630443573, 0.4342704713344574, -0.3350726366043091, 0.25634071230888367, 0.8889483213424683, -0.6133720278739929, 0.983489990234375, 0.2374190390110016, -0.003418948734179139, 1.0765244960784912, -0.20035862922668457, 0.3416822850704193, 0.2552470266819, -0.5977320075035095, 0.6664401292800903, -0.7613285183906555, -0.2537737786769867, 1.517917275428772, -0.5312317609786987, -0.031304843723773956, -0.417656272649765, -0.20899994671344757, 0.12083669006824493, 0.29179269075393677, -0.1085294634103775, 0.05905880779027939, -0.012098973616957664, -0.24451285600662231, -0.04684954509139061, -0.4084140658378601, 0.1701914519071579, 0.2534778416156769, -0.39711499214172363, -0.7557406425476074, 0.1760091632604599, 0.37766775488853455, -0.17334306240081787, -0.44937798380851746, -0.09708759188652039, -0.7166780829429626, -0.7905951142311096, 0.6253983974456787, -0.25501054525375366, 0.20294660329818726, 0.21955357491970062, 0.7337481379508972, -0.30455851554870605, 0.2381930649280548, 0.1455274522304535, -0.5771943926811218, -0.1669103056192398, 0.31663253903388977, -0.4308413565158844, 0.4757886528968811, -0.18958431482315063, 0.6911720037460327, 0.10026837140321732, -0.2324410378932953, -0.07478221505880356, -0.0014664145419374108, -0.5945709943771362, -1.0790857076644897, 0.3517889082431793, -0.03997144103050232, 0.3285585045814514, 0.5700239539146423, -0.6501449942588806, 0.013198953121900558, -0.05347135663032532, -0.502619743347168, 1.0110812187194824, 0.22765828669071198, 0.4869440495967865, 0.2857256233692169, 0.6237001419067383, -0.08855936676263809, 0.018401814624667168, -0.18482618033885956, 0.3177608847618103, -0.3192720115184784, -0.3852565884590149, -0.43115144968032837, 0.0652167946100235, -0.4280194044113159, -0.528016209602356, 0.5865989923477173, 0.10417897999286652, 0.49096229672431946, -0.6799116134643555, -0.09338245540857315, -0.34894925355911255, 0.45481064915657043, -0.3530368506908417, -0.5450268387794495, 0.5040327906608582, 0.0820084810256958, 0.1716577261686325, -0.2942940592765808, 0.1082240492105484, 0.09732672572135925, -0.6865535974502563, -0.47108927369117737, -0.23373949527740479, -0.3339654207229614, 0.34148934483528137, -0.3397482633590698, 0.35167035460472107, -1.3161393404006958, -0.01402011327445507, 0.4315713346004486, -0.42076537013053894, 0.4259577691555023, 0.7754375338554382, -0.22011323273181915, 0.17219221591949463, 0.4587591886520386, -0.0006277748034335673, -0.11133839190006256, -0.16283489763736725, 0.048050958663225174, -0.032632842659950256, 0.1387723684310913, 0.2370566427707672, 0.7886346578598022, -0.17639416456222534, 0.007795439101755619, -0.6643574237823486, -0.035631097853183746, 0.2932048738002777, 0.3048216700553894, 0.1794074922800064, 0.5285878777503967, -0.36372607946395874, -0.5801470279693604, 0.07551949471235275, 0.3710553050041199, 0.24194659292697906, -0.14878146350383759, 0.2432529181241989, -0.18847347795963287, 0.27467769384384155, 0.38269537687301636, 0.5030539035797119, 0.4273446500301361, -0.06083297356963158, 0.1735207438468933, -0.2833654284477234, 0.017483962699770927, -0.16166813671588898, -0.2882961928844452, 0.30794239044189453, 0.20231623947620392, 0.26936280727386475, -0.37325531244277954, -0.03196701034903526, -0.05199204757809639, -0.5409088730812073, -0.3059147000312805, 0.031071925535798073, 0.4312458038330078, -0.977335512638092, 0.09835091978311539, 0.022194771096110344, -0.1713145226240158, -0.11622104793787003, 0.18065781891345978, 0.42978066205978394, -0.210694819688797, 0.17432346940040588, 0.4754911959171295, 0.16596215963363647, -0.018490344285964966, -0.2645587623119354, 0.2365439385175705, 0.5545823574066162, 0.3017808794975281, -0.6159490346908569, -0.3181438148021698, -0.5860635042190552, -0.04770706966519356, 0.7894369959831238, 0.16249951720237732, -0.016568973660469055, 0.34128081798553467, 0.6370292901992798, 0.4275519549846649, 0.0666336938738823, 0.03064168430864811, -0.03901436924934387, -0.18220475316047668, -0.5646430253982544, 0.2530827522277832, 0.4908086359500885, -0.15008589625358582, 0.23310358822345734, 0.5712053775787354, 0.23814426362514496, -0.2172020524740219, -0.8484058976173401, -0.29528310894966125, 0.3684464991092682, -0.3271101117134094, 0.2131781131029129, 0.34182366728782654, -0.31802690029144287, 0.18232204020023346, -0.7504274249076843, 0.48854079842567444, 0.6205854415893555, -0.135763481259346, 0.5896173119544983, -0.9582261443138123, 0.0862521156668663, 0.3265172243118286, -0.14598782360553741, -0.35897573828697205, 0.7156641483306885, 0.5189601182937622, 0.030373653396964073, 0.8956475257873535, -0.05747704580426216, 0.17540769279003143, -0.24394568800926208, 0.18187315762043, -0.050804730504751205, -0.08631283789873123, -0.38150593638420105, -0.732428252696991, 0.13982601463794708, 0.12964998185634613, -0.07044766843318939, -0.1612924188375473, 0.30257102847099304, -1.1026636362075806, -0.7020399570465088, -0.1039314940571785, -0.6518645286560059, -0.7291364669799805, 0.29647353291511536, -0.11313732713460922, 0.9839833378791809, -0.5744509696960449, -0.2348841279745102, 0.5144036412239075, -0.08240450173616409, -0.3517054319381714, -0.7072566151618958, 0.38446685671806335, 0.20613375306129456, 0.13966386020183563, -0.6363266110420227, -0.5178614854812622, -0.6504050493240356, -0.14360058307647705, 0.23088490962982178, -0.2525469660758972, 0.13666397333145142, -0.8749172687530518, 0.8336669206619263, -0.206642284989357, 0.17349693179130554, 1.0121021270751953, -0.06297238171100616, -0.5745068192481995, 0.8420031070709229, 0.3471497893333435, 0.6569059491157532, 0.3089483380317688, 0.23016101121902466, -0.24699436128139496, 0.48819032311439514, -0.36335164308547974, -0.8151615262031555, 0.43717020750045776, -0.5564612746238708, -0.5227019786834717, -0.12364932894706726, 0.7064554691314697, 0.3599153757095337, -0.6942704319953918, -1.0012152194976807, -0.3012988567352295, -0.43399351835250854, -0.8295875191688538, 0.21362175047397614, -0.1813954859972, -0.3856522738933563, 0.15341715514659882, -0.1788010448217392, 0.16648881137371063, 0.5715620517730713, -0.4506044089794159, 0.6808747053146362, 0.6585302948951721, 0.8009878993034363, 0.14125041663646698, 0.10505838692188263, -0.25515732169151306, -0.07378001511096954, 0.1782907098531723, -0.28476887941360474, -0.31951555609703064, 0.14674702286720276, -0.058171506971120834, 0.38058343529701233, -0.23235929012298584, 0.1365724802017212, 0.26027360558509827, 0.8763501644134521, -0.3227648138999939, -0.21794426441192627, -0.29844069480895996, 0.05846826732158661, -0.592792809009552, 0.18813380599021912, 0.2648405432701111, 0.09575545787811279, -0.5021328926086426, 0.3212735652923584, 0.07276953756809235, -0.33687785267829895, 0.6065135598182678, -0.2353484034538269, -0.24141500890254974, 0.7475285530090332, 0.22074459493160248, 0.49484196305274963, -0.2489635944366455, -0.18986497819423676, -0.09781947731971741, -0.6455115675926208, 0.1772666573524475, -0.14752241969108582, 0.610270619392395, 0.2912429869174957, -0.2209867238998413, -0.10562791675329208, -0.14533181488513947, -0.1756872832775116, 0.13169191777706146, 0.1754865199327469, 0.15237703919410706, 0.6024501323699951, 0.03276738151907921, 0.37606602907180786, -0.575359582901001, 0.15873059630393982, -0.03508305549621582, 0.44291552901268005, 0.08278601616621017, 0.6158232092857361, 0.2290641814470291, 0.7891141176223755, 0.12543298304080963, -0.1626327782869339, 0.19434978067874908, 0.013551903888583183, 0.09648854285478592, 0.042613834142684937, 0.4392915368080139, 0.6503629684448242, -0.6509594917297363, 0.43647781014442444, 0.13695088028907776, -0.16655465960502625, -0.5835095643997192, -0.13107362389564514, 0.5718779563903809, -0.3257051706314087, -0.23368769884109497, 0.2289603054523468, 0.95149165391922, 0.24525600671768188, -0.3433917164802551, -0.6356520652770996, 0.47370457649230957, -0.0814458355307579, -0.9237103462219238, -0.29753074049949646, 0.21258161962032318, -0.4342353641986847, 0.3621026277542114, 0.5258291363716125, -0.16698460280895233, -0.27364757657051086, -0.18823660910129547, -0.02637982927262783, 0.13718025386333466, 0.3182537853717804, -0.17011919617652893, 0.03651021048426628, 0.2221704125404358, 0.16561616957187653, -0.3657389283180237, -0.07200025767087936, 0.21332019567489624, 0.07016139477491379, -0.5154732465744019, 0.3024892807006836, -0.12607353925704956, 0.1989913433790207, 1.0894614458084106, -0.5888687968254089, -0.06368202716112137, 0.5654868483543396, -0.5745449662208557, 0.13946190476417542, 0.0905844196677208, 0.2379632443189621, 0.10320264846086502, -0.060591500252485275, -0.12399659305810928, -0.702551007270813, 0.22413139045238495, 0.16237257421016693, 0.5381385684013367, 0.7382177710533142, -1.2797447443008423, -0.05186934396624565, -0.010212009772658348, 0.0783885195851326, -0.017146039754152298, 0.04265834763646126, 0.9641693234443665, -0.3220832645893097, -0.023417802527546883, -0.17652040719985962, 0.2793338894844055, -0.12446708232164383, -0.19463680684566498, -0.06646685302257538, 0.499408096075058, -0.2242165058851242, 0.31058067083358765, 0.043713729828596115, -0.20759062469005585, -0.4066656529903412, 0.12747740745544434, 0.8015421032905579, 0.6782150268554688, -0.011955145746469498, 0.3785434067249298, -0.9051803946495056, -0.19147445261478424, 0.3046780526638031, -0.24196714162826538, -0.4364112913608551, -0.06394162029027939, 0.059370845556259155, -0.10004513710737228, 0.41433295607566833, 0.02755933254957199, -0.29557839035987854, 0.8827390670776367], 'query_similarity_score': 0.5921743311683283})]}
response = qa("What is Long-term care benefits?")
print(response['result'].split("<|endoftext|>")[0])
###### RESPONSE ######
Entering new RetrievalQA chain...
> Finished chain.
Long-term care benefits - Coverage that provides help for people when they are unable to care for themselves because of prolonged illness or disability. Benefits are triggered by specific findings of "cognitive impairment" or inability to perform certain actions known as "Activities of Daily Living." Benefits can range from help with daily activities while recuperating at home to skilled nursing care provided in a nursing home.
print(response)
######### RESPONSE #######
{'query': 'What is Long-term care benefits?',
'result': 'Long-term care benefits - Coverage that provides help for people when they are unable to care for themselves because of prolonged illness or disability. Benefits are triggered by specific findings of "cognitive impairment" or inability to perform certain actions known as "Activities of Daily Living." Benefits can range from help with daily activities while recuperating at home to skilled nursing care provided in a nursing home.<|endoftext|> Хронологија Хронологија Хронологија Хронологија instanceof instanceof instanceof instanceof instanceof instanceofboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsboldsbolds',
'source_documents': [_DocumentWithState(page_content='Long-term care benefits - Coverage that provides help f or people when they are unable to care for themselves \nbecause of prolonged illness or disability. Benefits are trigge red by specific findings of "cognitive impairment" \nor inability to perform certain actions known as "Activities of Daily Living." Benefits can range from help \nwith daily activities while recuperating at home to skilled nur sing care provided in a nursing home.', metadata={'page': 7, 'source': '/content/CommonInsuranceTerms (1).pdf'}, state={'embedded_doc': [0.10907948762178421, 0.09334351122379303, 0.41147854924201965, -0.3373779356479645, 0.4558241069316864, 0.5461165308952332, -0.052463024854660034, -0.43229037523269653, -0.06157633662223816, 0.09955484420061111, -0.6033256649971008, -0.05812996253371239, 0.7388888001441956, -0.011550833471119404, -0.5817828178405762, -0.08132432401180267, 0.28581276535987854, 0.19416825473308563, -0.9401135444641113, 0.03855099529027939, 0.05326114594936371, -0.19157925248146057, 0.30139845609664917, -0.2001981884241104, -0.016954798251390457, 0.03628414496779442, -0.1967252641916275, -0.5722499489784241, -0.3008680045604706, -0.3260952830314636, 0.262993186712265, -0.470098614692688, -0.657173752784729, -0.17747528851032257, 0.24151559174060822, 0.9234574437141418, -0.69254070520401, -0.08464174717664719, -0.3340465724468231, -0.6047222018241882, 0.32094576954841614, -0.1526097059249878, -0.7495902180671692, 0.5895340442657471, -0.3574208617210388, 0.2203020453453064, -0.1261795163154602, -0.6283882856369019, -0.41083812713623047, 0.11665202677249908, -0.397600919008255, 0.2272939383983612, -0.2522178292274475, -0.3829920291900635, 0.4645462930202484, 0.5331839323043823, 0.3477323055267334, 0.04714041203260422, -0.4736652970314026, -0.1477040797472, 0.4415145516395569, -0.4949638247489929, -0.08872227370738983, 0.6070473790168762, -0.23882395029067993, -0.44559550285339355, 0.4024362862110138, 0.2050509750843048, -0.19703519344329834, -0.7759589552879333, -0.11332840472459793, 0.32776618003845215, 0.15883003175258636, 0.40614303946495056, 0.08185126632452011, 0.4028942286968231, -0.2512247562408447, -0.9501603245735168, 0.5072576403617859, -0.35161542892456055, 0.13860826194286346, 0.658584713935852, -0.06168732792139053, -0.19090262055397034, 0.36713507771492004, -0.037726011127233505, 0.20432475209236145, -0.10828007757663727, -0.6160633563995361, -0.22857941687107086, 0.7456415891647339, 0.3578374683856964, 0.4652789533138275, 0.3156701624393463, 0.2138253152370453, 0.4960078001022339, 0.19246184825897217, -0.08101008087396622, -0.6329354643821716, -0.07452796399593353, 0.04805383086204529, -0.12457920610904694, -0.7519999146461487, -0.38901206851005554, -0.79539555311203, 0.3383004665374756, 0.39798450469970703, -0.11480624228715897, -0.8019858598709106, -0.3720642030239105, -0.4878183603286743, 0.35700929164886475, -0.3184610605239868, -0.4035087525844574, -0.6954147219657898, -0.4593808650970459, 0.10899876058101654, 0.39027518033981323, -0.7697281837463379, -0.22111760079860687, 0.2900984287261963, -0.2955760061740875, 2.1784446289530024e-05, 0.19633203744888306, 0.09544443339109421, 0.12384844571352005, 0.12302379310131073, -0.17665928602218628, 0.20641393959522247, 0.09080783277750015, -0.18199659883975983, 0.03460434451699257, -0.07469744980335236, -0.010678342543542385, 0.5884369015693665, 0.4332047402858734, -0.45703646540641785, 0.2246074378490448, -0.3252559304237366, -0.07087592035531998, 0.14279088377952576, -0.2428426891565323, -0.25579363107681274, 0.2990875840187073, 0.21847382187843323, -0.39564716815948486, 0.06130816414952278, 0.40928345918655396, 0.12941177189350128, 0.0037728575989603996, -0.07015769928693771, -0.05731089040637016, 0.580315113067627, 0.19915767014026642, -0.5670597553253174, 0.5441313982009888, 0.5660340189933777, -0.23161926865577698, 0.4239357113838196, 0.24184860289096832, 0.12164614349603653, 0.17004872858524323, -0.3096413314342499, 0.06410027295351028, 0.04593750461935997, 0.574717104434967, -0.47396373748779297, 0.003425763687118888, -0.06936503201723099, 0.07727944850921631, -0.6071427464485168, 0.32434165477752686, 0.4797617793083191, -0.4686175286769867, -0.626809298992157, 0.10674016922712326, 0.25631508231163025, 0.2069673240184784, 0.04109294340014458, 0.1351718157529831, -0.32600268721580505, 0.4996649920940399, 0.38282686471939087, -0.08525076508522034, -0.30613723397254944, -0.9495260119438171, 0.22910283505916595, -0.09305156022310257, 0.799835205078125, -0.3705063462257385, -0.4679523706436157, -0.1869903951883316, 0.2738203704357147, -0.32925286889076233, 0.0990452691912651, -0.5092311501502991, -0.5655322074890137, 1.0993092060089111, -0.6324814558029175, -0.4070947468280792, 0.5107800364494324, -0.002014276571571827, -0.13895538449287415, 0.49466654658317566, -0.5468167662620544, 0.14010098576545715, 0.5875201225280762, -0.19082915782928467, -0.5958985090255737, 0.4481925964355469, 0.9267255067825317, 0.9977033734321594, 0.03384319320321083, 0.14941535890102386, 0.4110162556171417, -0.7734233140945435, -0.5971090197563171, -0.041734110563993454, -0.4108515977859497, -0.4035964012145996, 0.035754211246967316, 0.16031812131404877, 0.40234196186065674, 0.6997328996658325, 0.25624123215675354, -0.056515246629714966, 0.12173879146575928, -0.49574920535087585, 0.478677362203598, 0.7306225895881653, 0.11138184368610382, 0.17627112567424774, 0.0012172488495707512, -0.025900840759277344, -0.023532280698418617, -0.07998538017272949, -0.5083470344543457, -0.5033765435218811, -0.3145431876182556, -0.567501962184906, -0.6319019794464111, 0.31060341000556946, 0.30306991934776306, -0.41117823123931885, 0.06751182675361633, -0.15950801968574524, -0.9412462115287781, 0.3070759177207947, -0.12875564396381378, -0.11365331709384918, 0.09897952526807785, 0.49167853593826294, 0.03823516517877579, 0.40243643522262573, 0.08866581320762634, -0.09955485910177231, -0.0253237746655941, -0.023979105055332184, -0.5523959398269653, 0.1966460943222046, -0.006720776204019785, 0.2178710699081421, -0.2698357105255127, -0.5817351341247559, 0.10702050477266312, -0.8907153010368347, -0.022025708109140396, -0.15677016973495483, -0.4033844769001007, -0.19806087017059326, 0.4045587480068207, 0.0032105024438351393, -0.5255259275436401, -0.11542657762765884, -0.28906598687171936, 0.25606605410575867, 0.18009456992149353, 0.20898576080799103, -0.9753332734107971, -0.13219960033893585, 0.1294797956943512, 0.5104493498802185, 0.5030971765518188, 0.4085043966770172, -0.42157647013664246, 0.08689428865909576, -0.4468325078487396, -0.2555355429649353, -0.40494662523269653, -0.09674762189388275, -0.4848102927207947, 0.35335031151771545, 0.39497652649879456, -0.0870426818728447, 0.6123863458633423, 0.21383099257946014, 0.38024669885635376, 0.200572669506073, 0.02694290690124035, 0.19940185546875, -0.1895519495010376, -0.6573799252510071, 0.32975926995277405, -0.1094549149274826, -0.3793436884880066, -0.23128734529018402, 0.12309157103300095, -0.5375639796257019, -2.261465549468994, 0.05790497362613678, -0.28769487142562866, -0.7962443828582764, 0.5128392577171326, -0.2950601279735565, 0.2761809229850769, 0.646932065486908, -0.11068963259458542, 0.1794273853302002, 0.719572901725769, -0.11574001610279083, 0.3211880624294281, 0.3106950521469116, 0.0901968777179718, 0.1697968989610672, 0.028301440179347992, 0.30656370520591736, 0.391410768032074, -0.3796471953392029, 0.5997000932693481, -0.13987934589385986, -0.30726131796836853, 1.2933648824691772, -0.18330435454845428, 0.45826855301856995, 0.07366525381803513, 0.20733408629894257, -0.5806941390037537, -0.6619285345077515, 0.09315024316310883, -0.016599595546722412, 0.19693653285503387, -0.3078309893608093, 0.05279579013586044, 0.2874375581741333, 0.028466984629631042, 0.1552676260471344, 0.33818256855010986, -1.1254041194915771, -0.3005489706993103, -0.6038243770599365, -0.2985612452030182, -0.8660308718681335, -0.20924662053585052, 0.24432595074176788, -0.5141215324401855, 0.641653835773468, 0.580315113067627, 0.2725552022457123, -0.074625663459301, 0.36756083369255066, -0.48820629715919495, 0.6323946714401245, -0.10695197433233261, -0.5794993042945862, -0.2672075629234314, 0.17083032429218292, -0.5442010760307312, -0.14861150085926056, -0.17220032215118408, 0.23947227001190186, -0.17254488170146942, -0.6745831370353699, -0.28243204951286316, 0.1756352335214615, -0.3017086982727051, -0.5838152170181274, 0.2841423451900482, -0.3220946192741394, -0.06870534271001816, 0.18163377046585083, 0.11553268134593964, 0.20449435710906982, 0.31416788697242737, -0.7376593947410583, 0.4472320079803467, 0.24822619557380676, 0.21784080564975739, -0.09934347867965698, 0.1817149817943573, -0.626146137714386, -0.25837740302085876, -0.04329109936952591, 0.36204618215560913, -0.1151452362537384, 0.21060682833194733, 0.22132761776447296, 0.03700690343976021, 0.015459956601262093, -0.11610079556703568, 0.1294504553079605, 0.3234724700450897, 0.6064897179603577, -0.46426549553871155, 0.4459235668182373, -0.374411016702652, 0.34351545572280884, 0.019472487270832062, 0.11506588011980057, 0.2881583273410797, 0.2557489573955536, 0.21771612763404846, -0.6257693767547607, 0.25933218002319336, 0.23123888671398163, -0.7427953481674194, -1.0594977140426636, 0.3144257068634033, -0.6133469939231873, -0.06277753412723541, -0.41911792755126953, 0.27645617723464966, -0.7114976048469543, -0.11845581978559494, -0.21159793436527252, 0.06452678143978119, 0.2951689660549164, 0.4426625370979309, -0.23454782366752625, 0.3148570656776428, 0.08186424523591995, 0.2173895388841629, -0.6918209791183472, 0.3352670967578888, 0.22765301167964935, -0.030277647078037262, -0.2531426250934601, -0.09792660176753998, 0.8599269986152649, 0.3554248511791229, -0.01629527471959591, 0.1551046073436737, 0.6034166216850281, 0.019643381237983704, -0.15255659818649292, 0.5553311705589294, 0.567516028881073, -0.5209398865699768, -0.19298279285430908, 0.04708201065659523, 0.2812715470790863, -0.4524822533130646, -0.5088205933570862, -0.24325722455978394, -0.40626242756843567, -0.2912992835044861, 0.38916030526161194, -0.29493269324302673, 0.5540202260017395, 0.042254846543073654, 0.02622286044061184, 0.0965702086687088, 0.1565677523612976, -0.22201333940029144, -0.09435815364122391, 0.13091367483139038, 0.0567874051630497, 0.0989551767706871, -0.5884701013565063, -0.8338319659233093, -0.031589750200510025, -0.4166322946548462, 0.05705544352531433, -0.09997864067554474, -0.735483705997467, -0.3146181106567383, -0.21401290595531464, -0.12116804718971252, 0.21880057454109192, 0.19626501202583313, 0.3276503086090088, 0.02117353305220604, 0.27071794867515564, 0.11427954584360123, 0.2739105224609375, -0.05382683873176575, 0.021349946036934853, -0.051151618361473083, 0.2563599646091461, 0.5678591728210449, 0.0957617461681366, 0.08818946033716202, -0.4697977304458618, 0.21301503479480743, -0.05863157659769058, 0.3772016763687134, -0.24138225615024567, -0.5581235289573669, -0.3784738779067993, 0.5665472149848938, -0.007843822240829468, -0.6268869638442993, -0.15399955213069916, 0.39660122990608215, 0.6006290912628174, -0.5143842101097107, 0.5368052124977112, 0.5586428642272949, 0.0345350056886673, -0.018566209822893143, 0.27068525552749634, -0.08186187595129013, -0.4620005786418915, -0.5284944772720337, -0.8938740491867065, -0.6653187870979309, 0.005489598959684372, -0.22503040730953217, 0.6338440179824829, -0.9568642377853394, 0.6616470813751221, 0.5829275846481323, 0.4241217076778412, 0.5951422452926636, -0.5651006102561951, 0.05089600011706352, -0.3537271320819855, -0.5960178971290588, 0.4358043968677521, 0.23833517730236053, -0.4274164140224457, 0.4998909831047058, 0.23495638370513916, 0.22919447720050812, -0.8612216711044312, -0.18736906349658966, -0.36249637603759766, -0.17442014813423157, 0.13521672785282135, 0.12464889883995056, -0.5168071985244751, 0.10113853961229324, -0.2588582932949066, 0.8367279171943665, 0.31320393085479736, 0.34247246384620667, -0.31862056255340576, -0.05119235813617706, -0.8749488592147827, -0.1359437108039856, 0.9297613501548767, -0.5101664662361145, -0.7233741879463196, 0.09954150766134262, 0.5851739645004272, 0.5886233448982239, -0.41244229674339294, -0.13946612179279327, 0.6124616861343384, 0.05969151854515076, -0.1763128638267517, -0.20537810027599335, -0.15539902448654175, -0.07668129354715347, -0.3551306426525116, -0.5999301075935364, -0.2915007174015045, 0.05069851502776146, -0.1133483350276947, 0.6545805335044861, -0.4671948552131653, 0.24591466784477234, 0.02631795033812523, 0.9746196269989014, -0.021781817078590393, 0.31483572721481323, 0.4756436049938202, -0.551589846611023, -0.4918369948863983, 0.30332908034324646, 0.3448091745376587, 0.4773135483264923, -0.09870782494544983, 0.22911164164543152, 0.016194764524698257, 0.4687541425228119, -0.09181924164295197, 0.1842852383852005, 0.04857799783349037, 0.3593370318412781, -0.007932877168059349, -0.48929259181022644, -0.0865965262055397, 0.6322574615478516, -0.6125563383102417, 0.4453260898590088, 0.11857433617115021, 0.22832363843917847, 0.002072039758786559, 0.5256844758987427, 0.30476751923561096, -0.5036064982414246, -0.02394229732453823, -0.1370326429605484, 0.07109333574771881, -0.18717245757579803, 0.5639048218727112, 0.05084177851676941, -0.15823352336883545, -0.27223753929138184, -0.30147647857666016, -0.24361394345760345, -0.08496124297380447, -0.2190847545862198, 0.052154239267110825, 0.4230267107486725, -0.6019347906112671, -0.16763310134410858, 0.4980359375476837, 0.013655366376042366, 0.33085259795188904, 0.883290708065033, 0.5883936882019043, 0.8082475662231445, -0.3686199486255646, -0.6350985169410706, -0.1260705292224884, 0.490948349237442, -0.2803007960319519, -0.6562740206718445, 0.2865334153175354, 0.23654618859291077, -0.26160362362861633, -0.25853070616722107, 0.4946604073047638, -0.022277681156992912, 0.30246973037719727, -0.16986064612865448, 0.6425139904022217, 0.548353910446167, 0.6048057675361633, 0.7951720356941223, -0.27602463960647583, 0.3448272943496704, -0.15388435125350952, -0.6005330085754395, 0.7638341784477234, -0.03290456533432007, 0.6272891163825989, 0.5187875032424927, -0.010863631963729858, 0.4878891110420227, 0.020060362294316292, 0.17616738379001617, 0.7245548963546753, -0.1779630333185196, 0.5087037682533264, 1.2199318408966064, -0.6440112590789795, 1.020115852355957, -0.419354110956192, 0.6090922951698303, 0.23343777656555176, 0.19706811010837555, -0.8137414455413818, 0.35769787430763245, 0.20975042879581451, 0.3157339096069336, -0.07431856542825699, -0.22262999415397644, -0.3063686490058899, -0.047637928277254105, -0.3929992616176605, 0.15687425434589386, -0.8701956272125244, 0.7487511038780212, -0.5923663377761841, 0.6205081939697266, 0.22844107449054718, -0.17924238741397858, 0.07659229636192322, -0.7592214941978455, 0.3012658655643463, 0.2310100793838501, -0.6434577703475952, 0.42688047885894775, 0.08739840239286423, -0.16300421953201294, -0.16975706815719604, 0.17360498011112213, -0.29246434569358826, -0.2875669300556183, -0.3983762860298157, -0.6585322618484497, 0.019136162474751472, -0.2974485158920288, -0.08271200209856033, 0.2655351161956787, -0.12481988221406937, 0.37800049781799316, 0.589569628238678, -0.354716032743454, -0.17237284779548645, 0.21459326148033142, 0.07043398916721344, -0.062373217195272446, -0.27313727140426636, 0.3722855746746063, -0.5173431038856506, -0.4658626914024353, 0.48100796341896057, 0.5999765396118164, -0.3408212959766388, 0.06618748605251312, 0.014351066201925278, 0.48182934522628784, 0.40944865345954895, -0.11439855396747589, -0.4024728536605835, 0.31067803502082825, 0.39546701312065125, -0.03151373192667961, 0.8199816346168518, 0.40267857909202576, -0.13207252323627472, 0.10928304493427277, -0.3605475127696991, -0.7143439650535583, -0.11345469206571579, 0.3318668603897095, 0.45255446434020996, -0.15625178813934326, -1.1568183898925781, -0.03945741429924965, 0.02969040349125862, -0.1787007451057434, -0.05844397097826004, 0.15201111137866974, 0.450216144323349, -0.45299965143203735, -0.17168763279914856, -0.556495189666748, -0.02248801849782467, -0.5210766792297363, -0.11515979468822479, -0.010244982317090034, 0.13026829063892365, -0.19284497201442719, -0.07784481346607208, -0.47857773303985596, -0.6317622661590576, 0.1879263073205948, 0.14564211666584015, 1.169722557067871, 0.29147303104400635, -0.023428982123732567, -0.3566648066043854, -0.9764299988746643, -0.6187826991081238, -0.28487440943717957, -0.04400945082306862, 0.12993864715099335, 0.10278826206922531, -0.3340747654438019, 0.02115345373749733, -0.7229974269866943, 0.07934501022100449, -1.2799934148788452, -0.006999789737164974], 'query_similarity_score': 0.6116580581049508}),
_DocumentWithState(page_content='because of prolonged illness or disability. Benefits are trigge red by specific findings of "cognitive impairment" \nor inability to perform certain actions known as "Activities of Daily Living." Benefits can range from help \nwith daily activities while recuperating at home to skilled nur sing care provided in a nursing home.', metadata={'page': 7, 'source': '/content/CommonInsuranceTerms (1).pdf'}, state={'embedded_doc': [0.2193884253501892, 0.3908122181892395, 0.014659926295280457, -0.2731555104255676, 0.2924192249774933, 0.6941999793052673, 0.2676321566104889, -0.45316028594970703, -0.018273770809173584, 0.05401374399662018, -0.4481824040412903, -0.008003979921340942, 0.7279651165008545, -0.04766766354441643, -0.6827098727226257, -0.015044593252241611, 0.2702178359031677, 0.08200348913669586, -0.7752257585525513, 0.1627918928861618, -0.1658470332622528, -0.08786451816558838, 0.37876030802726746, -0.1350564956665039, -0.04351965710520744, 0.20903447270393372, -0.15911629796028137, -0.5303157567977905, -0.6168208718299866, -0.2684033215045929, 0.20239365100860596, -0.4092490077018738, -0.5102187395095825, -0.3398668169975281, 0.28586262464523315, 1.106691598892212, -0.9471217393875122, -0.15222565829753876, -0.368566632270813, -0.7360549569129944, 0.28113868832588196, -0.10019402205944061, -0.7644250988960266, 0.6835099458694458, -0.48190534114837646, 0.21570643782615662, -0.10195398330688477, -0.5162968039512634, -0.3623170852661133, 0.09370441734790802, -0.4474703371524811, 0.34813523292541504, -0.2777668535709381, -0.40281182527542114, 0.27631646394729614, 0.24668726325035095, 0.3393619954586029, 0.0987878292798996, -0.419761598110199, -0.2017296701669693, 0.44702303409576416, -0.2860894799232483, -0.25642532110214233, 0.567924439907074, -0.19429807364940643, -0.4329822361469269, 0.25965988636016846, 0.30519112944602966, -0.05256837606430054, -0.5772772431373596, -0.18239378929138184, 0.46779853105545044, 0.19478386640548706, 0.5314598083496094, 0.13618634641170502, 0.17752903699874878, -0.1034158244729042, -0.8173288702964783, 0.45216917991638184, -0.23065567016601562, 0.2842618227005005, 0.49469029903411865, 0.09012221544981003, -0.39938104152679443, 0.41468092799186707, -0.28339841961860657, 0.12733909487724304, 0.011289635673165321, -0.5216336250305176, -0.3154539167881012, 0.8393841981887817, 0.36501315236091614, 0.5232728719711304, 0.3828745484352112, 0.18492618203163147, 0.26257234811782837, 0.24250991642475128, -0.40223047137260437, -0.5462386608123779, -0.40256038308143616, 0.0769626796245575, -0.013792164623737335, -0.7471505403518677, -0.1273033618927002, -0.4669405221939087, 0.24164342880249023, 0.36773622035980225, -0.3610617518424988, -0.6864724159240723, -0.16935738921165466, -0.48022475838661194, 0.40671905875205994, -0.2759598195552826, -0.43549633026123047, -0.4305894672870636, -0.19946952164173126, -0.06885430216789246, 0.3783891201019287, -0.7405132055282593, -0.15887826681137085, 0.32393741607666016, -0.19103333353996277, 0.010289343073964119, 0.15676239132881165, 0.08278143405914307, 0.06345229595899582, 0.2905561923980713, -0.2516886591911316, 0.23728808760643005, 0.03597124665975571, -0.17920438945293427, 0.04353823512792587, 0.20143716037273407, -0.1332230269908905, 0.35480913519859314, 0.3988170623779297, -0.18412117660045624, 0.08463989198207855, -0.38776472210884094, -0.06306519359350204, 0.08481098711490631, -0.21361874043941498, -0.026858516037464142, 0.22132182121276855, 0.20580321550369263, -0.3140231966972351, -0.0021371841430664062, 0.5395749807357788, 0.12519678473472595, -0.09527318179607391, -0.13590267300605774, 0.010704129934310913, 0.4684719741344452, 0.22927692532539368, -0.6284525394439697, 0.5514839887619019, 0.218111053109169, -0.22043165564537048, 0.34234270453453064, 0.10208302736282349, 0.12348006665706635, 0.3521674871444702, -0.34707874059677124, -0.02241421863436699, 0.12596935033798218, 0.4222204387187958, -0.3671586513519287, -0.11885079741477966, -0.2570928931236267, 0.07832422107458115, -0.6496263742446899, 0.26412826776504517, 0.27899667620658875, -0.4338622987270355, -0.38253605365753174, -0.087319016456604, 0.15993279218673706, 0.2471959888935089, 0.08082517236471176, -0.019113248214125633, -0.37448519468307495, 0.23653000593185425, 0.28599974513053894, 0.01871442049741745, -0.11525174230337143, -1.1248044967651367, 0.37606722116470337, -0.16871590912342072, 0.5943719148635864, 0.010564535856246948, -0.5484557151794434, -0.07514195889234543, 0.3949778079986572, -0.09772134572267532, 0.2917274236679077, -0.399183988571167, -0.6421394348144531, 0.9868571162223816, -0.5993456840515137, -0.570274829864502, 0.3788154721260071, -0.17136912047863007, -0.24163949489593506, 0.34856855869293213, -0.5737506747245789, 0.12828154861927032, 0.61058109998703, -0.15330301225185394, -0.767735481262207, 0.43423229455947876, 0.9450867176055908, 0.7112085819244385, 0.0691056028008461, -0.05560117959976196, 0.3702581524848938, -0.7298845052719116, -0.6521339416503906, -0.14342784881591797, -0.5214464664459229, -0.46512311697006226, 0.12716460227966309, 0.16928617656230927, 0.5144426822662354, 0.7327369451522827, 0.4970833659172058, -0.06523801386356354, 0.16577351093292236, -0.5219371318817139, 0.35376623272895813, 0.6822333335876465, -0.06870058178901672, 0.06060415878891945, 0.12432561069726944, 0.05324872210621834, 0.05425896495580673, 0.16638199985027313, -0.5865827202796936, -0.6471412777900696, -0.15241746604442596, -0.6818460822105408, -0.9699697494506836, 0.2931005358695984, 0.05861284211277962, -0.1755959689617157, 0.06871628761291504, 0.02112138271331787, -0.9219495058059692, 0.48142027854919434, -0.22603125870227814, -0.152261883020401, 0.07811082899570465, 0.6692151427268982, 0.2008189707994461, 0.47584617137908936, 0.022600730881094933, -0.1718250960111618, -0.16412168741226196, -0.09107980877161026, -0.4513181447982788, 0.11686982959508896, 0.006704734638333321, 0.3340015411376953, -0.24559587240219116, -0.748616635799408, 0.1338908076286316, -0.6035271883010864, 0.1152309998869896, -0.18237867951393127, -0.22310413420200348, -0.22564762830734253, 0.2699607312679291, -0.06022341549396515, -0.528788149356842, 0.011105921119451523, -0.3836842477321625, 0.20675909519195557, 0.1588987559080124, 0.20037740468978882, -0.844610333442688, -0.159576416015625, -0.0504671111702919, 0.5536388754844666, 0.29338833689689636, 0.3925369381904602, -0.42606261372566223, 0.259382039308548, -0.6374734044075012, -0.4363082945346832, -0.2509567439556122, -0.24445143342018127, -0.48906034231185913, 0.5736587047576904, 0.5054682493209839, -0.0299326591193676, 0.5101001858711243, -0.019759858027100563, 0.2850671410560608, 0.15091165900230408, 0.10754881054162979, 0.37364014983177185, 0.05686622112989426, -0.4157055616378784, 0.29411348700523376, 0.09882701933383942, -0.4007287323474884, -0.26046356558799744, -0.014354873448610306, -0.6341993808746338, -2.684927225112915, -0.16521309316158295, -0.2703540325164795, -0.8613380193710327, 0.6015597581863403, -0.13233256340026855, 0.24209284782409668, 0.6361083388328552, -0.036354728043079376, 0.32172659039497375, 0.5027911067008972, -0.0740344375371933, 0.34061121940612793, 0.2258864939212799, 0.16613030433654785, -0.007927139289677143, 0.17620542645454407, 0.3425922989845276, 0.3007764220237732, 0.01295134425163269, 0.3908184766769409, 0.061775293201208115, -0.15814058482646942, 1.3244690895080566, -0.4067690968513489, 0.44827190041542053, -0.09165877103805542, 0.4231360852718353, -0.590307354927063, -0.5436550378799438, 0.012453638017177582, 0.13079211115837097, 0.058254558593034744, -0.46608975529670715, 0.14776015281677246, 0.4364144802093506, -0.14334732294082642, 0.04832717403769493, 0.5930283069610596, -0.9078553915023804, -0.3133758306503296, -0.5699066519737244, -0.18574607372283936, -0.8941177725791931, -0.22416365146636963, 0.3619208335876465, -0.3265751600265503, 0.6579235792160034, 0.45588889718055725, 0.25942692160606384, 0.0762069970369339, 0.23053400218486786, -0.3776574730873108, 0.3761180639266968, -0.026317700743675232, -0.8167495727539062, -0.14726173877716064, 0.09368348121643066, -0.6182403564453125, -0.3662835359573364, -0.35054636001586914, 0.211525559425354, -0.24176985025405884, -0.7840330004692078, -0.3533706068992615, 0.2990064024925232, -0.20792627334594727, -0.5996066927909851, 0.26038819551467896, -0.2134280502796173, 0.0373661145567894, 0.09757615625858307, 0.24771767854690552, 0.06648720800876617, 0.38550445437431335, -0.5480560064315796, 0.20179617404937744, 0.21095652878284454, 0.11559602618217468, -0.16606859862804413, 0.08764602243900299, -0.6573432087898254, -0.09669697284698486, 0.15252619981765747, 0.2539594769477844, -0.16075128316879272, 0.15330840647220612, 0.3799152970314026, -0.1776067167520523, 0.1540319174528122, -0.03589416295289993, 0.056465938687324524, 0.2008306086063385, 0.4247511327266693, -0.28896766901016235, 0.38416945934295654, -0.1679437756538391, 0.3415641188621521, 0.021589189767837524, 0.26555511355400085, 0.4455723762512207, 0.19067823886871338, 0.15411314368247986, -0.4272231459617615, 0.30207937955856323, 0.3132404386997223, -0.6289409399032593, -1.069490909576416, 0.5110175609588623, -0.6080659627914429, -0.23486071825027466, -0.23741449415683746, 0.025132663547992706, -0.3958384394645691, 0.04078703001141548, -0.08007846772670746, 0.04514874517917633, 0.1415279507637024, 0.3149605393409729, -0.07865404337644577, 0.28826624155044556, 0.15242145955562592, 0.22917607426643372, -0.6096600294113159, 0.4281330704689026, 0.17180760204792023, -0.10800057649612427, -0.12701813876628876, -0.1812429577112198, 0.8582826852798462, 0.5061352252960205, -0.2407764494419098, -0.036963000893592834, 0.6459016799926758, -0.07581363618373871, -0.04768798127770424, 0.46759194135665894, 0.48056095838546753, -0.4362761974334717, -0.14212289452552795, -0.08673302829265594, 0.17749036848545074, -0.2802857756614685, -0.553390622138977, 0.04800284281373024, -0.4163849949836731, -0.4767226576805115, 0.28032386302948, -0.2945268452167511, 0.4819358289241791, 0.125809445977211, -0.11776585131883621, 0.016519621014595032, 0.34232768416404724, -0.2248079478740692, -0.033999718725681305, -0.007028285413980484, -0.025915175676345825, 0.23754164576530457, -0.391964852809906, -0.7830071449279785, -0.32573896646499634, -0.362790048122406, -0.09147005528211594, -0.2608557939529419, -0.5621524453163147, -0.029389485716819763, -0.30541232228279114, 0.10354825854301453, 0.10546722263097763, 0.07068414986133575, 0.3726062476634979, -0.0682499036192894, 0.10657580196857452, 0.1984010636806488, 0.06881164014339447, -0.286653608083725, -0.002682030200958252, 0.07787609100341797, 0.25900155305862427, 0.6302428841590881, 0.07104441523551941, 0.13914337754249573, -0.5890231132507324, 0.22513820230960846, -0.1693606972694397, 0.2241380214691162, -0.4312587380409241, -0.3400232791900635, -0.4170229434967041, 0.4087445139884949, -0.020606087520718575, -0.5004996061325073, -0.1346728652715683, 0.3185281753540039, 0.5409054160118103, -0.3052191734313965, 0.7368395328521729, 0.49290287494659424, 0.1327415406703949, -0.00490950420498848, 0.008411353453993797, -0.17954279482364655, -0.36029431223869324, -0.28633826971054077, -0.8283531665802002, -0.9208195805549622, 0.25051552057266235, -0.4776310622692108, 0.4862040877342224, -0.7345131039619446, 0.3807260990142822, 0.5053955316543579, 0.17215491831302643, 0.33488962054252625, -0.5454192161560059, -0.06409318745136261, -0.5154524445533752, -0.4141390025615692, 0.4915083944797516, 0.11943076550960541, -0.19526360929012299, 0.41698694229125977, 0.20889395475387573, 0.3562581241130829, -1.2597675323486328, 0.033189788460731506, -0.04412730410695076, -0.23673748970031738, -0.12047868967056274, 0.27628302574157715, -0.3053485155105591, 0.18141141533851624, -0.38453853130340576, 0.7945141792297363, 0.04233550280332565, 0.44117504358291626, -0.13274936378002167, -0.00944945216178894, -0.6382404565811157, -0.3088441491127014, 1.0204167366027832, -0.27308622002601624, -0.8050994873046875, 0.05678647384047508, 0.5385438203811646, 0.5347966551780701, -0.3642653226852417, -0.09928549826145172, 0.548844039440155, 0.07982286810874939, -0.058944523334503174, -0.26523134112358093, -0.09034308791160583, -0.12366653978824615, -0.37282347679138184, -0.43140101432800293, -0.3085618317127228, 0.14164426922798157, -0.06652868539094925, 0.7691174745559692, -0.3616046905517578, 0.26798945665359497, 0.08688780665397644, 0.7575887441635132, -0.17560043931007385, 0.1407911330461502, 0.247697651386261, -0.3904416561126709, -0.7808475494384766, 0.45888063311576843, 0.3264986276626587, 0.3525293171405792, 0.06813531368970871, 0.21949107944965363, 0.1386776864528656, 0.18456020951271057, 0.052682653069496155, 0.23044823110103607, 0.03460612893104553, 0.6707700490951538, 0.04716452956199646, -0.25586533546447754, -0.10020595788955688, 0.8903213739395142, -0.591785192489624, 0.4237919747829437, -0.21707214415073395, 0.33769237995147705, 0.09573332965373993, 0.5782889723777771, 0.38010701537132263, -0.5176101922988892, 0.04194266349077225, -0.3427567183971405, 0.18352165818214417, -0.366313099861145, 0.4165894687175751, 0.20558872818946838, -0.24965693056583405, -0.30917641520500183, -0.2236580103635788, -0.007641788572072983, 0.05872965604066849, -0.3595973253250122, 0.1545814424753189, 0.5189881920814514, -0.5115823149681091, -0.36467811465263367, 0.455582857131958, 0.027371078729629517, 0.5582659244537354, 0.8588123321533203, 0.484575092792511, 0.6470087766647339, -0.38406744599342346, -0.2648293375968933, -0.05276331305503845, 0.25433456897735596, -0.04331495612859726, -0.5327877998352051, 0.2340642511844635, 0.24813508987426758, -0.27046629786491394, -0.43594926595687866, 0.6422742009162903, -0.062094833701848984, 0.18188977241516113, -0.198991596698761, 0.637186586856842, 0.5316801071166992, 0.5810015797615051, 0.8506116271018982, -0.23887476325035095, 0.4985502362251282, -0.07434383779764175, -0.3013273775577545, 0.8615474700927734, -0.1584022045135498, 0.5398062467575073, 0.430544912815094, 0.14421476423740387, 0.3741549253463745, 0.14749117195606232, 0.3073047995567322, 0.594481348991394, -0.21793389320373535, 0.4516022801399231, 0.8899713158607483, -0.4478192627429962, 0.9825029373168945, -0.4053840637207031, 0.40114110708236694, 0.5476564168930054, 0.08962206542491913, -0.796219527721405, 0.3285098969936371, 0.15689703822135925, 0.014194751158356667, 0.060532111674547195, -0.09430944919586182, -0.47927963733673096, 0.027758434414863586, -0.38194459676742554, 0.13367044925689697, -0.700977087020874, 0.8474724292755127, -0.6372162699699402, 0.5034271478652954, 0.16758348047733307, -0.25306394696235657, -0.023485735058784485, -0.8030679821968079, 0.3025083541870117, 0.4815047085285187, -0.738666832447052, 0.7122687697410583, 0.04854373633861542, -0.20120342075824738, -0.027083417400717735, 0.34148505330085754, -0.2766411304473877, -0.39404216408729553, -0.629302978515625, -0.5410318374633789, 0.2766475975513458, -0.4202314615249634, -0.07123791426420212, 0.12365033477544785, -0.09609048068523407, 0.3419469892978668, 0.8986278772354126, -0.3764117360115051, 0.05266506224870682, 0.02827625721693039, -0.024957161396741867, 0.12269195169210434, -0.22993551194667816, 0.3027823567390442, -0.6329483985900879, -0.33818769454956055, 0.5059642791748047, 0.3716769516468048, -0.07892219722270966, -0.06807789206504822, 0.10608503967523575, 0.30060893297195435, 0.29107746481895447, -0.10257986932992935, -0.27487316727638245, 0.22315707802772522, 0.3244820833206177, -0.005972595885396004, 0.6567755937576294, 0.5240175127983093, -0.13563945889472961, 0.1252886801958084, -0.49351170659065247, -0.7527686953544617, -0.1885468065738678, 0.3683585226535797, 0.4025290012359619, -0.24303658306598663, -1.0597684383392334, -0.10950867831707001, 0.06575780361890793, -0.07686899602413177, -0.2095910906791687, 0.08595190197229385, 0.19548025727272034, -0.4626709222793579, -0.16790366172790527, -0.4083884358406067, -0.028002548962831497, -0.46097028255462646, -0.06348057836294174, 0.09288773685693741, 0.24355649948120117, 0.014441099017858505, -0.16064004600048065, -0.51854407787323, -0.6001731157302856, 0.21660731732845306, 0.031298816204071045, 0.8995707035064697, 0.33247408270835876, 0.0323009230196476, -0.33297884464263916, -0.855561375617981, -0.6020331978797913, -0.4133726954460144, 0.13149243593215942, -0.20236220955848694, 0.3687146008014679, -0.08876236528158188, -0.2355964183807373, -0.7732605934143066, 0.13224034011363983, -1.1086665391921997, -0.11192735284566879], 'query_similarity_score': 0.5300057624305469})]}
5.2 创建新管道
新的Pipeline=压缩机+冗余过滤器+相关过滤器
compressor:LLMChainExtractor,它将迭代最初返回的文档,并从每个文档中仅提取与查询相关的内容。
#
compressor = LLMChainExtractor.from_llm(llm=OpenAI(temperature=0.3,openai_api_key=api_key))
#
new_pipeline = DocumentCompressorPipeline(transformers=[compressor,redundant_filter,relevant_filter])
new_compression_retriever = ContextualCompressionRetriever(base_retriever=retriever,
base_compressor=new_pipeline)
compressed_docs = new_compression_retriever.get_relevant_documents(query="What is Coinsurance?")
pretty_print_docs(compressed_docs)
###### RESPONSE ##########
Document1:
Coinsurance - The percentage of each health care bill a person must pay out of their own pocket. Coinsurance maximum - The most you will have to pay in coinsurance during a policy period (usually a year) before your health plan begins paying 100 percent of the cost of your covered health services.
实现问答链
from langchain.chains import RetrievalQA
qa = RetrievalQA.from_chain_type(llm=llm,
chain_type="stuff",
retriever=new_compression_retriever,
chain_type_kwargs=chain_type_kwargs,
return_source_documents=True,
verbose=True)
#
response = qa("What is Coinsurance?")
print(response['result'].split("<|endoftext|>")[0])
##### RESPONSE #######
Finished chain.
No, Coinsurance is the percentage of each health care bill a person must pay out of their own pocket.
六、结论
总之,应对文档存储系统中检索的挑战需要一种深思熟虑的方法来提高效率和响应能力。在数据接收过程中,特定查询的固有不确定性往往会导致文档中包含不相关的信息。这反过来又会导致在使用大型语言模型时成本增加和响应不理想。上下文压缩的概念是这个问题的一个有价值的解决方案。通过使用基本检索器来收集各种信息,然后使用文档压缩器,系统可以过滤和处理数据,只保留有效响应用户查询所需的相关细节。这种方法不仅优化了资源的使用,而且有助于全面提高系统性能和用户体验。
参考文献:
[1] https://medium.aiplanet.com/implement-contextual-compression-and-filtering-in-rag-pipeline-4e9d4a92aa8f?gi=62283e44f70c&source=email-c63e4493b83d-1704307828713-digest.reader-edbc285dc84a-4e9d4a92aa8f----10-98------------------fdc06c81_5ca8_4867_b1e0_aa632ce3289c-1