Skip to main content

A LiteralAI compiler for Python

Project description

LiteralAI compiler for Python

What is literal ai coding? It's the opposite of agentic AI enabled IDEs like Cursor, where your prompts modify your entire codebase and are then quickly forgotten, leading to write-only throw-away code. Literal ai is a way to store your prompts inside your project, and check them into git just like the rest of your code. It works more like a compiler - compiling your prompts into source code.

How it works

Any function that only has a docstring and/or initial comments, will be generated when literalai is run on your project, and any function that was generated this way, will be updated if you change the signature, docstring and/or comments. The LLM prompt will include the function signature, docstring and any initial comments. Literal ai does not store any metadata or state outside of your sourcecode, and the only state it stores is a hash of the signature/docstring/comments, as an extra comment inside functions it generate.

Example

You write

def add_two(a, b):
    """Add two numbers together, return the result"""

def manual(x):
    "A manual function"
    return x + 1

and run literalai .

The file will then be updated to contain

def add_two(a, b):
    """Add two numbers together, return the result"""
    # CODEID:4a5c8e754c305b36907466707fbbcdc9883ba6499cddd35fb4e1923f7af4e2e4
    result = a + b
    return result

def manual(x):
    "A manual function"
    return x + 1

Notice how the manual function stays untouched. If you where to change the docstring of add_two and rerun literalai ., its body would be regenerated using the new docstring.

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

literalai_python-0.0.2.tar.gz (22.2 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: literalai_python-0.0.2.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for literalai_python-0.0.2.tar.gz
Algorithm Hash digest
SHA256 f1ea79e0435cf0edce5ba5c2586f92b1e117137cc499fe6c223ff8230405160f
MD5 1759115eb17872f61d518dcd8f7e9c69
BLAKE2b-256 1af5fb8ab48d64de66423d9359c6f67df7e4f41de3a04b4af04b62d113d85fb5

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