Repository navigation
Add Python text and image prompt support - #524
Merged
Merged
Conversation
Add typed prompt parts and shared validation for the HTTP and configured-client Chat Completions paths, preserving string callers and image context during repair. Include optional temperature configuration, regression tests, and documentation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the backward-compatible Python text/image prompt changes.
No open issues 🎉
What changed in this PR
Adds backward-compatible Python text/image prompts to TypeChat’s existing Chat Completions models and translator context, addressing #517 without changing the prompt layout or adding a Responses backend.
Changes:
- Exports typed prompt parts and shares structural validation across HTTP and configured-client models.
- Adds optional temperature configuration, including omission with
None, while keeping0.0as the default. - Adds offline regression tests, static-type coverage, and documentation for image prompts and repair behavior.
| File | Description |
|---|---|
site/src/docs/python/basic-usage.md |
Documents image prompts, supported limits, and temperature configuration. |
python/tests/test_prompt_types.py |
Checks public prompt types and documentation example consistency. |
python/tests/test_multimodal_model.py |
Covers multimodal validation, forwarding, repair, and existing model controls. |
python/tests/test_create_language_model.py |
Checks temperature forwarding across HTTP model factories. |
python/src/typechat/_internal/model.py |
Implements prompt types, shared validation, temperature options, and text-only response checks. |
python/src/typechat/__init__.py |
Exports the new public prompt types. |
python/README.md |
Adds image-prompt examples and temperature guidance. |
Review effort: Balanced
Tal Zaccai (TalZaccai)
approved these changes
Nov 6, 2026
robgruen
added a commit
that referenced
this pull request
Nov 6, 2026
Integrate merged PR #524 with the explicit Responses API work. Preserve shared prompt validation, image references, repair context, and Chat Completions temperature settings. Map Responses assistant text to output_text, with deterministic and live regression verification. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add backward-compatible Python text/image prompts through the existing Chat Completions model and translator-context interfaces, implementing the accepted P2 scope.
PromptContent,TextPromptContent,ImagePromptContent, andImageUrldictionary types while preserving existing string callers.temperaturesetting across model factories: retain0.0by default;Noneomits the parameter for reasoning-model compatibility.Fixes #517.
Verification
hatch run teston Python 3.11.18: 418 passed, 3 Python-version-dependent skips; 19 snapshots passed. Rerun before publication.npm run checkwith Node 24.22.1: 0 errors, 0 warnings. Rerun before publication.git diff --check: passed.temperature=None: 10 endpoint requests passed across the HTTP/token-provider model and an actual configuredAsyncAzureOpenAIadapter. Covered strings, low/high-detail mixed image prompts, immediate typed image translation, and image-preserving repair with a locally injected invalid first candidate.Scope notes
The current prompt arrangement is unchanged; this does not adopt #241 or implement the separate Python Responses work in #518. Existing TypeScript image types and the contributed image example are unchanged.