Skip to content

fix(types): use in_memory prompt_cache_retention literal#2989

Open
theamodhshetty wants to merge 1 commit intoopenai:mainfrom
theamodhshetty:codex/fix-prompt-cache-retention-literal
Open

fix(types): use in_memory prompt_cache_retention literal#2989
theamodhshetty wants to merge 1 commit intoopenai:mainfrom
theamodhshetty:codex/fix-prompt-cache-retention-literal

Conversation

@theamodhshetty
Copy link

Summary

  • replace the hyphenated "in-memory" prompt cache retention literal with "in_memory" across the Python SDK type surface
  • update the generated chat and responses resource method signatures to match
  • update the generated API-resource tests to use the accepted underscore form

Why

The SDK currently types prompt_cache_retention as "in-memory" | "24h", but the API expects "in_memory" | "24h". That makes the typed value fail at runtime and also leaves the generated request helpers internally inconsistent.

Testing

  • ./.venv/bin/ruff check src/openai/resources/chat/completions/completions.py src/openai/resources/responses/responses.py src/openai/types/chat/completion_create_params.py src/openai/types/responses/response.py src/openai/types/responses/response_create_params.py src/openai/types/responses/responses_client_event.py src/openai/types/responses/responses_client_event_param.py tests/api_resources/chat/test_completions.py tests/api_resources/test_responses.py
  • ./.venv/bin/pyright -p pyproject.toml src/openai/resources/chat/completions/completions.py src/openai/resources/responses/responses.py src/openai/types/chat/completion_create_params.py src/openai/types/responses/response.py src/openai/types/responses/response_create_params.py src/openai/types/responses/responses_client_event.py src/openai/types/responses/responses_client_event_param.py tests/api_resources/chat/test_completions.py tests/api_resources/test_responses.py
  • ./.venv/bin/mypy src/openai/resources/chat/completions/completions.py src/openai/resources/responses/responses.py src/openai/types/chat/completion_create_params.py src/openai/types/responses/response.py src/openai/types/responses/response_create_params.py src/openai/types/responses/responses_client_event.py src/openai/types/responses/responses_client_event_param.py

Notes

I also updated the affected generated API-resource tests, but I did not run those end-to-end locally because this checkout does not currently have the repo mock server running on 127.0.0.1:4010.

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