Open-source foundations · Python 3.11+
Build AI systems
you can reason about.
LuckyBrain gives you small, typed building blocks for models, retrieval, and agents—without hiding the seams or pretending the hard parts are solved.
Early-stage project · Clear about what works today
from luckybrain.core.models import (
OpenaiBrain,
)
brain = OpenaiBrain(
model="gpt-4o-mini",
system_prompt="Be clear and precise.",
)
answer = brain.think(
"Explain vector search."
)
print(answer)
A toolkit, not a black box
Use the pieces you need.
Keep control of the rest.
Start with the supported interfaces. Add your own providers, stores, and orchestration when your application calls for them.
Talk to chat models
Use synchronous OpenAI and Groq clients with explicit prompts, options, and conversation history.
Read the model guide 02 / CONTRACTSBuild against interfaces
Implement small async protocols for retrieval, reranking, generation, and agent tools.
Explore the contracts 03 / SEARCHImprove a query
Optionally rewrite or expand a search query through a chat model you already provide.
See the query guideA useful distinction
Foundations today.
Room to grow tomorrow.
LuckyBrain is an alpha package—not a finished RAG platform. Its contracts are extension points, not built-in databases or orchestration. Open the docs to see what is implemented, how to use it, and what you still own.
Read production-readiness notesBuild in the open
Have an idea or a better way?
Read the contribution guide, open a focused issue, or help make the interfaces clearer.