-
Notifications
You must be signed in to change notification settings - Fork 32
Remove sub-optimal model warning, update model list and dependencies --> fixes problem due to recent updates to models and apis. #66
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
Conversation
…--> fixes problem due to recent updates to models and apis.
Caution Review failedThe pull request is closed. ## Walkthrough
This update revises dependency versions, modifies prompt instructions, adjusts model selection logic, clarifies type hints, and improves robustness in model sorting and filtering. It also includes minor documentation and whitespace changes, along with a regular expression correction for HTML text extraction.
## Changes
| File(s) | Change Summary |
|------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|
| setup.cfg | Updated package version to v2025.06.25 and `duckduckgo-search` dependency from 6.3.2 to 8.0.4. |
| src/napari_chatgpt/_widget.py | Removed warning dialog and console warning for non-GPT4/Claude-3 LLM model selection in `_start_omega`. |
| src/napari_chatgpt/omega/tools/instructions.py | Added instruction to import 'ArrayLike' from 'numpy.typing' when required. |
| src/napari_chatgpt/omega/tools/napari/cell_nuclei_segmentation_tool.py | Clarified segmentation prompt to require `segment(viewer)` returning an array, removing explicit type hint. |
| src/napari_chatgpt/omega/tools/napari/widget_maker_tool.py | Removed two trailing blank lines from `_instructions` string literal. |
| src/napari_chatgpt/utils/anthropic/model_list.py | Refactored and expanded Anthropic model list; updated return type to `list[str]`; improved docstring and logging.|
| src/napari_chatgpt/utils/api_keys/api_key.py | Added a blank line after API key dialog call for readability; no logic change. |
| src/napari_chatgpt/utils/openai/default_model.py | Wrapped version string float conversion in try-except to handle non-numeric versions gracefully in sorting. |
| src/napari_chatgpt/utils/openai/gpt_vision.py | Changed default GPT-vision model names in `is_gpt_vision_available` and `describe_image` functions. |
| src/napari_chatgpt/utils/openai/model_list.py | Added filtering to exclude models with substrings like 'vision', 'instruct', 'preview', etc., from model list. |
| src/napari_chatgpt/utils/web/scrapper.py | Changed regex pattern to raw string for whitespace normalization in `text_from_html` function. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant User
participant Widget
participant ModelSelector
participant OmegaServer
User->>Widget: Selects LLM model
Widget->>ModelSelector: Get selected model
ModelSelector-->>Widget: Returns model name
Widget->>OmegaServer: Starts Omega with selected model Possibly related PRs
Poem
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/napari_chatgpt/utils/anthropic/model_list.py (1)
8-8
: Verify the future verification date.The verification date shows "2025-06-25" which appears to be in the future. Please ensure this date is accurate.
src/napari_chatgpt/utils/openai/model_list.py (1)
51-53
: Good filtering logic to exclude specialized models.The filtering approach effectively removes models that are typically unsuitable for general chat purposes (vision, audio, preview, instruct variants). This aligns well with the PR objective of improving model selection.
Consider if this filtering might be too broad - some models containing these substrings might still be useful in specific contexts. However, for the general use case this filtering appears appropriate.
src/napari_chatgpt/utils/openai/gpt_vision.py (1)
32-32
: Consider model consistency between vision functions.The default model has been updated to
"gpt-4o"
while theis_gpt_vision_available
function uses'gpt-4'
as default. Consider whether these functions should use the same default model for consistency, especially since they both relate to vision capabilities.If both functions should use the same model, consider extracting a constant:
+# Default vision model +DEFAULT_VISION_MODEL = "gpt-4o" + def is_gpt_vision_available(vision_model_name: str = DEFAULT_VISION_MODEL) -> bool:def describe_image(image_path: str, query: str = 'Here is an image, please carefully describe it in detail.', - model: str = "gpt-4o", + model: str = DEFAULT_VISION_MODEL,
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
setup.cfg
(1 hunks)src/napari_chatgpt/_widget.py
(0 hunks)src/napari_chatgpt/omega/tools/instructions.py
(1 hunks)src/napari_chatgpt/omega/tools/napari/cell_nuclei_segmentation_tool.py
(1 hunks)src/napari_chatgpt/omega/tools/napari/widget_maker_tool.py
(0 hunks)src/napari_chatgpt/utils/anthropic/model_list.py
(1 hunks)src/napari_chatgpt/utils/api_keys/api_key.py
(1 hunks)src/napari_chatgpt/utils/openai/default_model.py
(1 hunks)src/napari_chatgpt/utils/openai/gpt_vision.py
(2 hunks)src/napari_chatgpt/utils/openai/model_list.py
(1 hunks)src/napari_chatgpt/utils/web/scrapper.py
(1 hunks)
💤 Files with no reviewable changes (2)
- src/napari_chatgpt/omega/tools/napari/widget_maker_tool.py
- src/napari_chatgpt/_widget.py
🔇 Additional comments (9)
src/napari_chatgpt/omega/tools/instructions.py (1)
26-26
: LGTM! Good addition for type hinting best practices.This instruction clearly guides developers to import
ArrayLike
from the proper location when type annotations are needed, following NumPy's recommended typing practices.src/napari_chatgpt/omega/tools/napari/cell_nuclei_segmentation_tool.py (1)
182-182
: LGTM! Good flexibility improvement while maintaining clarity.Removing the mandatory
-> ArrayLike
type hint requirement makes the instruction more flexible, while still clearly communicating that the function should return an array. This pairs well with the ArrayLike import guidance added to the instructions file.setup.cfg (1)
58-58
: ```shell
#!/bin/bashFetch release notes for 7.x and 8.x major versions from GitHub
echo "Retrieving release notes for duckduckgo_search 7.x and 8.x:"
curl -s https://api.github.com/repos/deedy5/duckduckgo_search/releases?per_page=100
| jq -r '.[]
| select(.tag_name | test("^[78]\."))
| "Tag: (.tag_name)\n(.body // "No release notes")\n---"'</details> <details> <summary>src/napari_chatgpt/utils/api_keys/api_key.py (1)</summary> `49-49`: **Good formatting improvement.** The added blank line improves readability by clearly separating the API key request logic from the Qt app cleanup section. </details> <details> <summary>src/napari_chatgpt/utils/anthropic/model_list.py (2)</summary> `4-4`: **Excellent type annotation improvement.** The specific `list[str]` return type annotation is much better than the generic `list` type for better type safety and IDE support. --- `11-20`: **Verify the existence of newer model names.** Some of the models in the list appear to have future release dates or may not exist yet. Please verify these model names are valid and available: - `claude-3-7-sonnet-20250219` (February 2025 date) - `claude-sonnet-4-20250514` (May 2025 date) - `claude-opus-4-20250514` (May 2025 date) ```web Are the following Anthropic Claude models currently available: claude-3-7-sonnet-20250219, claude-sonnet-4-20250514, claude-opus-4-20250514?
src/napari_chatgpt/utils/web/scrapper.py (1)
62-62
: Good regex pattern fix using raw string.Using a raw string
r"\s\s+"
instead of a regular string"\s\s+"
is the correct approach for regex patterns to avoid issues with escape sequence interpretation.src/napari_chatgpt/utils/openai/default_model.py (1)
33-39
: LGTM! Excellent error handling improvement.The try-except block properly handles edge cases where model version strings cannot be converted to float, ensuring robust model sorting. Using
float('inf')
to sort problematic models last is a smart approach that prevents crashes while maintaining predictable behavior.src/napari_chatgpt/utils/openai/gpt_vision.py (1)
7-7
: Verify that 'gpt-4' supports vision capabilities.The default model has been updated from
'gpt-4-vision-preview'
to'gpt-4'
. Please ensure that the standard'gpt-4'
model supports vision functionality, as this function specifically checks for GPT-vision availability.#!/bin/bash # Description: Check if 'gpt-4' model supports vision capabilities by searching for documentation or usage patterns rg -A 5 -B 2 "gpt-4.*vision\|vision.*gpt-4" --type py
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Other