aism

Quick start

Get started with aism.


aism (ay-zuhm) is AI for the runtime.

Yeah, I know. Pretty vague slogan, ay?

Apparently nobody likes AI chatbots & chat interfaces nowadays, so instead of building yet another ChatGPT wrapper, we'll just assign those goofy ahh clankers different tasks with aism, which is essentially on the same level of dish washing and stuff (literally chores). (Maoyue says it, please blame him when the singularity is here.)

So yes, chores. Or, you could call this organizing data, making natural language and controlled code work better with each other.


Filling

One of the core features of aism is to content organization. Follow this quick guide.

Pick an LLM

First, pick your favorite LLM provider and the LLM. Since I'm broke as f*ck, aism currently doesn't support paid services.

Cerebras is the first and only company in the world building AI hardware at wafer-scale. Don't know what that means, shi is fast though.

No extra packages are needed.

from aism import Aism
from aism.llms import Cerebras

ai = Aism(
  Cerebras(
    "gpt-oss-120b",  # only cool model from openai so far
    api_key="csk-xxx",  # optional, uses env "CEREBRAS_API_KEY"
    reasoning_effort="medium"  # for models with reasoning only
  )
)

It is possible to choose a primary model and use other providers as fallback.

from aism.llms import Cerebras

ai = Aism([  # a list of llms
  Cerebras("gpt-oss-120b"),
  # ... put more models here
])

On-device models?

I mean, I love on-device models, but imagine having Intel(R) UHD Graphics and 8GB of RAM. What the hell can I even run at this point? Until I find a nice solution, I ain't making on-device models.

Define schema

Let's define our schema. You can either use dataclasses for direct native support, or Pydantic.

The dataclasses built-in library is available since Python 3.9.

from typing import Annotated
from dataclasses import dataclass

@dataclass
class NewsColumn:
  title: str
  summary: Annotated[str, "summarize the news"]

@dataclass
class BreakingNews:
  columns: list[NewsColumn]

Note that the Annotated type just adds metadata. For aism however, it treats it as a comment for the LLM to read.

Install pydantic if you haven't already:

pip install -U pydantic

Then, build the schema:

from pydantic import BaseModel, Field

class NewsColumn(BaseModel):
  title: str
  summary: str = Field(description="summarize the news")

class BreakingNews(BaseModel):
  columns: list[NewsColumn]

Note that Annotated does not work here to better accompany with the pydantic econsystem.

Prepare data

Next, and the most important of all, data! Aism only works if you have data. And if for this demo, I'll spare you with some of my AI-generated slop. Feel free to copy it.

# just copy these
brainrots = [
  (
    "In today’s shocking market twist, Bombardino Crocodilo Coin dropped 87% after "
    + "investors realized the coin was literally backed by JPEGs of crocodiles taped "
    + "to paper airplanes. Analysts warn of incoming turbulence, though one TikTok "
    + "teen says: “ngl, this slaps.”"
  ),

  (
    "Residents of Maplewood complained after a man walked the streets at 3 a.m. "
    + "repeatedly chanting “TUN TUN TUN SAHURA” with a frying pan. Police confirmed "
    + "he was “cosplaying a meme.” The frying pan was confiscated and is now held as "
    + "evidence in the “Brainrot Disruption Act.”"
  ),

  (
    "The three-legged shark in Nike Air Force 1s allegedly ran across the court "
    + "during halftime. Witnesses said he demanded “one large Sprite Cranberry” "
    + "before vanishing. The NBA has promised to review footwear regulations "
    + "for aquatic mammals."
  )
]

Run it

Finally, feed the AI the data with give(), and tell it to fill our schema.

with ai.give(brainrots) as session:
  result = session.fill(BreakingNews)
  print(result.reasoning)  # ["reason", ...]
  print(result.model)  # BreakingNews(columns=[...])
Example output (formatted)
[
  'Extracted three distinct news items from the provided data rows.', 
  'For each item, created a concise title that captures the core event.', 
  'Summarized each story to convey the main points without extraneous detail.'
]

BreakingNews(
  columns=[
    NewsColumn(
      title='Bombardino Crocodilo Coin crashes 87%', 
      summary=(
        'The cryptocurrency dropped 87% after investors learned it was backed '
        'by JPEGs of crocodiles on paper airplanes, prompting warnings of market '
        'turbulence.'
      )
    ), 
    NewsColumn(
      title='Maplewood man disrupts night with meme chant', 
      summary=(
        'A man walked Maplewood streets at 3\u202fa.m. chanting “TUN TUN TUN SAHURA” '
        'while holding a frying pan, later identified as a meme cosplay; the pan was '
        'seized as evidence.'
      )
    ),
    
    NewsColumn(
      title='Three‑legged shark in Nike Air Force\u202f1s halts NBA halftime', 
      summary=(
        'A three‑legged shark wearing Nike Air Force\u202f1s reportedly ran across the '
        'court demanding a large Sprite Cranberry, leading the NBA to review footwear '
        'rules for aquatic mammals.'
      )
    )
  ]
)

How'd it go?

How was aism? I would NOT be surprised if it was bad though. But it could be better with your help!

Create an issue here so that I can move my fat ass and get to work.