Skip to content

Commit

Permalink
Merge branch 'main' of github.com:eth-sri/lmql
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca Beurer-Kellner authored and Luca Beurer-Kellner committed Feb 14, 2024
2 parents e223455 + 2bffb8d commit b6d2dc1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
21 changes: 9 additions & 12 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
include src/lmql/ui/*
recursive-include src/lmql/ui/playground/ *
<<<<<<< HEAD
=======
recursive-exclude src/lmql/ui/playground/build/ *
>>>>>>> a231d6cbbb15091ac273a309f36b8c9d5f5b6c89
recursive-include src/lmql/lib/chat/assets/ *
recursive-include src/lmql/ui/live/ *
recursive-exclude src/lmql/ui/live/node_modules/ *
recursive-exclude src/lmql/ui/live/ *.tokens
recursive-exclude src/lmql/ui/playground/node_modules/ *
recursive-exclude src/lmql/ui/vscode/ *
include src/lmql/ui *
recursive-include src/lmql/ui/playground *
recursive-exclude src/lmql/ui/playground/build *
recursive-exclude src/lmql/ui/playground/node_modules *
recursive-include src/lmql/lib/chat/assets *
recursive-include src/lmql/ui/live *
recursive-exclude src/lmql/ui/live/node_modules *
recursive-exclude src/lmql/ui/live *.tokens
recursive-exclude src/lmql/ui/vscode *
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
</p>
</div>


LMQL is a programming language for large language models (LLMs) based on a *superset of Python*. LMQL offers a novel way of interweaving traditional programming with the ability to call LLMs in your code. It goes beyond traditional templating languages by integrating LLM interaction natively at the level of your program code.

> <img width="200pt" alt="image" src="https://github.com/eth-sri/lmql/assets/17903049/bfa7ecf5-847b-47d0-9160-f8596aa47749"> <br/>Help us shape the next major version of LMQL by filling out the LMQL developer survey: https://forms.gle/pGvAicNpUhS1rAkK9
## Explore LMQL

An LMQL program reads like standard Python, but top-level strings are interpreted as query strings: They are passed to an LLM, where template variables like `[GREETINGS]` are automatically completed by the model:
Expand Down
10 changes: 7 additions & 3 deletions src/lmql/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

is_windows = os.name == "nt" # Necessary to properly run yarn using subprocess.run on Windows

def cmd_serve_model():
"""emoji:🏄 Serve a 🤗 Transformers model via the LMQL inference API"""
from lmql.models.lmtp.lmtp_serve import cli
Expand Down Expand Up @@ -124,7 +126,7 @@ def cmd_playground():
print(f"[lmql playground {project_root}, liveserver=localhost:{args.live_port}, ui=localhost:{args.ui_port}]")

# # make sure yarn is installed
if subprocess.call(["yarn", "--version"]) != 0:
if subprocess.call(["yarn", "--version"], shell=is_windows) != 0:
subprocess.run(['npm', 'install', '-g', 'yarn'], check=True)

# repo commit
Expand All @@ -140,22 +142,24 @@ def cmd_playground():

# Ensure that we can download dependencies before we start either live.js or the debug server
yarn_cwd_live = os.path.join(project_root, "lmql/ui/live")
subprocess.run(['yarn'], cwd=yarn_cwd_live, check=True)
subprocess.run(['yarn'], cwd=yarn_cwd_live, check=True, shell=is_windows)

yarn_cwd_playground = os.path.join(project_root, 'lmql/ui/playground')
subprocess.run(['yarn'], cwd=yarn_cwd_playground, check=True)
subprocess.run(['yarn'], cwd=yarn_cwd_playground, check=True, shell=is_windows)

# live server that executes LMQL queries and returns results and debugger data
live_process = subprocess.Popen(['yarn', 'cross-env', 'node', 'live.js'],
cwd=yarn_cwd_live,
env=dict(os.environ, PORT=str(args.live_port)),
shell=is_windows,
)

# UI that displays the debugger (uses live server API for data and remote execution)
ui_modern_process = subprocess.Popen(
['yarn', 'cross-env', 'yarn', 'run', 'start'],
cwd=yarn_cwd_playground,
env=dict(os.environ, REACT_APP_BUILD_COMMIT=str(commit), REACT_APP_SOCKET_PORT=str(args.live_port)),
shell=is_windows,
)

try:
Expand Down
Empty file.

0 comments on commit b6d2dc1

Please sign in to comment.