Skip to main content

An integration package connecting Digitalocean and LangChain

Project description

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.

Project details


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.1.24.tar.gz (7.8 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.1.24-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_gradient-0.1.24.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.2 Darwin/24.6.0

File hashes

Hashes for langchain_gradient-0.1.24.tar.gz
Algorithm Hash digest
SHA256 009f1401efe0bb818823239fc2f894696c177ea267363f94479f0171096f6434
MD5 479b384f56bca4cf562f738f94dfbed1
BLAKE2b-256 8992305a28d8378efa8190c7cf9dba7da88a6cc391b14605964918ebecf1250b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_gradient-0.1.24-py3-none-any.whl
Algorithm Hash digest
SHA256 780b869c966b0cbad5c4eb4efa64fde45b9a0879f94ffddad0d0b52e95ebc4d4
MD5 3d82ca0d457bc804311854aca55d1408
BLAKE2b-256 c55f7b26889436e929865ec0fcdd8a674330b2666a1315a343ef71e2efaf56bc

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 Pingdom Monitoring Sentry Error logging StatusPage Status page