The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
langchain hub docs (#704)
Harrison Chasefc4ad2db0ff9
diff --git a/docs/index.rst b/docs/index.rstindex 124e1153f9..21aa8ef9a3 100644--- a/docs/index.rst+++ b/docs/index.rst@@ -137,6 +137,8 @@ Additional ResourcesAdditional collection of resources we think may be useful as you develop your application!+- `LangChainHub <https://github.com/hwchase17/langchain-hub>`_: The LangChainHub is a place to share and explore other prompts, chains, and agents.+- `Glossary <./glossary.html>`_: A glossary of all related terms, papers, methods, etc. Whether implemented in LangChain or not!- `Gallery <./gallery.html>`_: A collection of our favorite projects that use LangChain. Useful for finding inspiration or seeing how things were done in other applications.@@ -152,6 +154,7 @@ Additional collection of resources we think may be useful as you develop your ap:name: resources:hidden:+ LangChainHub <https://github.com/hwchase17/langchain-hub>./glossary.md./gallery.rst./deployments.mddiff --git a/docs/modules/prompts/getting_started.md b/docs/modules/prompts/getting_started.mdindex 0330e7c89b..3093e3f8a8 100644--- a/docs/modules/prompts/getting_started.md+++ b/docs/modules/prompts/getting_started.md@@ -80,6 +80,20 @@ Currently, the template should be formatted as a Python f-string. We also suppor:::+## Load a prompt template from LangChainHub++LangChainHub contains a collection of prompts which can be loaded directly via LangChain.+++```python+from langchain.prompts import load_prompt++prompt = load_prompt("lc://prompts/conversation/prompt.json")+prompt.format(history="", input="What is 1 + 1?")+```++You can read more about LangChainHub and the prompts available with it [here](https://github.com/hwchase17/langchain-hub).+## Pass few shot examples to a prompt templateFew shot examples are a set of examples that can be used to help the language model generate a better response.diff --git a/langchain/prompts/loading.py b/langchain/prompts/loading.pyindex e25afb7afb..57b03a46f9 100644--- a/langchain/prompts/loading.py+++ b/langchain/prompts/loading.py@@ -1,6 +1,7 @@"""Load prompts from disk."""import importlibimport json+import osimport tempfilefrom pathlib import Pathfrom typing import Union@@ -98,7 +99,7 @@ def _load_prompt(config: dict) -> PromptTemplate:def load_prompt(path: Union[str, Path]) -> BasePromptTemplate:"""Unified method for loading a prompt from LangChainHub or local fs."""if isinstance(path, str) and path.startswith("lc://prompts"):- path = path.lstrip("lc://prompts/")+ path = os.path.relpath("lc://prompts/conversation/prompt.json", "lc://prompts/")return _load_from_hub(path)else:return _load_prompt_from_file(path)