Using PromptLayer with LangChain

By
Jared Zoneraich
February 1, 2023
Prompting
Using PromptLayer with LangChain


EDIT: The following is a deprecated way to use PromptLayer with LangChain. For more updated instructions, go to
https://docs.promptlayer.com

We're super excited to announce a brand new integration with LangChain, a popular Python library aimed at helping in the development of LLM applications. LangChain provides a ton of helpful features such as chains, agents, and memory.

Using PromptLayer with LangChain is easy.


Load API Keys 🔑

To get the party started, load your API keys just like you normally would.


Just change one import 🧙‍♂️

Now, instead of importing OpenAI from langchain.llms, grab it from promptlayer.langchain.llms.

Here's an example:

# from langchain.llms import OpenAIfrom promptlayer.langchain.llms import OpenAIllm = OpenAI(temperature=0.4, pl_tags=["langchain_test"])# Do some magicprint(llm("My name is"))

view rawlangchain_pl.py hosted with ❤ by GitHub


Results 🎉

The results can be viewed on our dashboard at www.promptlayer.com. With this integration, you'll be able to take advantage of LangChain's features and supercharge your development speed.

That's it! Happy prompting.

PromptLayer is available now 🍰 We would love to hear your feedback and feature requests. Say hi anytime at hello@magniv.io 👋

Learn more on our docs.

Jared Zoneraich
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin consequat lorem et enim fringilla, eget molestie nisi tempor. Vestibulum vel facilisis dolor.

The first platform built for prompt engineering