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.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langchain_predictionguard-0.2.0.tar.gz | 8.1 kB | Without provenance | Details for langchain_predictionguard-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_predictionguard-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for langchain_predictionguard-0.2.0-py3-none-any.whl |
Total release size: 19.5 kB
Release files / langchain_predictionguard-0.2.0.tar.gz
| Download URL | langchain_predictionguard-0.2.0.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
486418f594523203a394d9f99df5c67fba7e402eb6ef6731f3784a8074ca7b5f
|
|
BLAKE2b-256 checksum How to use checksums |
b75f75005c76e88f44cfefaadaeded8e5dfee211b97891a715f313890cd94a22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.13.3 Darwin/24.4.0
|
Release files / langchain_predictionguard-0.2.0-py3-none-any.whl
| Download URL | langchain_predictionguard-0.2.0-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e1a498153eaf050cbf487fcbf1fb9624dc2e5e92ba97943589734cafdb1b3d05
|
|
BLAKE2b-256 checksum How to use checksums |
2af144c3a69045b2873a9e0031915172bd8c6dc3a17b8c032b76a5d5416565b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.13.3 Darwin/24.4.0
|
Security for langchain-predictionguard 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.