Skip to content

Add optional video input to the chat completions input path - #63

Open
octo-patch wants to merge 1 commit into
kennethreitz:mainfrom
octo-patch:octo/20260817-input-capability-recvs9bRd3N4y6
Open

Add optional video input to the chat completions input path#63
octo-patch wants to merge 1 commit into
kennethreitz:mainfrom
octo-patch:octo/20260817-input-capability-recvs9bRd3N4y6

Conversation

@octo-patch

Copy link
Copy Markdown

Reason: the chat-completions input path builds only text and image content parts, so models that also accept video input cannot receive it.

Summary

  • Add an optional, keyword-only video_url argument to generate_text, generate_stream_text, and structured_response, mirroring the existing image_url argument.
  • Append a {"type": "video_url", "video_url": {"url": ...}} content part only when the caller passes a video, so text-only and image requests keep their current payload.
  • Add offline tests that assert the content parts sent for text-only, image, video, and combined image plus video inputs across all three methods.

Notes

  • The change is additive: no existing signature, default or request payload changes when video_url is not passed.
  • Providers that subclass this compatible chat path inherit the video input capability without further changes.
  • The tests stub the client through the cached properties, so they need no API key and make no network calls.

Checks

  • ruff check simplemind/providers/openai.py tests/test_input_modalities.py (all checks passed)
  • ruff format --diff tests/test_input_modalities.py (1 file already formatted)
  • python3 -m compileall -q simplemind tests (passed)
  • python3 -m pytest -q tests/test_input_modalities.py tests/test_basics.py (8 passed)
  • python3 -m pytest -q --collect-only tests (36 tests collected)

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