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

Check model and model parser ids strings for spaces, strip them #1114

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Feb 5, 2024

  1. Check model and model parser ids strings for spaces, strip them

    Tanya noticed a bug when we accidentally added "field " with a space instead of "field", so trimming the value.
    
    I originally tried to fix this in the editor config itself in `SettingsPropertyRenderer`, but that was complicated since it meant that this would reset the string value state for the string, and you couldn't keep typing empty spaces at the begininng or end of strings otherwise it would keep trimming them. Therefore, I decided to make this change in all places where we set the model names or fields for main SDK. This may seem a bit controversial (ex: you now can't have two separate models called "  my_model  " vs. "my_model" but I feel this is fine
    
    Note: I changed both the getter and setter methods, so this will be a breaking change for existing AIConfigs that have leading or trailing whitespace in the (model)/(model parser) names
    
    ## Test Plan
    ```
    aiconfig_path=./cookbooks/Gradio/huggingface.aiconfig.json
    parsers_path=./cookbooks/Gradio/aiconfig_model_registry.py
    aiconfig edit --aiconfig-path=$aiconfig_path --server-port=8080 --server-mode=debug_servers --parsers-module-path=$parsers_path
    ```
    It now works with leading or trailing whitespace
    
    https://github.com/lastmile-ai/aiconfig/assets/151060367/116b4ef4-b1f9-4a15-9d07-e1fb9d995245
    Rossdan Craig rossdan@lastmileai.dev committed Feb 5, 2024
    Configuration menu
    Copy the full SHA
    24c6cff View commit details
    Browse the repository at this point in the history