Skip to main content

Python SDK for Lightning Rod AI-powered forecasting dataset generation

Project description

Lightning Rod Labs

Lightning Rod Python SDK Beta

The Lightning Rod SDK provides a simple Python API for generating custom forecasting datasets to train your LLMs. Transform news articles, documents, and other real-world data into high-quality training samples automatically.

Based on our research: Future-as-Label: Scalable Supervision from Real-World Outcomes

👋 Quick Start

1. Install the SDK

pip install lightningrod-ai

2. Get your API key

Sign up at dashboard.lightningrod.ai to get your API key and $50 of free credits.

3. Generate your first dataset

Generate 1000+ forecasting questions in minutes - from raw sources to labeled dataset, automatically. ⚡

from lightningrod import LightningRod, BinaryAnswerType, QuestionPipeline, NewsSeedGenerator, ForwardLookingQuestionGenerator, WebSearchLabeler

lr = LightningRod(api_key="your-api-key")

binary_answer = BinaryAnswerType()

pipeline = QuestionPipeline(
    seed_generator=NewsSeedGenerator(
        start_date=datetime.now() - timedelta(days=90),
        end_date=datetime.now(),
        search_query=["Trump"],
    ),
    question_generator=ForwardLookingQuestionGenerator(
        instructions="Generate binary forecasting questions about Trump's actions and decisions.",
        examples=[
            "Will Trump impose 25% tariffs on all goods from Canada by February 1, 2025?",
            "Will Pete Hegseth be confirmed as Secretary of Defense by February 15, 2025?",
        ]
    ),
    labeler=WebSearchLabeler(answer_type=binary_answer),
)

dataset = lr.transforms.run(pipeline, max_questions=3000)
dataset.flattened() # Ready-to-use data for your training pipelines

We use this to generate the Future-as-Label training dataset for our research paper.

✨ Examples

We have some example notebooks to help you get started! If you have trouble using the SDK, please submit an issue on Github.

Example Name Path Google Colab Link
Quick Start notebooks/01_quick_start.ipynb Open in Colab
News Datasource notebooks/02_news_datasource.ipynb Open in Colab
Custom Documents notebooks/03_custom_documents_datasource.ipynb Open in Colab
Binary Answer Type notebooks/04_binary_answer_type.ipynb Open in Colab
Continuous Answer Type notebooks/05_continuous_answer_type.ipynb Open in Colab
Multiple Choice Answer Type notebooks/06_multiple_choice_answer_type.ipynb Open in Colab
Free Response Answer Type notebooks/07_free_response_answer_type.ipynb Open in Colab

For complete API reference documentation, see API.md. This includes overview of the core system concepts, methods and types.

License

MIT License - see LICENSE file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lightningrod_ai-0.1.13.tar.gz (79.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lightningrod_ai-0.1.13-py3-none-any.whl (167.7 kB view details)

Uploaded Python 3

File details

Details for the file lightningrod_ai-0.1.13.tar.gz.

File metadata

  • Download URL: lightningrod_ai-0.1.13.tar.gz
  • Upload date:
  • Size: 79.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for lightningrod_ai-0.1.13.tar.gz
Algorithm Hash digest
SHA256 ae13c8e042b5fbe9ad354aa5de9c84151eb13e884ad3e8bb9f3471a9eb49b477
MD5 e0e3e5f6d1d9d4ad19dbb56218c704c5
BLAKE2b-256 a60d6379a53474df30087d0af5611ece9b5bea5866c5b27b2c0648306d3f5530

See more details on using hashes here.

File details

Details for the file lightningrod_ai-0.1.13-py3-none-any.whl.

File metadata

File hashes

Hashes for lightningrod_ai-0.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 bfae5f1c32ce9c110465a91c2fb0a6a35f1a344530542f25a3aa36abdba7b2ba
MD5 76afb3d32265e0ec6eb15df7d0684f8c
BLAKE2b-256 e427c2b8b4865b32a4de9a5e0aa16150270ce57f8ff2e3a6999e267bba9bc67d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page