Skip to content

fix(openai): support major-only GPT cache model IDs - #22

Open
JakubSchwenkbeck wants to merge 2 commits into
lm15-dev:mainfrom
JakubSchwenkbeck:fix/gpt6-model-ids-prompt-cache
Open

JakubSchwenkbeck wants to merge 2 commits into
lm15-dev:mainfrom
JakubSchwenkbeck:fix/gpt6-model-ids-prompt-cache

Conversation

@JakubSchwenkbeck

Copy link
Copy Markdown

Summary

OpenAI GPT-6 model IDs such as gpt-6-luna do not include a minor version component. The existing cache-capability matcher only recognized IDs matching gpt-<major>.<minor>, so these models did not receive:

{"prompt_cache_options": {"mode": "explicit"}}

when using an explicit prompt-cache breakpoint.

This PR updates the matcher to support both:

  • gpt-<major>.<minor>-..., such as gpt-5.6-luna
  • gpt-<major>-..., such as gpt-6-luna

It also adds regression coverage for major-only GPT-6 IDs.

Changes

  • Make the GPT minor version optional in _GPT_VERSION_RE.
  • Treat a major-only model version as minor version 0.
  • Preserve the existing threshold of GPT-5.6 and later.
  • Add gpt-6-luna to the cache mapping tests.

Validation

python -m pytest tests/test_cache_mapping.py -q
17 passed

Origin

This fix addresses a DSPy integration issue where GPT-6 model IDs were sent a
prompt_cache_breakpoint without the corresponding explicit cache mode.

This contribution was prepared with assistance from GitHub Copilot SDK in VS Code.
The behavior was reproduced locally and verified with the focused test suite.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

1 participant