Skip to content

Commit

Permalink
Fixes error when allowed or blocked model list is passed in config (#855
Browse files Browse the repository at this point in the history
)

* Fixes error when allowed or blocked model list is passed in config.

* Simplified null check.
  • Loading branch information
3coins authored Jun 26, 2024
1 parent 2d392b7 commit cee178b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/jupyter-ai/jupyter_ai/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,12 @@ def filter_predicate(local_model_id: str):

# filter out every model w/ model ID according to allow/blocklist
for provider in providers:
provider.models = list(filter(filter_predicate, provider.models))
provider.chat_models = list(filter(filter_predicate, provider.chat_models))
provider.models = list(filter(filter_predicate, provider.models or []))
provider.chat_models = list(
filter(filter_predicate, provider.chat_models or [])
)
provider.completion_models = list(
filter(filter_predicate, provider.completion_models)
filter(filter_predicate, provider.completion_models or [])
)

# filter out every provider with no models which satisfy the allow/blocklist, then return
Expand Down

0 comments on commit cee178b

Please sign in to comment.