What it is
Personalized prompts are your own custom PromptTemplate or FewShotPromptTemplate that you design for a specific task or workflow. Uploading them to LangChain Hub makes them shareable and reusable across projects or with others.
Why it exists
Instead of rewriting the same prompts for every project, you can store them centrally and reuse them. Hub also allows collaboration, versioning, and quick access to tested prompts. It saves time and ensures consistency.
Real-world analogy
Think of it like creating your own recipe card. You tweak a cake recipe to perfection and then share it in a community cookbook so others can use it exactly the same way.
Minimal beginner example
import osfrom dotenv import load_dotenvfrom langchain_core.prompts import PromptTemplatefrom langchain_core.hub import HubWriterload_dotenv()api_key = os.getenv("GEMINI_API_KEY")# Step 1: Create a personalized promptmy_prompt =PromptTemplate(template="Summarize the following text in 2 sentences:\n{text}",input_variables=["text"])# Step 2: Upload it to LangChain Hubhub_writer =HubWriter(api_key=api_key)hub_writer.upload_prompt(prompt=my_prompt,name="two_sentence_summary",description="Summarizes any text into two concise sentences.")print("Prompt uploaded successfully!")
Once uploaded, you or your team can load this prompt from Hub in any project.
Small LangChain workflow
Design a custom prompt (PromptTemplate or FewShotPromptTemplate).
Test it locally with your LLM.
Upload it to Hub with HubWriter.
Load it in other projects or share with teammates.
Integrate it into chains or agents like any other prompt.
Common beginner mistakes
Forgetting to test the prompt locally before uploading.
Uploading without proper description—others won’t know its purpose.
Using private API keys in uploaded templates (keep keys local).
When to use this vs alternatives
Use personalized prompts + Hub if you want reuse, sharing, or standardization.
Use local prompts if it’s a one-time or private project.
Hub is not for storing large datasets or models—just prompts and chains.