8000 Add AudioBytes Class and OpenAI Model Support for Audio Input by engine-labs-app[bot] · Pull Request #446 · jackmpcollins/magentic · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add AudioBytes Class and OpenAI Model Support for Audio Input #446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

engine-labs-app[bot]
Copy link
@engine-labs-app engine-labs-app bot commented May 14, 2025

Summary

This PR introduces the AudioBytes class to represent audio input bytes and enhances OpenAI chat model support to accept audio (WAV) input as part of user messages. It also ensures consistent type annotations and casting throughout the codebase to maintain compatibility with static type checkers and newer Python standards.

Details

  • Adds AudioBytes class in chat_model/message.py for audio (WAV) input and validates MIME type.
  • Incorporates AudioBytes into UserMessageContentBlock for message flexibility.
  • Serializes AudioBytes correctly in OpenAI chat model and allows their use in user content.
  • Updates OpenAI user message conversion and formatting for audio blocks.
  • Exports AudioBytes from the main module for external availability.
  • Updates all typing.cast() usage to use string literal type expressions as required by PEP 695 and enforced by tooling, ensuring correct syntax and compatibility throughout the repo.
  • Fixes Python formatting, and ensures function signatures and test type hints match new standards.

Copy link
Author

Engine is processing your review feedback and will update the code shortly...

Copy link
Author

Engine is processing your review feedback and will update the code shortly...

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.

0 participants
0