Skip to main content
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.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-predictionguard 0.2.1
File Size Uploaded
langchain_predictionguard-0.2.1.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-predictionguard 0.2.1
File Interpreter ABI Platform
langchain_predictionguard-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.5 kB

Release files / langchain_predictionguard-0.2.1.tar.gz

Download URL langchain_predictionguard-0.2.1.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8e4a0dea423ad32daaecb4aa900320365ec3c0898d8844d0a5143fea4bbae2d4
BLAKE2b-256 checksum
How to use checksums
5f211d65b0d19c216ec8ce9306f620ec74e7cd4ae5916a4b96fb46e613877b83
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.1-py3-none-any.whl

Download URL langchain_predictionguard-0.2.1-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba3e61b668fab6ddc7a1f4fb0b4f3c448e12d6016ba8ac4ecec76b03c10dfc66
BLAKE2b-256 checksum
How to use checksums
fbcfa6e7348398a6f6941fcf1937f431a676438cb7c396dfe5233c0f79b9ced0
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
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page