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.2.1.tar.gz
(61.0 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.2.1.tar.gz.
File metadata
- Download URL: river_client-0.2.1.tar.gz
- Upload date:
- Size: 61.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","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 |
67255ec46f84f3cd25e10e88f1e217d70d3f5ed9368391f705eb96332e405002
|
|
| MD5 |
c8bdcce046f6066f213ec9495faf1190
|
|
| BLAKE2b-256 |
dc75925f5c64aafae5fe341a1e5c93a0939b1ccdc9c9f5ff1228b6917c7efb02
|
File details
Details for the file river_client-0.2.1-py3-none-any.whl.
File metadata
- Download URL: river_client-0.2.1-py3-none-any.whl
- Upload date:
- Size: 73.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","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 |
917e68079beffd7a3cbec190be99f80ee6bcc08d5b6fb143847983ad14b234eb
|
|
| MD5 |
4941ccad91af0eecfeae2541b1f0f737
|
|
| BLAKE2b-256 |
45f1edd82dfc3713f7f8dcc12c9030046cd0a434a193575a8420fcd702c7d9a6
|