Skip to main content

An integration package connecting Digitalocean and LangChain

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

langchain-gradientai

This package contains the LangChain integration with DigitalOcean

Installation

pip install -U langchain-gradientai

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 GradienAI 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

ChatGradientAI class exposes chat models from langchain-gradientai.

Invoke

import os
from dotenv import load_dotenv
from langchain_gradientai import ChatGradientAI

load_dotenv()

llm = ChatGradientAI(
    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_gradientai import ChatGradientAI

load_dotenv()

llm = ChatGradientAI(
    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_gradientai_narsi-0.1.3.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

langchain_gradientai_narsi-0.1.3-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file langchain_gradientai_narsi-0.1.3.tar.gz.

File metadata

  • Download URL: langchain_gradientai_narsi-0.1.3.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Darwin/24.5.0

File hashes

Hashes for langchain_gradientai_narsi-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c6bc4932acd69822019a31eba51d35c6ef1e76c1a64349eb288cfe51adbdae71
MD5 86eb11c0aca6b568ab7dbc9aba69e18f
BLAKE2b-256 d2ff4456c6c75980170bc94f4e4e89513ed3a72d1556943115114c74452d3002

See more details on using hashes here.

File details

Details for the file langchain_gradientai_narsi-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_gradientai_narsi-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1d717b944b8b31b038afd2f241900f82accf66db6acb24b08384d21f41a32083
MD5 ae60b54ebdc8f9a6072fa3082c711813
BLAKE2b-256 fd042cb2c74a30971b48c53e227ba565e40d7384c472f24adfd47296109daf51

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