Natural-language greyhound racing analytics. Ask questions about greyhound racing data in plain English — trainers, tracks, dogs, form, trap bias, recent results — and get a grounded, data-backed answer. greyhound-insights turns your question into GreyhoundAPI calls using an LLM (OpenAI or Anthropic/Claude), fetches the real racing data, and answers with the numbers it actually used.
It is a small, dependency-light tool-using agent over greyhound racing data, statistics and results — a retrieval-grounded natural-language query layer, not a guess. Everything is experimental analysis for research and education — not betting advice.
from greyhound_insights import GreyhoundInsights, OpenAIProvider
gi = GreyhoundInsights(OpenAIProvider(model="gpt-4o-mini"), api_key="gapi_...")
print(gi.ask("Which trainer had the most winners at Romford last month?").answer)$ python -m greyhound_insights ask "how does trap 1 perform at Nottingham over 500m?"
Most "AI + racing" tools generate a prediction from a single prompt. greyhound-insights does the opposite kind of work: it answers questions from the data. Ask about greyhound racing statistics in natural language and it:
- decides which GreyhoundAPI endpoints it needs (races, results, dogs, form, trainers, tracks, head-to-head, track stats),
- calls them for you and reads the real data back,
- loops — calling more endpoints as needed (e.g. find the trainer, then pull their results), and
- answers concisely, citing the concrete figures and names it used.
Because every answer is grounded in live GreyhoundAPI data, it won't invent races, dogs or results. If the data isn't available, it tells you.
Pairs naturally with greyhound-ai, which makes ranked pre-race predictions. Use greyhound-ai to predict, and greyhound-insights to understand the greyhound racing data behind it.
pip install greyhound-insightsSet your keys (a free GreyhoundAPI sandbox key is available at greyhoundapi.com):
export GREYHOUNDAPI_KEY="gapi_..."
export OPENAI_API_KEY="sk-..." # or ANTHROPIC_API_KEY for Claude# a plain-English question about greyhound racing data
python -m greyhound_insights ask "which trainer won the most races at Romford last month?"
# use Claude, and show which data tools the model called
python -m greyhound_insights ask "compare the recent form of two dogs at Nottingham" \
--provider anthropic --model claude-3-5-haiku-latest --trace
# full structured output (answer + the tool trace) as JSON
python -m greyhound_insights ask "recent winners at Sandown Park" --json
# list the data tools the analyst can use
python -m greyhound_insights toolsThe answer goes to stdout; the disclaimer and any --trace go to stderr, so you can pipe ask cleanly.
from greyhound_insights import GreyhoundInsights, AnthropicProvider
gi = GreyhoundInsights(
AnthropicProvider(model="claude-3-5-haiku-latest"),
api_key="gapi_...",
max_steps=6, # how many tool-calling rounds it may take
)
result = gi.ask("How does trap 1 perform at Nottingham over 500m?")
print(result.answer)
for step in result.steps: # the grounding: which data it pulled
print(step["tool"], step["arguments"], "ok" if step["ok"] else "error")ask() returns an Insight with answer, steps (the tools called, for transparency), model and disclaimer.
- "Which trainer had the most winners at Romford in the last month?"
- "What's the trap bias at Nottingham over 500m?"
- "Show me the most recent completed races and their winners."
- "How have these two dogs finished when they've met?"
- "Which traps win most often at this track?"
The analyst chooses from these GreyhoundAPI-backed tools (greyhound-insights tools prints them):
list_races, get_race, latest_results, find_dog, get_dog, dog_form, dog_head_to_head, find_trainer, trainer_results, list_tracks, get_track, track_races, track_stats, reference.
Add or replace tools by passing your own ToolRegistry.
Built-in adapters (standard library only — no heavy dependencies):
- OpenAI (and OpenAI-compatible gateways) —
OpenAIProvider - Anthropic / Claude —
AnthropicProvider - Your own —
CallableProvider(fn)
Model names change over time, so pass model= explicitly.
A free GreyhoundAPI sandbox key is scoped to a recent window on a few tracks (currently romford, nottingham, sandown-park-au). greyhound-insights knows this: if a question needs data outside the sandbox, it says so rather than guessing, and tool errors (including sandbox 403s) come back as data the model can reason about. A live key unlocks the full history and every track.
greyhound-insights produces experimental AI analysis of greyhound racing data for research and education. Answers can be wrong or incomplete and should be checked against the underlying data. It is not betting advice and not a prediction of outcomes.
MIT. Built on the GreyhoundAPI — see the live AI Lab.