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.1.tar.gz
(80.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.5.1.tar.gz.
File metadata
- Download URL: river_client-0.5.1.tar.gz
- Upload date:
- Size: 80.3 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 |
06890330d247cbf1de18e698ea3df3f35d1efd8ba5d2a74eea5df17729bdd16a
|
|
| MD5 |
3061666698795b10b8acb693b524c598
|
|
| BLAKE2b-256 |
cb8723ef0d1286555343ba88afcbf57f9a71d28dd31eee861d054722277a42b9
|
File details
Details for the file river_client-0.5.1-py3-none-any.whl.
File metadata
- Download URL: river_client-0.5.1-py3-none-any.whl
- Upload date:
- Size: 96.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 |
fd0b20f9992850d10f511d17947851f304204039294f8879df1d5bd4a0ef37f0
|
|
| MD5 |
4aeddb259db055f6f01e3277df2eda50
|
|
| BLAKE2b-256 |
51e5a5e1598b99499a0f7cfd41f4fc7505711012337ce910e6b5948fb5ad5f96
|