Skip to content

Commit

Permalink
feat: display emoji of the engine for the run in the prompt
Browse files Browse the repository at this point in the history
fixes #783

Signed-off-by: Florent Benoit <fbenoit@redhat.com>
  • Loading branch information
benoitf committed Feb 23, 2025
1 parent 2912913 commit 4058f81
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion container-images/scripts/build_llama_and_whisper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ clone_and_build_whisper_cpp() {
}

clone_and_build_llama_cpp() {
local llama_cpp_sha="4078c77f9891831f29ffc7c315c8ec6695ba5ce7"
local llama_cpp_sha="7ad0779f5de84a68143b2c00ab5dc94a948925d3"

git clone https://github.com/ggml-org/llama.cpp
cd llama.cpp
Expand Down
13 changes: 13 additions & 0 deletions ramalama/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,14 @@ def setup_container(self, args):
container_labels += ["--label", f"ai.ramalama.command={args.subcommand}"]
conman_args.extend(container_labels)

# if args.subcommand is run add LLAMA_PROMPT_PREFIX to the container
if hasattr(args, "subcommand") and args.subcommand == "run":
# if podman
if os.path.basename(args.engine) == "podman":
conman_args += ["--env", "LLAMA_PROMPT_PREFIX=🦭 > "]
elif os.path.basename(args.engine) == "docker":
conman_args += ["--env", "LLAMA_PROMPT_PREFIX=🐋 > "]

if os.path.basename(args.engine) == "podman" and args.podman_keep_groups:
conman_args += ["--group-add", "keep-groups"]

Expand Down Expand Up @@ -357,6 +365,11 @@ def build_exec_args_bench(self, args, model_path):

def build_exec_args_run(self, args, model_path, prompt):
exec_model_path = model_path if not args.container else MNT_FILE

# override prompt if not set to the local call
if "LLAMA_PROMPT_PREFIX" not in os.environ:
os.environ["LLAMA_PROMPT_PREFIX"] = "🦙 > "

exec_args = ["llama-run", "-c", f"{args.context}", "--temp", f"{args.temp}"]

if args.seed:
Expand Down

0 comments on commit 4058f81

Please sign in to comment.