book-openQuick Start

Get started with simple but powerful Lightningrod SDK

Your First API Call

1

Get Your API Key

Obtain your Lightningrod API key from our developer dashboardarrow-up-right.

If you sign up now, we'll also give you $50 of free credits, so that you can start experimenting without even entering your credit card details.

2

Setup the SDK

First install our library from PyPiarrow-up-right.

pip install lightningrod-ai

Lastly, initialize the SDK with the API key and you are ready to go!

from lightningrod import LightningRod

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

Generate Your First Dataset

Here we'll generate the first dataset with binary forecasting questions about Donald Trump.

The output dataset is almost ready for training with our fine tuning API.

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

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)
4

Fine-Tuning, Evals, Inference

Once you land on a suitable dataset, you can use our fine-tuning API to train a custom model, run evaluations, and run inference.

All that without setting up any custom infrastructure or worrying about the low level details!

Colab Notebook

If you prefer to get started without running any code locally, you should check out our Quick Start Notebookarrow-up-right and other follow-up examples.

Last updated