Announcing LangChain Hub

Announcing LangChain Hub

6 min read

Today, we're excited to launch LangChain Hub–a home for uploading, browsing, pulling, and managing your prompts. (Soon, we'll be adding other artifacts like chains and agents).

LangChain Hub is built into LangSmith (more on that below) so there are 2 ways to start exploring LangChain Hub.

  • With LangSmith access: Full read and write permissions. You can explore all existing prompts and upload your own by logging in and navigate to the Hub from your admin panel.
  • Without LangSmith access: Read only permissions. You can view and download and run prompts. Head directly to https://smith.langchain.com/hub to start exploring.

If you would like to upload a prompt but don't have access to LangSmith fill out this form and we will expedite your access so you can start publishing your prompts.

Motivation for LangChain Hub

We launched a very early version of LangChain Hub at the beginning of the year as a directory of code and README's with the same goal we have today–make it easier to share and discover prompts for any use-case.

As LangChain and the broader ecosystem has evolved, the role of prompting has only become more important to the LLM development process. As Ethan Mollick recently wrote in a (FANTASTIC) article on the topic, "now is the time for grimoires." By "grimoires" he means "prompt libraries that encode the expertise of their best practices into forms that anyone can use."

We whole-heartedly agree–the value of a Hub extends beyond individual applications. It's about advancing our collective wisdom and translating that into knowledge we can all put to use now. We want to help make this easier on an individual, team, and organization scale, across any use-case and every industry.

Our goal for LangChain Hub is that it becomes the go-to place for developers to discover new use cases and polished prompts.

Today, polished prompts and the wisdom that comes with it are distributed across the web and all-too-often buried in the crannies of blog posts, Twitter threads, and people's head's. By bringing all tis knowledge together in one easily-navigable place, we think we can accelerate the pace of development and learning together.

To use Mollick's terminology–we're starting with public grimoires today, but we'll be enabling private, company-specific grimoires very soon.

So why now? A few new insights emerged over the past months that motivated us to rebuild the hub properly.

  1. Model Variety and Non-Transferable Prompts

People aren't just using OpenAI anymore. Anthropic with claude-2 has become the go-to choice for people needing long context windows. Google is releasing (and will release) more powerful models. And, most excitingly, the open source model community is catching up and Llama2 proving to be a viable alternative.

Unfortunately, prompts don't simply transfer from one model to another. Each model may have different tricks that work best for that model (e.g. claude-2 prefers XML encoding when prompting) or different syntax (e.g. SYS and INST for Llama2).

As developers explore the wide variety of models, we hope the LangChain Hub can assist in that exploration by providing starter prompts for those models. We've added tags to prompts to indicate which model(s) they work best with.

2. Inspectability

Prompts power the chains and agents in LangChain. Often times, the prompts are obfuscated away. We built LangChain Hub in a way that puts them front and center, so that anyone can see what's going on under the hood.

3. Cross-Team Collaboration

While most LLM applications require substantial engineering work to set up, we've noticed that non-technical team members are participating in the process of editing and refining prompts. We wanted to make it much easier for more team members to get involved in what we believe is going to become a core part of every company's app development process. Along these lines, we don't believe that prompts should be treated as traditional code–it's simply not the best way to facilitate this kind of collaboration.

We're aiming to make LangChain Hub the best place for teams to write and manage prompts, together. The product isn't quite there today–this first iteration only supports personal accounts–but we're actively looking for organizations that are excited to explore an Alpha with us so if you want organizational support for the Hub, please reach out to us directly at support@langchain.dev with the subject [Hub: Orgs]

4. Artifact Management and LangSmith

From partnering with early LangSmith users, the tie-in between debugging, logging, testing, and evaluation and artifact management has become increasingly obvious. By making LangChain Hub a part of LangSmith, we knew we could help teams not only identify and collaborate on prompts, but also make informed decisions about how to implement them. Testing integrations with prompts aren't out yet but they are coming soon!

Favorite Features

Home Page

We want to make discoverability and navigability as easy as possible. You should be able to go from curiosity to coding in just a few clicks.

You can view sort prompts by:

  • Most favorites
  • Most viewed
  • Most downloaded
  • Recently uploaded

You can filter prompts by:

  • Use cases (chatbots, extraction, summarization, etc)
  • Type (prompt template, etc)
  • Language (English, Chinese, etc)
  • Model (OpenAI, Anthropic, Llama2, VertexAI, etc)

Downloading and Uploading Prompts

We have released an SDK to enable easy programatic downloading of prompts:

from langchain import hub

prompt = hub.pull("hwchase17/eli5-solar-system")

You can also easily upload prompts via the SDK

from langchain import hub
from langchain.prompts.chat import ChatPromptTemplate

prompt = ChatPromptTemplate.from_template("tell me a joke about {topic}")

hub.push("<handle>/topic-joke-generator", prompt)

If you want to upload an prompt to the Hub, but don't yet have access to LangSmith, fill out this form and we will expedite your access.

Prompt Versioning

Each time you commit a prompt, it is added as a new commit. This means that you can easily access previous versions of prompts should you want to go back to a previous version.

Playground

All prompts can be opened in the playground by clicking the "Try it" button. This allows you to interact with prompts right from LangChain Hub. It's useful for testing prompts...and it's fun!

Note: You will be required to enter an OpenAI or Anthropic API key in order to run it in the playground. These keys are only stored in your browser are used solely to communicate directly to services.

Editing and Saving

From the playground you can edit a prompt, and then save it by clicking the "Commit" button in the top right corner. You can do this either for your own prompts, or for others (when saving, you will have to create your own repo to save it to). This is exciting because it helps everyone build on top of each other's work!

Coming Soon

  • More Artifact Types: Right now, only prompt templates are supported. We plan to expand support for other types of artifacts like chains and agents.
  • Organization Support: Right now the Hub only works for your personal account. If your organization needs the ability to collaborate on prompts, for now please reach out to us directly at support@langchain.dev with the subject [Hub: Orgs]. We will be rolling this out more widely in a few weeks.
  • Integration with testing: Just as you test code, you should test prompts. We are working on integrating the Hub with our dataset & testing functionality. If you need to test your prompts in the meantime, please check out our LangSmith cookbooks.
  • More social features: Just as you test code, you should test prompts. We are working on integrating the Hub with our dataset and testing functionality. If you need to test your prompts in the meantime, please check out our LangSmith cookbooks.
  • What else? If you have product feedback or ideas for us, we want to hear it! Join us in Discord to share more.

Show us your prompts!

We’ll be rounding up and sharing the most creative, useful, thought-provoking prompts with the community.

So share your prompts, ❤️ your favorites, and tag us when you post your prompts or stumble across ones you like!