Metadata-Version: 2.4
Name: langchain-predictionguard
Version: 0.4.0
Summary: [DEPRECATED] Prediction Guard LangChain integration. No longer maintained; use langchain-openai or langchain-anthropic instead.
Project-URL: Homepage, https://predictionguard.com
Project-URL: Documentation, https://docs.langchain.com/oss/python/integrations/providers/predictionguard
Project-URL: Repository, https://github.com/predictionguard/langchain-predictionguard.git
Project-URL: Issues, https://github.com/predictionguard/langchain-predictionguard/issues
Author-email: Jacob Mansdorfer <jacob@predictionguard.com>
License: The MIT License (MIT)
        
        Copyright (c) 2022 Daniel Whitenack
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in
        all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
        THE SOFTWARE.
License-File: LICENSE
Classifier: Development Status :: 7 - Inactive
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.12
Requires-Dist: langchain-core<2,>=1.5.3
Requires-Dist: predictionguard<3,>=2.11.2
Requires-Dist: requests<3,>=2.34.2
Provides-Extra: dev
Requires-Dist: pytest==9.1.1; extra == 'dev'
Requires-Dist: ruff==0.16.1; extra == 'dev'
Description-Content-Type: text/markdown

# langchain-predictionguard

> [!WARNING]
> **This package is deprecated and no longer maintained.** Some features are broken or missing, and no further updates will be released. Existing releases remain installable from PyPI, but you should migrate to `langchain-openai` or `langchain-anthropic` as described below.

## Migrating

The Prediction Guard API is compatible with both OpenAI-style and Anthropic-style clients, so the standard LangChain integrations work with it directly. Use whichever matches the functionality you need, pointed at the Prediction Guard API with your existing API key.

| This package | Replacement |
|---|---|
| `ChatPredictionGuard` | `langchain_openai.ChatOpenAI` or `langchain_anthropic.ChatAnthropic` |
| `PredictionGuard` (completions) | `langchain_openai.OpenAI` |
| `PredictionGuardEmbeddings` | `langchain_openai.OpenAIEmbeddings` |
| `PredictionGuardRerank` | No drop-in replacement; call the Prediction Guard `/rerank` endpoint directly |

### Chat (OpenAI-compatible)

```bash
pip install langchain-openai
```

```python
import os

from langchain_openai import ChatOpenAI

chat = ChatOpenAI(
    model="<model-name>",
    api_key=os.environ["PREDICTIONGUARD_API_KEY"],
    base_url="https://api.predictionguard.com",
)

chat.invoke("Tell me a joke")
```

### Chat (Anthropic-compatible)

```bash
pip install langchain-anthropic
```

```python
import os

from langchain_anthropic import ChatAnthropic

chat = ChatAnthropic(
    model="<model-name>",
    api_key=os.environ["PREDICTIONGUARD_API_KEY"],
    base_url="https://api.predictionguard.com",
)

chat.invoke("Tell me a joke")
```

### Completions

```python
import os

from langchain_openai import OpenAI

llm = OpenAI(
    model="<model-name>",
    api_key=os.environ["PREDICTIONGUARD_API_KEY"],
    base_url="https://api.predictionguard.com",
)

llm.invoke("Tell me a joke about bears")
```

### Embeddings

```python
import os

from langchain_openai import OpenAIEmbeddings

embeddings = OpenAIEmbeddings(
    model="<model-name>",
    api_key=os.environ["PREDICTIONGUARD_API_KEY"],
    base_url="https://api.predictionguard.com",
    # Send raw text rather than OpenAI tiktoken token IDs.
    check_embedding_ctx_length=False,
)

embeddings.embed_query("This is an embedding example.")
```

For the full list of endpoints and models, see the [Prediction Guard documentation](https://docs.predictionguard.com).
