[PR #1266] feat(cli): add fuzzy search to model switcher #1264

Open
opened 2026-02-16 09:18:34 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagents/pull/1266
Author: @peterkolcza
Created: 2/11/2026
Status: 🔄 Open

Base: mainHead: feat/cli-fuzzy-model-search


📝 Commits (1)

  • 6f7cf1f feat(cli): add fuzzy search to model switcher

📊 Changes

2 files changed (+242 additions, -10 deletions)

View changed files

📝 libs/cli/deepagents_cli/widgets/model_selector.py (+18 -10)
📝 libs/cli/tests/unit_tests/test_model_selector.py (+224 -0)

📄 Description

Summary

Replace substring-based filtering in the /model selector with Textual's built-in Matcher (textual.fuzzy.Matcher) for fzf-style fuzzy matching. Users can now find models with partial or approximate names (e.g., "cs45" matches "claude-sonnet-4-5", "gpt4" matches "gpt-4o"). Results are ranked by match quality.

Fixes #1228

Changes

  • libs/cli/deepagents_cli/widgets/model_selector.py: Replace substring in check with Matcher scoring in _update_filtered_list(). No new dependencies — Matcher is part of the existing textual dependency. No public API changes.
  • libs/cli/tests/unit_tests/test_model_selector.py: Add 11 new tests covering fuzzy subsequence matching, cross-hyphen matching, case insensitivity, ranking, empty/whitespace filters, no-match edge case, selection clamping, and navigation after filtering.

How was this verified?

  • make format — passes
  • make lint — passes
  • make test — 949 tests pass (11 existing selector tests + 11 new fuzzy tests)
  • No new dependencies added

Areas requiring careful review

  • The Matcher import path (textual.fuzzy.Matcher) — confirmed via Textual source and docs
  • Flat sort by score relies on _update_display() to regroup by provider for rendering

AI disclaimer

This contribution was developed with the assistance of AI agents (Claude) for planning, research, code generation, and review.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/deepagents/pull/1266 **Author:** [@peterkolcza](https://github.com/peterkolcza) **Created:** 2/11/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/cli-fuzzy-model-search` --- ### 📝 Commits (1) - [`6f7cf1f`](https://github.com/langchain-ai/deepagents/commit/6f7cf1f831ae66890c507711047caba056a46b00) feat(cli): add fuzzy search to model switcher ### 📊 Changes **2 files changed** (+242 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `libs/cli/deepagents_cli/widgets/model_selector.py` (+18 -10) 📝 `libs/cli/tests/unit_tests/test_model_selector.py` (+224 -0) </details> ### 📄 Description ## Summary Replace substring-based filtering in the `/model` selector with Textual's built-in `Matcher` (`textual.fuzzy.Matcher`) for fzf-style fuzzy matching. Users can now find models with partial or approximate names (e.g., "cs45" matches "claude-sonnet-4-5", "gpt4" matches "gpt-4o"). Results are ranked by match quality. Fixes #1228 ## Changes - **`libs/cli/deepagents_cli/widgets/model_selector.py`**: Replace substring `in` check with `Matcher` scoring in `_update_filtered_list()`. No new dependencies — `Matcher` is part of the existing `textual` dependency. No public API changes. - **`libs/cli/tests/unit_tests/test_model_selector.py`**: Add 11 new tests covering fuzzy subsequence matching, cross-hyphen matching, case insensitivity, ranking, empty/whitespace filters, no-match edge case, selection clamping, and navigation after filtering. ## How was this verified? - `make format` — passes - `make lint` — passes - `make test` — 949 tests pass (11 existing selector tests + 11 new fuzzy tests) - No new dependencies added ## Areas requiring careful review - The `Matcher` import path (`textual.fuzzy.Matcher`) — confirmed via Textual source and docs - Flat sort by score relies on `_update_display()` to regroup by provider for rendering ## AI disclaimer This contribution was developed with the assistance of AI agents (Claude) for planning, research, code generation, and review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 09:18:34 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagents#1264