03. LangChain Hub
Hub from Prompt receive
from langchain import hub
# Get the latest version of the prompt.
prompt = hub.pull("rlm/rag-prompt")# Print prompt contents
print(prompt)input_variables=['context', 'question'] metadata={'lc_hub_owner': 'rlm', 'lc_hub_repo': 'rag-prompt', 'lc_hub_commit_hash': '50442af133e61576e74536c6556cefe1fac147cad032f4377b60c436e6cdcb6e'} messages=[HumanMessagePromptTemplate(prompt=PromptTemplate(input_variables=['context', 'question'], template="You are an assistant for question-answering tasks. Use the following pieces of retrieved context to answer the question. If you don't know the answer, just say that you don't know. Use three sentences maximum and keep the answer concise.\nQuestion: {question} \nContext: {context} \nAnswer:"))]# Specify a version hash to get a specific version of the prompt.
prompt = hub.pull("rlm/rag-prompt:50442af1")
promptChatPromptTemplate(input_variables=['context', 'question'], metadata={'lc_hub_owner': 'rlm', 'lc_hub_repo': 'rag-prompt', 'lc_hub_commit_hash': '50442af133e61576e74536c6556cefe1fac147cad032f4377b60c436e6cdcb6e'}, messages=[HumanMessagePromptTemplate(prompt=PromptTemplate(input_variables=['context', 'question'], template="You are an assistant for question-answering tasks. Use the following pieces of retrieved context to answer the question. If you don't know the answer, just say that you don't know. Use three sentences maximum and keep the answer concise.\nQuestion: {question} \nContext: {context} \nAnswer:"))])Prompt Hub Register your own prompt
from langchain.prompts import ChatPromptTemplate
prompt = ChatPromptTemplate.from_template(
"Summarize the following sentences based on the given content. Your answer must be written in Korean: {context}\n\nSUMMARY:"
)
promptLast updated