Skip to content

Fix crash from deprecated Cortex model + Python version constraint - #5

Open
Alishba007 wants to merge 2 commits into
streamlit:mainfrom
Alishba007:fix/deprecated-cortex-model
Open

Fix crash from deprecated Cortex model + Python version constraint#5
Alishba007 wants to merge 2 commits into
streamlit:mainfrom
Alishba007:fix/deprecated-cortex-model

Conversation

@Alishba007

@Alishba007 Alishba007 commented Jul 31, 2026

Copy link
Copy Markdown

Fixes #3

Problem
The app was crashing with an uncaught requests.exceptions.HTTPError
whenever a user sent a chat message. Root cause: MODEL was set to
"claude-4-sonnet", a Snowflake Cortex model that was deprecated on
2026-04-14 and fully retired on 2026-06-15. Every call to
complete() therefore hit an unavailable model and Cortex returned
a non-2xx response.

While reproducing this locally in a Codespace, I also hit a
dependency install failure: uv sync tried to build numba (a
transitive dependency via snowflake-ml-python) on Python 3.14,
which numba doesn't support yet. pyproject.toml only specified
requires-python = ">=3.12" with no upper bound, so any environment
that defaults to 3.14 (like a fresh Codespace) fails to install.

** Fix**

  • Updated MODEL to "claude-sonnet-4-6", the current supported
    Cortex model.
  • Wrapped the complete() call in get_response() in a try/except
    so a future model or API issue shows a friendly st.error message
    instead of crashing the app.
  • Constrained requires-python to ">=3.12,<3.14" so uv sync
    resolves to a Python version numba actually supports.

Testing
Verified locally in a GitHub Codespace:

  • Confirmed uv sync fails on Python 3.14 (numba build error) and
    succeeds cleanly on Python 3.12.
  • Confirmed the app now boots past the previous import/dependency
    errors with the corrected requires-python.
  • Full end-to-end chat testing requires a configured Snowflake
    account (per the README's Snowflake backend setup), which I don't
    have access to, so I wasn't able to verify the live model response
    end-to-end. Happy to have a maintainer confirm that part.

- MODEL was set to 'claude-4-sonnet', a Snowflake Cortex model
  deprecated on 2026-04-14 and fully retired on 2026-06-15. This
  caused an uncaught HTTPError on every chat request. Updated to
  claude-sonnet-4-6, the current supported model.
- Added error handling around the completion call so future model
  issues surface as a friendly message instead of a crash.
- Constrained requires-python to >=3.12,<3.14 in pyproject.toml,
  since numba (a transitive dependency via snowflake-ml-python)
  does not yet support Python 3.14. Without this cap, uv sync fails
  on any environment (e.g. a fresh Codespace) that defaults to
  Python 3.14.
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.

Crash upon sending a prompt.

1 participant