local LLMS here.Customizing the prompt‚ÄãAs shown above, we can load prompts (e.g., this RAG prompt) from the prompt hub.The prompt can also be easily customized, as shown below.from langchain.prompts import PromptTemplatetemplate = """Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer. Use three sentences maximum and keep the answer as concise as possible. Always say "thanks for asking!" at the end of the answer. {context}Question: {question}Helpful Answer:"""rag_prompt_custom = PromptTemplate.from_template(template)rag_chain = (    {"context": retriever, "question": RunnablePassthrough()}     | rag_prompt_custom     | llm )rag_chain.invoke("What is Task Decomposition?")    AIMessage(content='Task decomposition is the process of breaking down a complicated task into smaller, more manageable subtasks or steps. It can be done using prompts, task-specific instructions, or human inputs. Thanks for asking!')We can use LangSmith to see the trace.PreviousSQLNextRAG over codeUse caseOverviewQuickstartStep 1. LoadGo deeperStep 2. SplitGo deeperStep 3. StoreGo deeperStep 4. RetrieveGo deeperStep 5. GenerateGo deeperCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
Open In Colab
Open In Colab ->: local LLMS here.Customizing the prompt‚ÄãAs shown above, we can load prompts (e.g., this RAG prompt) from the prompt hub.The prompt can also be easily customized, as shown below.from langchain.prompts import PromptTemplatetemplate = """Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer. Use three sentences maximum and keep the answer as concise as possible. Always say "thanks for asking!" at the end of the answer. {context}Question: {question}Helpful Answer:"""rag_prompt_custom = PromptTemplate.from_template(template)rag_chain = (    {"context": retriever, "question": RunnablePassthrough()}     | rag_prompt_custom     | llm )rag_chain.invoke("What is Task Decomposition?")    AIMessage(content='Task decomposition is the process of breaking down a complicated task into smaller, more manageable subtasks or steps. It can be done using prompts, task-specific instructions, or human inputs. Thanks for asking!')We can use LangSmith to see the trace.PreviousSQLNextRAG over codeUse caseOverviewQuickstartStep 1. LoadGo deeperStep 2. SplitGo deeperStep 3. StoreGo deeperStep 4. RetrieveGo deeperStep 5. GenerateGo deeperCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.