new technology like cutting-edge scanners to better detect drug smuggling.          We‚Äôve set up joint patrols with Mexico and Guatemala to catch more human traffickers.LCEL‚ÄãSince retrievers are Runnable's, we can easily compose them with other Runnable objects:from langchain.chat_models import ChatOpenAIfrom langchain.prompts import ChatPromptTemplatefrom langchain.schema import StrOutputParserfrom langchain.schema.runnable import RunnablePassthroughtemplate = """Answer the question based only on the following context:{context}Question: {question}"""prompt = ChatPromptTemplate.from_template(template)model = ChatOpenAI()def format_docs(docs):    return "\n\n".join([d.page_content for d in docs])chain = (    {"context": retriever | format_docs, "question": RunnablePassthrough()}    | prompt    | model    | StrOutputParser())chain.invoke("What did the president say about technology?")    'The president said that technology plays a crucial role in the future and that passing the Bipartisan Innovation Act will make record investments in emerging technologies and American manufacturing. The president also mentioned Intel\'s plans to build a semiconductor "mega site" and increase their investment from $20 billion to $100 billion, which would be one of the biggest investments in manufacturing in American history.'PreviousVector storesNextMultiQueryRetrieverGet startedLCELCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
Head to Integrations for documentation on built-in retriever integrations with 3rd-party tools.
Head to Integrations for documentation on built-in retriever integrations with 3rd-party tools. ->: new technology like cutting-edge scanners to better detect drug smuggling.          We‚Äôve set up joint patrols with Mexico and Guatemala to catch more human traffickers.LCEL‚ÄãSince retrievers are Runnable's, we can easily compose them with other Runnable objects:from langchain.chat_models import ChatOpenAIfrom langchain.prompts import ChatPromptTemplatefrom langchain.schema import StrOutputParserfrom langchain.schema.runnable import RunnablePassthroughtemplate = """Answer the question based only on the following context:{context}Question: {question}"""prompt = ChatPromptTemplate.from_template(template)model = ChatOpenAI()def format_docs(docs):    return "\n\n".join([d.page_content for d in docs])chain = (    {"context": retriever | format_docs, "question": RunnablePassthrough()}    | prompt    | model    | StrOutputParser())chain.invoke("What did the president say about technology?")    'The president said that technology plays a crucial role in the future and that passing the Bipartisan Innovation Act will make record investments in emerging technologies and American manufacturing. The president also mentioned Intel\'s plans to build a semiconductor "mega site" and increase their investment from $20 billion to $100 billion, which would be one of the biggest investments in manufacturing in American history.'PreviousVector storesNextMultiQueryRetrieverGet startedLCELCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.