Skip to content

BrokenSource/Delusion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Important

Work in progress - internal code refactor.

Delusion

✨ The missing conveniences in generative models ✨

📦 Description

A small toolkit for generative models, with practical conveniences built in: such as caching, fast imports, syntactic sugars, opinionated architecture, curated providers, and more.

  • Message classes with type-safe structured output generics, auto validation (chat)
  • Modular: Easily write your implementations or modify existing ones.
  • Minimal: Avoids the complexity and commitment of a full framework.

📦 Usage

Simply add the delusion PyPI package to your pyproject.toml and use it:

[project]
dependencies = ["delusion"]

Chat

from delusion.chat.router import Ollama
from pydantic import BaseModel, Field

class Country(BaseModel):
    name: str
    capital: str
    languages: set[str] = Field(
        description="Officially recognized languages"
    )

chat = Ollama().serve()
chat.gemma4("e2b").pull()

chat.send("Tell me about Canada, its capital and spoken languages.")

# Your linter should properly point to the class
canada = chat.generate(schema=Country)
print(canada.struct)

assert (canada.struct.name == "Canada")
assert (canada.struct.capital == "Ottawa")
assert (canada.struct.languages == {"English", "French"})

About

✨ The missing conveniences in generative models

Resources

License

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Contributors

Languages