Skip to main content

byLLM Provides Easy to use APIs for different LLM Providers to be used with Jaseci's Jaclang Programming Language.

Project description

byLLM : Language Abstrations for AI-Integrated Programming.

Prompt No More!

PyPI version tests

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 { 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);
}

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

Power 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 { 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}");
}

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 entierly, we allow specific ways to enrich code semantics through docstrings and semstrings.

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

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();

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.

How well does byLLM work?

byLLM is built using the underline priciple of Meaning Typed Programming and we shown our evaluation data compared with two such AI integration frameworks for python, such as DSPy and LMQL. We show significant performance gain against LMQL while allowing on par or better performance to DSPy, while having a lower cost and faster runtime.

Correctness Comparison
Figure: Correctness comparison of byLLM with DSPy and LMQL on benchmark tasks.

📚 Full Documentation: Jac byLLM Documentation

🎮 Complete Examples:

🔬 Research: The research journey of MTP is available on Arxiv and accepted for OOPSLA 2025.

Quick Links

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:

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 Ab- straction for AI-Integrated Programming. Proc. ACM Program. Lang. 9, OOPSLA2, Article 314 (October 2025), 29 pages. https://doi.org/10.1145/3763092

Jaseci Contributors

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

byllm-0.4.2.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

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

byllm-0.4.2-py2.py3-none-any.whl (17.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file byllm-0.4.2.tar.gz.

File metadata

  • Download URL: byllm-0.4.2.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.0 CPython/3.12.11 Linux/6.11.0-1018-azure

File hashes

Hashes for byllm-0.4.2.tar.gz
Algorithm Hash digest
SHA256 ba87bc992a24d6fcd9117c64e7be3b5448690c0ace0335c57906dbc5f455e6c1
MD5 2601d5dfc6e9ff1bb62fddaae5226032
BLAKE2b-256 5b241915b8289251096b63d3088ba2f2ec31990bda10ef3add1dc9a4019f05ac

See more details on using hashes here.

File details

Details for the file byllm-0.4.2-py2.py3-none-any.whl.

File metadata

  • Download URL: byllm-0.4.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.0 CPython/3.12.11 Linux/6.11.0-1018-azure

File hashes

Hashes for byllm-0.4.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 832901c671fcde7673b47f55baac60f611b4a6d5bd5ba9f90579ee0de7f02818
MD5 60bc00eea7a1f7e7d7364ce5da6866d5
BLAKE2b-256 77d0886f40991670e19cfc72c88c2063b80710ba903d6a49498a30e5ab0aa67e

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