Skip to main content

langchain-gradient

PyPI Downloads

This package contains the LangChain integration with DigitalOcean

Installation

pip install -U langchain-gradient

And you should configure credentials by setting the DIGITALOCEAN_INFERENCE_KEY environment variable:

  1. Log in to the DigitalOcean Cloud console
  2. Go to the Gradient Platform and navigate to Serverless Inference.
  3. Click on Create model access key, enter a name, and create the key.
  4. 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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_gradient-0.2.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_gradient-0.2.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file langchain_gradient-0.2.1.tar.gz.

File metadata

  • Download URL: langchain_gradient-0.2.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.14.6 Darwin/25.5.0

File hashes

Hashes for langchain_gradient-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b3fe22676a04319243ada639c2c3424d3b3b5d4d528d3609e499f559b0cb04cc
MD5 78082d6dc6d1dd30fb0271ac1a460144
BLAKE2b-256 50f68a928e7503711420301333875cf161b222f5b9da20ffcd09c387ea4d3f18

See more details on using hashes here.

File details

Details for the file langchain_gradient-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: langchain_gradient-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.14.6 Darwin/25.5.0

File hashes

Hashes for langchain_gradient-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f259ce8997eb71527b2a9469f5c02943c0d85147be7e9d540e77b658bd2ecc5c
MD5 def5d4c20186ca64c87a29f1d0b14d8d
BLAKE2b-256 bf65b0443236b4ae046e6b7311e99647acc3b07f99c175a085785b65a795202d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page