Prediction Guard is a secure, scalable GenAI platform that safeguards sensitive data, prevents common AI malfunctions, and runs on affordable hardware.
Overview
Integration details
This integration utilizes the Prediction Guard API, which includes various safeguards and security features.Model features
The models supported by this integration only feature text-generation currently, along with the input and output checks described here.Setup
To access Prediction Guard models, contact us here to get a Prediction Guard API key and get started.Credentials
Once you have a key, you can set it withInstallation
Install the Prediction Guard LangChain integration withInstantiation
Invocation
Streaming
Tool Calling
Prediction Guard has a tool calling API that lets you describe tools and their arguments, which enables the model to return a JSON object with a tool to call and the inputs to that tool. Tool-calling is very useful for building tool-using chains and agents, and for getting structured outputs from models more generally.ChatPredictionGuard.bind_tools()
UsingChatPredictionGuard.bind_tools(), you can pass in Pydantic classes, dict schemas, and LangChain tools as tools to the model, which are then reformatted to allow for use by the model.
AIMessage.tool_calls
Notice that the AIMessage has a tool_calls attribute. This contains in a standardized ToolCall format that is model-provider agnostic.Process Input
With Prediction Guard, you can guard your model inputs for PII or prompt injections using one of our input checks. See the Prediction Guard docs for more information.PII
Prompt Injection
Output Validation
With Prediction Guard, you can check validate the model outputs using factuality to guard against hallucinations and incorrect info, and toxicity to guard against toxic responses (e.g. profanity, hate speech). See the Prediction Guard docs for more information.Toxicity
Factuality
Chaining
API reference
For detailed documentation of all ChatPredictionGuard features and configurations, check out the API reference: python.langchain.com/api_reference/community/chat_models/langchain_community.chat_models.predictionguard.ChatPredictionGuard.htmlConnect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.