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.
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.4.1.tar.gz
(68.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file river_client-0.4.1.tar.gz.
File metadata
- Download URL: river_client-0.4.1.tar.gz
- Upload date:
- Size: 68.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
672b224209e6d72c686e0342fa44030584ef0564f20c6fa8cf9f2a0916d71e93
|
|
| MD5 |
0bd1af2ec41fe439af1ac7b9e62c3cca
|
|
| BLAKE2b-256 |
9abcef3664d1dc6162e6d624ca837c146f8782c1978f369992c61d6240ec5cd7
|
File details
Details for the file river_client-0.4.1-py3-none-any.whl.
File metadata
- Download URL: river_client-0.4.1-py3-none-any.whl
- Upload date:
- Size: 81.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1c3f9c0860b55575e925da864cf9b1ab4704b6d64da7b7c086b4f2c8c1665d1
|
|
| MD5 |
e0e1ecfe651b3aa9a4ab499dc6743b93
|
|
| BLAKE2b-256 |
2145dc37a347e20e29aa5309cfbe99f5abdd784f39c0dbd7fd1e8efbff766f51
|