langchain-gradient
This package contains the LangChain integration with DigitalOcean Gradient Serverless Inference.
Migrating to 1.0.0
1.0.0 replaces the deprecated gradient SDK with pydo (Gradient SDK retires 2026-08-15).
- Reinstall so you pick up
pydo:pip install -U "langchain-gradient>=1.0.0" - Exception types now come from azure-core/pydo (not
gradient.*) timeoutmust be a positive int (default120); it is an HTTP connect/read idle timeout, not a total generation budget- See CHANGELOG for the full breaking-change list
Installation
pip install -U langchain-gradient
And you should configure credentials by setting the DIGITALOCEAN_INFERENCE_KEY environment variable:
- Log in to the DigitalOcean Cloud console
- Go to the Gradient Platform and navigate to Serverless Inference.
- Click on Create model access key, enter a name, and create the key.
- Use the generated key as your
DIGITALOCEAN_INFERENCE_KEY:
Create .env file with your access key:
DIGITALOCEAN_INFERENCE_KEY=your_access_key_here
Chat Models
ChatGradient class exposes chat models from langchain-gradient.
Invoke
import os
from dotenv import load_dotenv
from langchain_gradient import ChatGradient
load_dotenv()
llm = ChatGradient(
model="llama3.3-70b-instruct",
api_key=os.getenv("DIGITALOCEAN_INFERENCE_KEY")
)
result = llm.invoke("What is the capital of France?.")
print(result)
Stream
import os
from dotenv import load_dotenv
from langchain_gradient import ChatGradient
load_dotenv()
llm = ChatGradient(
model="llama3.3-70b-instruct",
api_key=os.getenv("DIGITALOCEAN_INFERENCE_KEY")
)
for chunk in llm.stream("Tell me what happened to the Dinosaurs?"):
print(chunk.content, end="", flush=True)
More features coming soon.
Metadata
Release files for langchain-gradient 1.0.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_gradient-1.0.0.tar.gz | 8.4 kB | Without provenance | Details for langchain_gradient-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_gradient-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for langchain_gradient-1.0.0-py3-none-any.whl |
Total release size: 18.0 kB
Release files / langchain_gradient-1.0.0.tar.gz
| Download URL | langchain_gradient-1.0.0.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68caeb32ea753768fbae980fdc4b71cd8db275f3acef98e3829c61033d77dfad
|
|
BLAKE2b-256 checksum How to use checksums |
129d39e21a7217a1a92ee5b6879bf086c4059ca363af0a15c2af373bd20027fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|
Release files / langchain_gradient-1.0.0-py3-none-any.whl
| Download URL | langchain_gradient-1.0.0-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dcc82fdf0f7e90d8a899f32b513fac7afed77ec69ecbbe5c61dea4386393e38b
|
|
BLAKE2b-256 checksum How to use checksums |
b9033d468dddde1a636aee3562b1bf505f6e45ac7869ccb463f473f8e537cbfa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|
Security for langchain-gradient 1.0.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.