mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-15 12:02:11 +00:00
…tch]: import models from community ran ```bash git grep -l 'from langchain\.chat_models' | xargs -L 1 sed -i '' "s/from\ langchain\.chat_models/from\ langchain_community.chat_models/g" git grep -l 'from langchain\.llms' | xargs -L 1 sed -i '' "s/from\ langchain\.llms/from\ langchain_community.llms/g" git grep -l 'from langchain\.embeddings' | xargs -L 1 sed -i '' "s/from\ langchain\.embeddings/from\ langchain_community.embeddings/g" git checkout master libs/langchain/tests/unit_tests/llms git checkout master libs/langchain/tests/unit_tests/chat_models git checkout master libs/langchain/tests/unit_tests/embeddings/test_imports.py make format cd libs/langchain; make format cd ../experimental; make format cd ../core; make format ```
50 lines
1.2 KiB
Plaintext
50 lines
1.2 KiB
Plaintext
# PromptLayer
|
|
|
|
>[PromptLayer](https://docs.promptlayer.com/introduction) is a platform for prompt engineering.
|
|
> It also helps with the LLM observability to visualize requests, version prompts, and track usage.
|
|
>
|
|
>While `PromptLayer` does have LLMs that integrate directly with LangChain (e.g.
|
|
> [`PromptLayerOpenAI`](https://docs.promptlayer.com/languages/langchain)),
|
|
> using a callback is the recommended way to integrate `PromptLayer` with LangChain.
|
|
|
|
## Installation and Setup
|
|
|
|
To work with `PromptLayer`, we have to:
|
|
- Create a `PromptLayer` account
|
|
- Create an api token and set it as an environment variable (`PROMPTLAYER_API_KEY`)
|
|
|
|
Install a Python package:
|
|
|
|
```bash
|
|
pip install promptlayer
|
|
```
|
|
|
|
|
|
## Callback
|
|
|
|
See a [usage example](/docs/integrations/callbacks/promptlayer).
|
|
|
|
```python
|
|
import promptlayer # Don't forget this import!
|
|
from langchain.callbacks import PromptLayerCallbackHandler
|
|
```
|
|
|
|
|
|
## LLM
|
|
|
|
See a [usage example](/docs/integrations/llms/promptlayer_openai).
|
|
|
|
```python
|
|
from langchain_community.llms import PromptLayerOpenAI
|
|
```
|
|
|
|
|
|
## Chat Models
|
|
|
|
See a [usage example](/docs/integrations/chat/promptlayer_chatopenai).
|
|
|
|
```python
|
|
from langchain_community.chat_models import PromptLayerChatOpenAI
|
|
```
|
|
|