Skip to main content

A cognitive architecture framework integrating LLMs, capabilities, and self-regulation.

Project description

Brainary

Brainary is a Python framework for building cognitive architectures that integrate LLMs, self-regulation, and multiple capabilities such as reasoning, planning, and evaluation.

Installation

pip install brainary

Usage

from typing import List
import brainary
from brainary.util.logging_util import init_logging

init_logging()

brainary.install_vm("gpt-4o-mini")

Review = brainary.define_type(
    type_name="Review",
    text={"type": str, "desc": "review content"},
    author={"type": str, "desc": "reviewer name"}
)
Movie = brainary.define_type(
    type_name="Movie",
    name={"type": str, "desc": ""},
    year={"type": int, "desc": "release year"},
    reviews={"type": List[Review], "desc": "reviews of the movie"}
)
r1 = Review(text="When this came out, I was living with a roommate. He went out and saw it, came home and said, \"Dude, you have to go see The Matrix.\" So we left and he sat through it a second time. This movie is splendidly done. The mystery about what the Matrix is, unravels and you see a dystopian future unlike any we as a race would want. I have watched this over and over and never tire of it. Everyone does a great job acting in this, the special effects are above par and the story is engaging.", author="acedj")
r2 = Review(text="This was a real change in filmmaking. Like watching it again in 2020, i.e. after 21 years and it still feels fresh. Iconic scenes are still having benchmarks setting up.\n\nIf we say it sci-fi at its best, it won't be wrong. The hype was real, it is still not easy to match the level of Matrix where we experience the connection of humans and science, that too with amazing action fight and chase scenes, not just normal scenes they were, multiple exposures, slow motion 3D moves, Oh My God, and it's understandable as well like what are the characters up to and what storyline they are entering into. The script was very well written and executed otherwise it could have been a mess. A special appreciation in managing the theme with those black color costumes and a scientific zone with unimaginable equipment and props doing unbelievable things in the two worlds created. No spoilers, but the action scenes in the climax where the protagonist goes to save someone from agents are really breathtaking. The technology used at its best.\n\nA salute to Wachowski Brothers and the team for creating this masterpiece. It will be a great competition and motivation as well for many films coming in the future.", author="suryanmukul")
m = Movie(name="Matrix", year=1999, reviews=[r1, r2, r3])

if brainary.examine("The sentiment of the review is negative.", review=r1):
    print("===== Negative Review =====")

summarize = brainary.define_action("Summarize the movie reviews.", "movie", attentions=["sentiment", "character"], output_constraints={"tone": "grandiloquent"})
summarize(movie=m)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brainary-0.0.2.tar.gz (57.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brainary-0.0.2-py3-none-any.whl (83.9 kB view details)

Uploaded Python 3

File details

Details for the file brainary-0.0.2.tar.gz.

File metadata

  • Download URL: brainary-0.0.2.tar.gz
  • Upload date:
  • Size: 57.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for brainary-0.0.2.tar.gz
Algorithm Hash digest
SHA256 0bebdc583293ee25ada6b9eaa414a2ba10df441e103998be55b5931813821c92
MD5 4a187999d3b1f962066472a9e265a5f0
BLAKE2b-256 2c07deda61370864b407a3480953fe0ea3f34c8983562d111ba36b5a62224e13

See more details on using hashes here.

File details

Details for the file brainary-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: brainary-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 83.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for brainary-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6ebc1c9654c9ab65e6505347820eee3c7187d5adc26e7b5d3576d1c3e12cbc15
MD5 076d761f1de08104517c6cd836202bff
BLAKE2b-256 b07933d76298b6c415b7978a4d0a6fa39d60ba4a71870cd34c48ad7b04554b50

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page