Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
7b9182fd
Unverified
Commit
7b9182fd
authored
Jul 15, 2025
by
Graham King
Committed by
GitHub
Jul 15, 2025
Browse files
chore: Move examples/cli to lib/bindings/examples/cli (#1952)
parent
40d40dda
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
1 deletion
+34
-1
lib/bindings/python/examples/cli/README.md
lib/bindings/python/examples/cli/README.md
+1
-0
lib/bindings/python/examples/cli/cli.py
lib/bindings/python/examples/cli/cli.py
+33
-1
lib/bindings/python/examples/cli/sglang_inc.py
lib/bindings/python/examples/cli/sglang_inc.py
+0
-0
lib/bindings/python/examples/cli/trtllm_inc.py
lib/bindings/python/examples/cli/trtllm_inc.py
+0
-0
lib/bindings/python/examples/cli/vllm_inc.py
lib/bindings/python/examples/cli/vllm_inc.py
+0
-0
No files found.
lib/bindings/python/examples/cli/README.md
0 → 100644
View file @
7b9182fd
See docs in
`cli.py`
examples/cli/cli.py
→
lib/bindings/python/
examples/cli/cli.py
View file @
7b9182fd
...
...
@@ -2,8 +2,39 @@
# SPDX-License-Identifier: Apache-2.0
# Example cli using the Python bindings, similar to `dynamo-run`.
#
# Usage: `python cli.py in=text out=mistralrs <your-model>`.
# `in` can be:
# - "http": OpenAI compliant HTTP server
# - "text": Interactive text chat
# - "batch:<file.jsonl>": Run all the prompts in the JSONL file, write out to a jsonl in current dir.
# - "stdin": Allows you to pipe something in: `echo prompt | python cli.py in=stdin out=...`
# - "dyn://name": Connect to nats/etcd and listen for requests from frontend.
#
# `out` can be:
# - "dyn": Run as the frontend node. Auto-discover workers and route traffic to them.
# - "mistralrs", "llamacpp", "sglang", "vllm", "trtllm", "echo": An LLM worker.
#
# Must be in a virtualenv with the Dynamo bindings (or wheel) installed.
#
# To use mistralrs or llamacpp you must build the library with those features:
# ```
# maturin develop --features mistralrs,llamacpp --release
# ```
#
# `--release` is optional. It builds slower but the resulting library is significantly faster.
#
# They will both be built for CUDA by default. If you see a runtime error `CUDA_ERROR_STUB_LIBRARY` this is because
# the stub `libcuda.so` is earlier on the library search path than the real libcuda. Try removing
# the `rpath` from the library:
#
# ```
# patchelf --set-rpath '' _core.cpython-312-x86_64-linux-gnu.so
# ```
#
# If you include the `llamacpp` feature flag, `libllama.so` and `libggml.so` (and family) will need to be
# available at runtime.
#
import
argparse
import
asyncio
...
...
@@ -47,7 +78,8 @@ def parse_args():
# --- Step 2: Argparse for flags and the model path ---
parser
=
argparse
.
ArgumentParser
(
description
=
"Dynamo CLI: Connect inputs to an engine"
,
description
=
"Dynamo example CLI: Connect inputs to an engine"
,
usage
=
"python cli.py in=text out=mistralrs <your-model>"
,
formatter_class
=
argparse
.
RawTextHelpFormatter
,
# To preserve multi-line help formatting
)
...
...
examples/cli/sglang_inc.py
→
lib/bindings/python/
examples/cli/sglang_inc.py
View file @
7b9182fd
File moved
examples/cli/trtllm_inc.py
→
lib/bindings/python/
examples/cli/trtllm_inc.py
View file @
7b9182fd
File moved
examples/cli/vllm_inc.py
→
lib/bindings/python/
examples/cli/vllm_inc.py
View file @
7b9182fd
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment