Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove emoji usage until linenoise.cpp and llama-run are compatible #884

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

ericcurtin
Copy link
Collaborator

@ericcurtin ericcurtin commented Feb 25, 2025

Less eyecandy, but at least this works, backspaces for example were broken. Also split function into multiple functions, it was getting meaty.

Summary by Sourcery

This pull request removes emoji usage and refactors the setup_container function to address compatibility issues with linenoise.cpp and llama-run, specifically resolving broken backspace functionality. The prompt prefix is changed to a non-emoji character, and the setup_container function is split into smaller functions for better code organization.

Bug Fixes:

  • Fixes broken backspace functionality due to incompatibility with linenoise.cpp and llama-run.

Enhancements:

  • Refactors the setup_container function into smaller, more manageable functions to improve code readability and maintainability.

Chores:

  • Removes emoji usage from the prompt prefix to ensure compatibility with linenoise.cpp and llama-run.

Copy link
Contributor

sourcery-ai bot commented Feb 25, 2025

Reviewer's Guide by Sourcery

This pull request refactors the setup_container function in ramalama/model.py into smaller, more modular functions to improve readability and maintainability. It also removes emoji usage in the LLAMA_PROMPT_PREFIX environment variable due to compatibility issues.

Updated class diagram for Model class

classDiagram
  class Model {
    +setup_container(args)
    +gpu_args(args, runner=False)
    +build_exec_args_run(args, model_path, prompt)
    +get_container_name(args)
    +get_base_conman_args(args, name)
    +add_privileged_options(conman_args, args)
    +add_container_labels(conman_args, args)
    +add_subcommand_env(conman_args, args)
    +handle_podman_specifics(conman_args, args)
    +handle_docker_pull(conman_args, args)
    +add_tty_option(conman_args)
    +add_detach_option(conman_args, args)
    +add_port_option(conman_args, args)
    +add_device_options(conman_args, args)
    +add_network_option(conman_args, args)
  }
  Model : +get_container_name
  Model : +get_base_conman_args
  Model : +add_privileged_options
  Model : +add_container_labels
  Model : +add_subcommand_env
  Model : +handle_podman_specifics
  Model : +handle_docker_pull
  Model : +add_tty_option
  Model : +add_detach_option
  Model : +add_port_option
  Model : +add_device_options
  Model : +add_network_option
  note for Model "setup_container function refactored into smaller functions"
Loading

File-Level Changes

Change Details Files
Refactors the setup_container function into smaller, more manageable functions.
  • Extracts logic for determining the container name into get_container_name.
  • Creates get_base_conman_args to define base container arguments.
  • Introduces add_privileged_options to handle privileged container options.
  • Adds add_container_labels to manage container labels.
  • Creates add_subcommand_env to handle subcommand-specific environment variables.
  • Introduces handle_podman_specifics to manage podman specific arguments.
  • Adds handle_docker_pull to manage docker pull arguments.
  • Creates add_tty_option to handle tty arguments.
  • Introduces add_detach_option to handle detach arguments.
  • Adds add_port_option to manage port arguments.
  • Creates add_device_options to handle device arguments.
  • Introduces add_network_option to handle network arguments.
ramalama/model.py
Removes emoji usage in LLAMA_PROMPT_PREFIX environment variable.
  • Replaces emoji prefixes with text prefixes for both podman and docker.
  • Removes conditional emoji setting based on the EMOJI variable.
ramalama/model.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ericcurtin - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The proliferation of small functions makes the code harder to follow; consider grouping related operations into larger functions.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ericcurtin ericcurtin force-pushed the temp-rm-emoji-usage branch 4 times, most recently from 3a2f2c2 to fbfa766 Compare February 25, 2025 15:36
Less eyecandy, but at least this works, backspaces for example
were broken. Also split function into multiple functions, it was
getting meaty.

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
@rhatdan
Copy link
Member

rhatdan commented Feb 26, 2025

LGTM

@rhatdan rhatdan merged commit 56e3a71 into main Feb 26, 2025
17 checks passed
@ericcurtin ericcurtin deleted the temp-rm-emoji-usage branch February 26, 2025 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants