harrison/add-usage-readmes
Harrison Chase 1 year ago
commit de40414fea

@ -0,0 +1,20 @@
# LangChainHub
Taking inspiration from Hugging Face Hub, this is collection of all artifacts useful for working with LangChain chains.
To start, this focuses on prompts.
This is intended to be a central place to upload and share prompts.
It is intended to be very community driven and we hope that people will contribute their own prompts.
Please see below for instructions on loading and uploading prompts.
## Loading
All prompts can be loaded from LangChain by specifying the desired path.
The path should be relative to the `prompts` folder here.
For example, if there is a file at `prompts/qa/basic.py`, the path you want to specify is `qa/basic.py`
Once you have that path, you can load it in the following manner:
```python
from langchain.prompts import load_from_hub
prompt = load_from_hub("qa/basic.py")
```

@ -0,0 +1,10 @@
from langchain.prompts import PromptTemplate
prompt_template = """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.
{context}
Question: {question}
Helpful Answer:"""
PROMPT = PromptTemplate(
template=prompt_template, input_variables=["context", "question"]
)
Loading…
Cancel
Save