Skip to main content

Python client for GreenNode's Cloud Platform!

Project description

GreenNode Python Library

Discord Twitter PyPI version

One-stop Python library for seamless AI model training, deployment and infrastructure management.

Installation

To install GreenNode Python Library, simply run:

pip install greennode

Usage

TODO

  • Write documentation for image_gen, speech_to_text, text_to_speech, rerank, etc.

Chat Completions

import os
from greennode import GreenNode

client = GreenNode(api_key=os.environ.get("GREENNODE_API_KEY"),
                   base_url=os.environ.get("GREENNODE_BASE_URL"))

response = client.chat.completions.create(
    model="meta/llama-3.1-8b-instruct",
    messages=[{"role": "user", "content": "tell me about new york"}],
)
print(response.choices[0].message.content)

Streaming

import os
from greennode import GreenNode

client = GreenNode(api_key=os.environ.get("GREENNODE_API_KEY"),
                   base_url=os.environ.get("GREENNODE_BASE_URL"))

stream = client.chat.completions.create(
    model="meta/llama-3.1-8b-instruct",
    messages=[{"role": "user", "content": "tell me about new york"}],
    stream=True,
)

for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="", flush=True)

Completions

import os
from greennode import GreenNode

client = GreenNode(api_key=os.environ.get("GREENNODE_API_KEY"),
                   base_url=os.environ.get("GREENNODE_BASE_URL"))

response = client.completions.create(
    model="Qwen/Qwen2.5-1.5B",
    prompt="New York City is",
    stream=False,
)

print(response.choices[0].text)

Streaming

import os
from greennode import GreenNode

client = GreenNode(api_key=os.environ.get("GREENNODE_API_KEY"),
                   base_url=os.environ.get("GREENNODE_BASE_URL"))

stream = client.completions.create(
    model="Qwen/Qwen2.5-1.5B",
    prompt="New York City is",
    stream=True,
)

for chunk in stream:
    print(chunk.choices[0].text or "", end="", flush=True)

Embeddings

import os
from greennode import GreenNode

client = GreenNode(api_key=os.environ.get("GREENNODE_API_KEY"),
                   base_url=os.environ.get("GREENNODE_BASE_URL"))

response = client.embeddings.create(
      model="BAAI/bge-m3",
      input=["Hello world", "Thank you"],
      encoding_format="float"
)

print(response)

List supported Models

import os
from greennode import GreenNode

client = GreenNode(api_key=os.environ.get("GREENNODE_API_KEY"),
                   base_url=os.environ.get("GREENNODE_BASE_URL"))

response = client.models.list()

print(response)

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

greennode-0.0.3.tar.gz (24.8 kB view details)

Uploaded Source

Built Distribution

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

greennode-0.0.3-py3-none-any.whl (40.0 kB view details)

Uploaded Python 3

File details

Details for the file greennode-0.0.3.tar.gz.

File metadata

  • Download URL: greennode-0.0.3.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for greennode-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f6ecba9332b1929d6c71cbfff882fce668b5a3fbe0d89dc4647875491d36cb29
MD5 d05b557c06a52604d81c5dab15ac7922
BLAKE2b-256 60a564bdb997375331c775e1478bdef27cbfaaac091089f122f92ab87c060684

See more details on using hashes here.

File details

Details for the file greennode-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: greennode-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 40.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for greennode-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 817d0cf2e2832fe4d8633a68865758bb7c7639575600858d4fefb3c21035053d
MD5 fd4a3ef4fab13c8334b4c9032e459f8f
BLAKE2b-256 c02bdcb00bb75efe70e8c758943d570c34026d8f8e77e5a0a2da8f699ee63da9

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