LLM extensions framework
Project description
GalaxyBrain
Turn wordcel LLMs into mighty shape rotators!
Goals
- Reduce surprises when it comes to working with LLMs.
- Focus on production use cases and CI/CD compatibility.
- Avoid bloat and keep base primitives simple.
Getting Started
First, install the library:
pip install galaxybrain
Currently, GalaxyBrain only supports OpenAI APIs, so you'll need to get an API key. You can then either keep it on your path as OPENAI_API_KEY
or pass it to the completion object manually:
api_key = ...
OpenAiCompletion(api_key)
Here is an example of some of GalaxyBrain's functionality:
completion = OpenAiCompletion(api_key, temperature=0.9, user="demo")
memory = Memory()
rules = [
json_rules.return_valid_json(),
json_rules.put_answer_in_field("Names"),
Rule("only use information from fantasy novels")
]
completion.complete(
Prompt("Give me ideas for two names", memory=memory, rules=rules)
)
# Output:
# {
# "Names": ["Frodo Baggins", "Gandalf the Grey"]
# }
result = completion.complete(
Prompt("Give me 3 more from another universe", memory=memory)
)
# Output:
# {
# "Names": ["Dumbledore", "Luna Lovegood", "Harry Potter"]
# }
You can also validate results against your rules:
validator = Validator(result, rules)
if validator.validate():
log.info("Rule validations passed")
else:
log.error("Rule validations failed")
log.error(validator.failed_rules())
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
galaxybrain-0.0.1.tar.gz
(10.4 kB
view details)
File details
Details for the file galaxybrain-0.0.1.tar.gz
.
File metadata
- Download URL: galaxybrain-0.0.1.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11f7194d39f81ae8d8ed5263c21181e214c0c161c1d44770ed9eec7e5fee42ab |
|
MD5 | f5462083ecc0fbbd0e6878bdc74f82ec |
|
BLAKE2b-256 | 2fd82b6ebef7fc3f1ca11e47ada35c75e5628cb09a7b6c31d07a76038691d48c |