Skip to main content

Python client for River ML training API

Reason this release was yanked:

The version is broken

Project description

river-client

Python client for the River ML training API — sampling, LoRA fine-tuning, and reinforcement learning against River-hosted models.

Installation

pip install river-client

Requires Python 3.12+.

Quick start

import river_client as river

client = river.Client(api_key="your-key", endpoint="api.river.ai")

# Stateless sampling from a base model
samples = client.sample(
    "What is 2+2?",
    base_model="Qwen/Qwen3.6-35B-A3B-FP8",
    max_tokens=50,
)
print(samples[0].text)

# Training with a session
with client.session() as session:
    model = session.create_model(
        base_model="Qwen/Qwen3.6-35B-A3B-FP8",
        lora=river.LoraConfig(rank=16),
    )

    # Forward + backward, then an optimizer step
    result = model.forward_backward(data, loss_fn="cross_entropy")
    model.optim_step(lr=1e-4)

    # Sample from the current weights
    sample_groups = model.sample("Continue:", max_tokens=100)

License

Apache-2.0. See LICENSE.

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

river_client-0.1.0.tar.gz (54.0 kB view details)

Uploaded Source

Built Distribution

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

river_client-0.1.0-py3-none-any.whl (54.0 kB view details)

Uploaded Python 3

File details

Details for the file river_client-0.1.0.tar.gz.

File metadata

  • Download URL: river_client-0.1.0.tar.gz
  • Upload date:
  • Size: 54.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for river_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 82e59f17fd7ae1b73bd7b4ab6f072e46f03879dd7669b5c7afebc6f2ea521618
MD5 de8768043dc0fc603c70e5b4bae30f21
BLAKE2b-256 19a93599bf1c758362e24cc4a6c96a9934f7863b88f9a1e0aaadb47221fd487f

See more details on using hashes here.

File details

Details for the file river_client-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: river_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 54.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for river_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf4e7bc19bce5442b91949a596bc950241420763a27d135864bcb393dbe607e1
MD5 4bb73e1a175a32fc050bad51bac50b7e
BLAKE2b-256 a6d5e96ca89c057aeecca1ce84f907cc687b0408149303f77f6a4e31a4aac5cf

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