Python SDK for dataset generation on LightningRod platform ⚡
Project description
Lightning Rod Python SDK
Foresight returns a calibrated probability for any question about the future — through an OpenAI-compatible API. No fine-tuning, no setup. Ranked #1 for forecasting accuracy on ProphetArena.
Trusted for high-stakes predictions by Numinous, Shore Capital Partners, Awardable (Tradewinds Solutions Marketplace), and ERIS Marketplace. Foresight processes billions of tokens and serves 100k+ inference requests every day.
Documentation · Get an API key · Research paper
⚡ Better predictions in seconds
Foresight is served behind an OpenAI-compatible endpoint, so any OpenAI client works — just point base_url at Lightning Rod.
pip install openai
from openai import OpenAI
client = OpenAI(
base_url="https://api.lightningrod.ai/api/public/v1/openai",
api_key="your-api-key",
)
completion = client.chat.completions.create(
model="LightningRodLabs/foresight-v4",
messages=[
{"role": "user", "content": "Will the Fed cut rates at its next meeting?"},
],
extra_body={
"research": True, # gather live web evidence before forecasting
"answer_type": "auto", # append a structured answer in <answer></answer> tags
},
)
print(completion.choices[0].message.content)
# Foresight weighs the evidence and returns a calibrated probability,
# e.g.: "... <answer>0.34</answer>"
That 0.34 is a calibrated probability — a 34% chance, not a confidence score or a yes/no. 0.5 means genuinely uncertain, and across many ~0.7 forecasts roughly 70% should come true. See the forecasting reference for answer types, research sources, and the full response shape.
Prefer an SDK helper?
lr.predict() wraps the same API and parses the structured answer for you:
pip install lightningrod-ai openai
import lightningrod as lr
client = lr.LightningRod(api_key="your-api-key")
result = client.predict(
"Will the Fed cut rates by 25bp in March 2026?",
answer_type="binary",
research=True,
)
print(result.binary.probability) # e.g. 0.62
🏗️ Train an expert on your domain
Need a model tuned to your domain? Our enterprise platform enables companies to turn raw sources into labeled datasets and fine-tunes models on them — served through the same API.
pipeline = QuestionPipeline(...)
dataset = client.transforms.run(pipeline)
train_dataset, test_dataset = prepare_for_training(dataset)
train_config = GRPOTrainingConfig(base_model_id="openai/gpt-oss-120b")
training_job = client.training.run(train_config, train_dataset)
# your fine-tuned model is served through the same predict() / OpenAI API
client.predict("Will the Fed cut rates by 25bp in the next 3 months?", model=training_job.model_id)
We used this to generate the Future-as-Label training dataset from our paper, Future-as-Label: Scalable Supervision from Real-World Outcomes.
📚 Learn more
- Documentation — quickstart, guides, recipes, and the REST API reference
- Example notebooks — forecasting, dataset generation, training, and evaluation (runnable in Colab)
- SDK API reference — every class and method in this repo
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 lightningrod_ai-0.1.28.tar.gz.
File metadata
- Download URL: lightningrod_ai-0.1.28.tar.gz
- Upload date:
- Size: 193.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44aded5d31aa93d816d7466a979f72996f0f984383a6cb86496e726a2c9c74f9
|
|
| MD5 |
5b48aa5c5fdf75c078a9725a372145be
|
|
| BLAKE2b-256 |
7fb042de3bf20479bbd533af12ce3dcd78ebcf0dee69191dc354f3e479c8d79c
|
File details
Details for the file lightningrod_ai-0.1.28-py3-none-any.whl.
File metadata
- Download URL: lightningrod_ai-0.1.28-py3-none-any.whl
- Upload date:
- Size: 334.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e5d7fc0bad1d21a9b3bcc7a069462b7c5f0b277f17154048ed02ce38e98b774
|
|
| MD5 |
d3693d497e61a4e2217ee397e7f46058
|
|
| BLAKE2b-256 |
f82e015e470bf9ab5b7576bb42300986297d5026a7d38058c456baa1e08cfef6
|