Keymaker

The most powerful, flexible and extensible way to control the output of large language models.

Read The Docs
pip install headjack-keymaker Successfully installed keymaker ipython from keymaker import Prompt, CompletionConfig from keymaker.models import chatgpt, Huggingface from keymaker.constraints import OptionsConstraint, RegexConstraint chat_model = chatgpt() prompt = Prompt("Always happy to see you, {pet} are known for being", chat_model) prompt = await prompt.format(pet=CompletionConfig(constraint=RegexConstraint(r"(dog|cat)s?"))) print(await prompt.complete(Huggingface('gpt2'), constraint = OptionsConstraint({" awesome!", " evil..."}), name="trait")) 'Always happy to see you, dogs are known for being awesome!' prompt.completions.trait.score 0.8205356001853943
Pure Python Icon

Pure Python

Keymaker is built with pure Python - no Domain-Specific Languages - allowing you to leverage the full power and flexibility of Python when constructing your workflows.

Powerful Constraints Icon

Powerful Constraints

Keymaker offers a variety of built-in constraints to control the generated output, ensuring that it meets specific requirements or follows a desired format.

Robust Integrations Icon

Robust Integrations

Keymaker supports multiple large language models out-of-the-box and can be extended to work with custom models, making it easy to adapt to various environments and technologies.

Easy to Use Icon

Easy to Use

With Keymaker, anyone with Python knowledge can create powerful prompts and control the output of large language models. No other learnings required!

Open Source Icon

Open Source

Keymaker is fully open source with a trivial codebase. We excitedly welcome you to contribute improvements, share your experiences, and engage with the community. Have any questions? Check out our GitHub repository.

Testable Icon

Testable

Keymaker's design means all logic for prompt completions is fully testable, unlike alternatives.