Archived
This project has been archived by its maintainers, and is no longer receiving any updates.
langchain-predictionguard
This page covers how to use the Prediction Guard ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific Prediction Guard wrappers.
Installation and Setup
- Install the PredictionGuard Langchain partner package:
pip install langchain-predictionguard
- Get a Prediction Guard API key (as described here) and set it as an environment variable (
PREDICTIONGUARD_API_KEY)
Prediction Guard Langchain Integrations
| API | Description | Endpoint Docs | Import | Example Usage |
|---|---|---|---|---|
| Chat | Build Chat Bots | Chat | from langchain_predictionguard import ChatPredictionGuard |
ChatPredictionGuard.ipynb |
| Completions | Generate Text | Completions | from langchain_predictionguard import PredictionGuard |
PredictionGuard.ipynb |
| Text Embedding | Embed String to Vectores | Embeddings | from langchain_predictionguard import PredictionGuardEmbeddings |
PredictionGuardEmbeddings.ipynb |
Getting Started
Chat Models
Prediction Guard Chat
See a usage example
from langchain_predictionguard import ChatPredictionGuard
Usage
# If predictionguard_api_key is not passed, default behavior is to use the `PREDICTIONGUARD_API_KEY` environment variable.
chat = ChatPredictionGuard(model="Hermes-3-Llama-3.1-8B")
chat.invoke("Tell me a joke")
Embedding Models
Prediction Guard Embeddings
See a usage example
from langchain_predictionguard import PredictionGuardEmbeddings
Usage
# If predictionguard_api_key is not passed, default behavior is to use the `PREDICTIONGUARD_API_KEY` environment variable.
embeddings = PredictionGuardEmbeddings(model="bridgetower-large-itm-mlm-itc")
text = "This is an embedding example."
output = embeddings.embed_query(text)
LLMs
Prediction Guard LLM
See a usage example
from langchain_predictionguard import PredictionGuard
Usage
# If predictionguard_api_key is not passed, default behavior is to use the `PREDICTIONGUARD_API_KEY` environment variable.
llm = PredictionGuard(model="Hermes-2-Pro-Llama-3-8B")
llm.invoke("Tell me a joke about bears")
Metadata
Release files for langchain-predictionguard 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| langchain_predictionguard-0.1.1.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_predictionguard-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.9 kB
Release files / langchain_predictionguard-0.1.1.tar.gz
| Download URL | langchain_predictionguard-0.1.1.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a80decadbc1ff258dcdd2327ca3ad488d2721160901cf2325e66834ef692c8fd
|
|
BLAKE2b-256 checksum How to use checksums |
6b200a0c9b446b83a47e8c2a4a88fe9f80198c7488aa50b75bd154328910f9bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.5 CPython/3.12.3 Linux/6.8.0-49-generic
|
Release files / langchain_predictionguard-0.1.1-py3-none-any.whl
| Download URL | langchain_predictionguard-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
835495f30486736040c92828162ea28260e935ade4ddaa03e3da4d6feed0f288
|
|
BLAKE2b-256 checksum How to use checksums |
a112a1ddc8cb9424591ca5be9d9845e2e7bf2f472e1435746194c62676e1cae5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.5 CPython/3.12.3 Linux/6.8.0-49-generic
|