Skip to content

Fix default model options when constructing Prompt directly - #1663

Open
oodadoudou wants to merge 1 commit into
simonw:mainfrom
oodadoudou:codex/prompt-default-model-options
Open

Fix default model options when constructing Prompt directly#1663
oodadoudou wants to merge 1 commit into
simonw:mainfrom
oodadoudou:codex/prompt-default-model-options

Conversation

@oodadoudou

Copy link
Copy Markdown

Directly constructing llm.Prompt("hello", model) leaves prompt.options as a dict. Providers that access option attributes then raise AttributeError; this also reproduces with the built-in OpenAI Responses provider on current main.

Use the model's Options() for the existing empty/default fallback. Explicit Options instances remain unchanged. Four regression cases exercise the public Prompt/Response path using the existing mocked HTTP response fixture: omitted options, None, an empty dict, and a populated Options instance.

Fixes #1028.

Validation (Python 3.12.9):

  • Before the fix, all three default-option cases fail on prompt.options.json_object; the explicit-options control passes. After the fix, all 13 options tests pass.
  • Full suite: 1,128 passed (18 warnings).
  • Black, Ruff, mypy and package build pass.
  • Local tests use httpx2-pytest==1.0.1: version 2.0.0 renames the httpx_mock fixture required by the existing suite. No dependency files changed.
  • Cog reports an existing version mismatch in unchanged docs/fragments.md (0.33) versus pyproject.toml (0.34), also present on the base commit 2f49eec9.

Implemented and tested with Codex assistance.

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.

When creating Prompt from python code, it doesn't get the correct options type

1 participant