Skip to content

Conversation

@yujonglee
Copy link
Contributor

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Jul 7, 2025

📝 Walkthrough

Walkthrough

The changes introduce support for a new model variant "HyprLLM" across Rust and TypeScript codebases, including grammar selection logic and model metadata handling. Grammar constants and enum variants are refactored for finer control. Template prompts and shell scripts are updated for new directives and paths, and a new GBNF grammar file is added.

Changes

File(s) Change Summary
crates/gbnf/assets/enhance-other.gbnf Added a new GBNF grammar file defining rules for parsing <think> blocks and content.
crates/gbnf/src/lib.rs Split Enhance grammar into EnhanceOther and EnhanceHypr constants and enum variants; updated builder.
crates/llama/src/lib.rs Introduced ModelName enum, added name field to Llama, updated model loading and sampler config.
crates/template/assets/create_title.user.jinja Added /no_think directive after the title prompt.
crates/template/assets/enhance.user.jinja Appended /think directive at the end of the file.
plugins/local-llm/js/bindings.gen.ts Extended SupportedModel type alias to include "HyprLLM".
plugins/local-llm/src/local/model.rs Added HyprLLM variant to SupportedModel enum; updated associated methods for file, URL, and size.
plugins/local-llm/src/server.rs Refactored grammar selection into select_grammar function; supports model-specific grammar for "enhance".
scripts/s3/upload.sh Changed upload source path and enabled trace logging for S3 uploads.

Sequence Diagram(s)

Model Loading and Grammar Selection

sequenceDiagram
    participant Client
    participant Server
    participant Llama
    participant GBNF

    Client->>Server: Request with model and grammar metadata
    Server->>Llama: Load model
    Llama->>Llama: Read metadata, set ModelName (HyprLLM or Other)
    Server->>Server: select_grammar(model_name, task)
    Server->>GBNF: build grammar for model/task
    GBNF-->>Server: Return grammar string
    Server-->>Client: Response using selected grammar
Loading

Supported Model Handling in Local LLM

sequenceDiagram
    participant User
    participant LocalLLM
    participant Model

    User->>LocalLLM: Select model (e.g., "HyprLLM")
    LocalLLM->>Model: file_name(), model_url(), model_size()
    Model-->>LocalLLM: Return model-specific info
    LocalLLM-->>User: Model loaded and ready
Loading

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Clippy (1.86.0)
Updating git repository `https://github.com/RustAudio/cpal`

error: failed to load source for dependency cpal

Caused by:
Unable to update https://github.com/RustAudio/cpal?rev=51c3b43#51c3b43c

Caused by:
failed to create directory /usr/local/git/db/cpal-476cd1dd23dbc279

Caused by:
Permission denied (os error 13)

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
plugins/local-llm/src/local/model.rs (1)

1-1: Critical: Update SUPPORTED_MODELS array.

The array size is still 1 and only includes Llama3p2_3bQ4, but now there are two supported models. This will cause the new HyprLLM model to be unavailable.

Apply this fix:

-pub static SUPPORTED_MODELS: &[SupportedModel; 1] = &[SupportedModel::Llama3p2_3bQ4];
+pub static SUPPORTED_MODELS: &[SupportedModel; 2] = &[SupportedModel::Llama3p2_3bQ4, SupportedModel::HyprLLM];
🧹 Nitpick comments (2)
scripts/s3/upload.sh (1)

9-12: --log trace is useful for debugging but noisy in CI—gate it behind a flag.

Full trace logging can produce very large logs and slow down jobs. Expose it via an env var so the default remains concise:

-    --log trace \
+    ${S3CMD_LOG_LEVEL:+--log "$S3CMD_LOG_LEVEL"} \

Callers can then opt-in with S3CMD_LOG_LEVEL=trace.

crates/llama/src/lib.rs (1)

235-239: Consider performance impact of debug token printing.

The debug build behavior prints each token immediately with stdout flushing. While useful for debugging, this could impact performance during development. Consider if this level of output is necessary.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3b19a8e and bc111bb.

📒 Files selected for processing (9)
  • crates/gbnf/assets/enhance-other.gbnf (1 hunks)
  • crates/gbnf/src/lib.rs (1 hunks)
  • crates/llama/src/lib.rs (8 hunks)
  • crates/template/assets/create_title.user.jinja (1 hunks)
  • crates/template/assets/enhance.user.jinja (1 hunks)
  • plugins/local-llm/js/bindings.gen.ts (1 hunks)
  • plugins/local-llm/src/local/model.rs (1 hunks)
  • plugins/local-llm/src/server.rs (2 hunks)
  • scripts/s3/upload.sh (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{js,ts,tsx,rs}`: 1. No error handling. 2. No unused imports, variables, or functions. 3. For comments, keep it minimal. It should be about "Why", not "What".

**/*.{js,ts,tsx,rs}: 1. No error handling.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".

⚙️ Source: CodeRabbit Configuration File

List of files the instruction was applied to:

  • plugins/local-llm/js/bindings.gen.ts
  • plugins/local-llm/src/local/model.rs
  • plugins/local-llm/src/server.rs
  • crates/gbnf/src/lib.rs
  • crates/llama/src/lib.rs
🧬 Code Graph Analysis (1)
plugins/local-llm/js/bindings.gen.ts (1)
plugins/local-stt/js/bindings.gen.ts (1)
  • SupportedModel (69-69)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: ci (macos, macos-latest)
  • GitHub Check: ci (windows, windows-latest)
  • GitHub Check: ci
🔇 Additional comments (18)
crates/template/assets/create_title.user.jinja (1)

6-7: LGTM: Clean directive addition.

The /no_think directive is appropriately placed after the title generation prompt.

crates/template/assets/enhance.user.jinja (1)

23-24: LGTM: Appropriate directive placement.

The /think directive complements the conditional thinking logic for HyprLocal type.

plugins/local-llm/js/bindings.gen.ts (1)

49-49: LGTM: Consistent type definition.

The SupportedModel type union correctly includes the new HyprLLM variant, maintaining consistency with the Rust backend.

plugins/local-llm/src/local/model.rs (4)

6-6: LGTM: Clean enum extension.

The HyprLLM variant is properly added to the enum.


13-13: LGTM: Appropriate filename.

The filename "hypr-llm.gguf" follows the naming convention.


20-20: LGTM: Valid model URL.

The URL points to the correct HyprLLM model file.


27-27: LGTM: Reasonable model size.

The model size (1107409056 bytes ≈ 1.03 GB) is appropriate for the model.

crates/gbnf/assets/enhance-other.gbnf (1)

1-6: LGTM: Well-formed grammar definition.

The GBNF grammar correctly defines the structure for <think> blocks with 1-4 formatted lines followed by arbitrary content.

crates/gbnf/src/lib.rs (3)

1-2: LGTM! Clear separation of grammar constants.

The addition of separate constants for EnhanceOther and EnhanceHypr grammars follows the established pattern and provides clear distinction between model-specific grammar handling.


7-8: LGTM! Enum variants match the grammar separation.

The EnhanceOther and EnhanceHypr variants appropriately represent the split grammar functionality and maintain consistency with the constant naming convention.


16-17: LGTM! Correct enum-to-constant mapping.

The match arms correctly map each enum variant to its corresponding constant, maintaining the established pattern for grammar retrieval.

plugins/local-llm/src/server.rs (2)

270-276: LGTM! Clean refactoring of grammar selection logic.

The extraction of grammar selection into a dedicated helper function improves code organization and readability. The parameter mapping correctly passes the model name and grammar task from the request metadata.


333-343: LGTM! Well-structured grammar selection logic.

The select_grammar function provides clear model-specific grammar selection:

  • Distinguishes between HyprLLM and other models for the "enhance" task
  • Maps standard tasks to their corresponding grammar variants
  • Returns None for unknown tasks, allowing fallback behavior

The implementation aligns with the grammar separation introduced in the GBNF module.

crates/llama/src/lib.rs (5)

26-29: LGTM! Well-designed enum for model type distinction.

The ModelName enum provides clear type-safe distinction between HyprLLM and other models. The Other variant with Option<String> allows for potential future model name tracking while maintaining flexibility.


32-32: LGTM! Appropriate struct extension.

Adding the name field to the Llama struct enables model-specific behavior and aligns with the grammar selection requirements introduced in the server module.


265-269: LGTM! Robust model name detection logic.

The model name detection correctly:

  • Checks the general.name metadata field
  • Maps "hypr-llm" to ModelName::HyprLLM
  • Handles both valid names and missing metadata gracefully
  • Provides fallback behavior for unknown cases

383-383: LGTM! Test updated to use new grammar variant.

The test correctly uses EnhanceOther instead of the previous Enhance variant, aligning with the grammar separation changes.


88-93: Confirm sampler configuration for Qwen3-1.7B-GGUF

The model Qwen/Qwen3-1.7B-GGUF is valid (pipeline: text-generation), but the chosen sampling hyperparameters are highly task-dependent. Please verify that these settings produce the desired balance of creativity, coherence, and generation speed in your use case.

• File: crates/llama/src/lib.rs (lines 88–93)
• Current settings:

  • Temperature: 0.6
  • Penalties: (repeat_last_n=0, repeat_penalty=1.4, repeat_penalty_slope=0.1, repeat_penalty_scale=1.3)
  • Mirostat V2: (seed=1234, tau=3.0, eta=0.2)

If you need a different generation profile (e.g., higher diversity or stricter repetition control), adjust these values accordingly or benchmark against sample prompts.

@yujonglee
Copy link
Contributor Author

https://storage.hyprnote.com/v0/yujonglee/hypr-llm-sm/model_q4_k_m.gguf

@yujonglee yujonglee changed the title Deploy hypr-llm-sm hypr-llm deployment groundwork Jul 7, 2025
@yujonglee yujonglee merged commit 67cb688 into main Jul 7, 2025
5 checks passed
@yujonglee yujonglee deleted the deploy-hypr-llm branch July 7, 2025 22:00
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