Skip to content

Coding, Less Prompting#

byLLM is an innovative AI integration framework built for the Jaseci ecosystem, implementing the cutting-edge Meaning Typed Programming (MTP) paradigm. MTP revolutionizes AI integration by embedding prompt engineering directly into code semantics, making AI interactions more natural and maintainable. While primarily designed to complement the Jac programming language, byLLM also provides a powerful Python library interface.

Installation is simple via PyPI:

pip install byllm

Basic Example#

Consider building an application that translates english to other languages using an LLM. This can be simply built as follows:

import from byllm.lib { Model }

glob llm = Model(model_name="gpt-4o");

def translate_to(language: str, phrase: str) -> str by llm();

with entry {
    output = translate_to(language="Welsh", phrase="Hello world");
    print(output);
}
1
2
3
4
5
6
7
8
9
from byllm.lib import Model, by

llm = Model(model_name="gpt-4o")

@by(llm)
def translate_to(language: str, phrase: str) -> str: ...

output = translate_to(language="Welsh", phrase="Hello world")
print(output)

This simple piece of code replaces traditional prompt engineering without introducing additional complexity.

Power of Types with LLMs#

Consider a program that detects the personality type of a historical figure from their name. This can eb built in a way that LLM picks from an enum and the output strictly adhere this type.

import from byllm.lib { Model }
glob llm = Model(model_name="gemini/gemini-2.0-flash");

enum Personality {
    INTROVERT,
    EXTROVERT,
    AMBIVERT
}

def get_personality(name: str) -> Personality by llm();

with entry {
    name = "Albert Einstein";
    result = get_personality(name);
    print(f"{result} personality detected for {name}");
}
from byllm.lib import Model, by
from enum import Enum
llm =  Model(model_name="gemini/gemini-2.0-flash")

class Personality(Enum):
    INTROVERT
    EXTROVERT
    AMBIVERT

@by(model=llm)
def get_personality(name: str) -> Personality: ...

name = "Albert Einstein"
result = get_personality(name)
print(f"{result} personality detected for {name}")

Similarly, custom types can be used as output types which force the LLM to adhere to the specified type and produce a valid result.

Control! Control! Control!#

Even if we are elimination prompt engineering entirely, we allow specific ways to enrich code semantics through docstrings and semstrings.

import from byllm.lib { Model }
glob llm = Model(model_name="gemini/gemini-2.0-flash");

"""Represents the personal record of a person"""
obj Person {
    has name: str;
    has dob: str;
    has ssn: str;
}

sem Person.name = "Full name of the person";
sem Person.dob = "Date of Birth";
sem Person.ssn = "Last four digits of the Social Security Number of a person";

"""Calculate eligibility for various services based on person's data."""
def check_eligibility(person: Person, service_type: str) -> bool by llm();
from jaclang import JacMachineInterface as Jac
from dataclasses import dataclass
from byllm.lib import Model, by
llm =  Model(model_name="gemini/gemini-2.0-flash")

@Jac.sem('', {  'name': 'Full name of the person',
                'dob': 'Date of Birth',
                'ssn': 'Last four digits of the Social Security Number of a person'
                })
@dataclass
class Person():
    name: str
    dob: str
    ssn: str

@by(llm)
def check_eligibility(person: Person, service_type: str) -> bool: ...
    """Calculate eligibility for various services based on person's data."""

Docstrings naturally enhance the semantics of their associated code constructs, while the sem keyword provides an elegant way to enrich the meaning of class attributes and function arguments. Our research shows these concise semantic strings are more effective than traditional multi-line prompts.

๐Ÿ“š Full Documentation: Jac byLLM Documentation

๐ŸŽฎ Code Examples: Jac byLLM Examples

๐Ÿ”ฌ Research: The research paper of byLLM is available on Arxiv and accepted for OOPSLA 2025.

Contributing#

We welcome contributions to byLLM! Whether you're fixing bugs, improving documentation, or adding new features, your help is appreciated.

Areas we actively seek contributions: - ๐Ÿ› Bug fixes and improvements - ๐Ÿ“š Documentation enhancements - โœจ New examples and tutorials - ๐Ÿงช Test cases and benchmarks

Please see our Contributing Guide for detailed instructions.

If you find a bug or have a feature request, please open an issue.

Community#

Join our vibrant community: - Discord Server - Chat with the team and community

License#

This project is licensed under the MIT License.

Third-Party Dependencies#

byLLM integrates with various LLM providers (OpenAI, Anthropic, Google, etc.) through LiteLLM.

Cite our research#

Jayanaka L. Dantanarayana, Yiping Kang, Kugesan Sivasothynathan, Christopher Clarke, Baichuan Li, Savini Kashmira, Krisztian Flautner, Lingjia Tang, and Jason Mars. 2025. MTP: A Meaning-Typed Language Abstraction for AI-Integrated Programming. Proc. ACM Program. Lang. 9, OOPSLA2, Article 314 (October 2025), 29 pages. https://doi.org/10.1145/3763092