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.5.0.tar.gz
(79.5 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.5.0.tar.gz.
File metadata
- Download URL: river_client-0.5.0.tar.gz
- Upload date:
- Size: 79.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","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 |
0e8a19df00780d9817d22b6fcacf7f4150345401e9a1381592069855a2891d41
|
|
| MD5 |
77f69959903e899cb20ddaa4a261a80f
|
|
| BLAKE2b-256 |
c6285215a15327b6943d1dd7eb543bb2e4fa5a2d745bca1b21170f02a43e675e
|
File details
Details for the file river_client-0.5.0-py3-none-any.whl.
File metadata
- Download URL: river_client-0.5.0-py3-none-any.whl
- Upload date:
- Size: 95.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","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 |
38426e106a7081a84c68146ab0bbe98b3ea38faac8ae92e47572cb398bd41529
|
|
| MD5 |
36270bf3a1dd3e54fda9a6bb1a885631
|
|
| BLAKE2b-256 |
c4d028ffc58949b615418d3ebe07a7b807afe927339746306ae487740d2a0d21
|