03. LangChain Hub
Next is LangChain Hub Here is an example of receiving a prompt and executing it.
At the address below LangChain Hub You can check the prompt.
You can get the ID value of the prompt repo by using the method of receiving, and you can also get the prompt for a specific version by attaching the commit id.
Hub from Prompt receive
Copy
from langchain import hub
# Get the latest version of the prompt.
prompt = hub.pull("rlm/rag-prompt")Copy
# Print prompt contents
print(prompt)Copy
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:"))]Copy
# Specify a version hash to get a specific version of the prompt.
prompt = hub.pull("rlm/rag-prompt:50442af1")
promptCopy
Prompt Hub Register your own prompt
Copy
Copy
Copy
Below is the output after successful upload to Hub.
id
output of power: 'https://smith.langchain.com/hub/teddynote/simple-summary-korean/0e296563'
Copy
Copy
Copy
Last updated