-
Notifications
You must be signed in to change notification settings - Fork 63
schema: classify transcription models + add gpt-transcribe + audio media types #1121
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import type { ModelFormat, ModelName } from "./models"; | ||
| import { getAvailableModels, type ModelFormat } from "./models"; | ||
|
|
||
| const IMAGE_MEDIA_TYPES = [ | ||
| "image/jpeg", | ||
|
|
@@ -39,6 +39,10 @@ const AUDIO_MEDIA_TYPES = [ | |
| "audio/mpeg", | ||
| "audio/mp4", | ||
| "audio/webm", | ||
| "audio/flac", | ||
| "audio/ogg", | ||
| "audio/m4a", | ||
| "audio/x-m4a", | ||
| ] as const; | ||
|
|
||
| const VIDEO_MEDIA_TYPES = [ | ||
|
|
@@ -132,22 +136,27 @@ export const ModelFormatMediaTypes: { | |
| /** | ||
| * Overrides for specific models to support additional media types. | ||
| */ | ||
| export const ModelMediaTypeOverrides: { | ||
| [model in ModelName]?: MediaTypeSupport; | ||
| } = { | ||
| export const ModelMediaTypeOverrides: Partial< | ||
| Record<string, MediaTypeSupport> | ||
| > = { | ||
| // will be useful for gpt-audio | ||
| }; | ||
|
|
||
| export function getSupportedMediaTypes( | ||
| format: ModelFormat, | ||
| model?: ModelName, | ||
| model?: string, | ||
| ): Set<string> { | ||
| const baseSupport = { ...ModelFormatMediaTypes[format] }; | ||
|
|
||
| if (model && ModelMediaTypeOverrides[model]) { | ||
| Object.assign(baseSupport, ModelMediaTypeOverrides[model]); | ||
| } | ||
|
|
||
| // Transcription models take an audio file regardless of provider format. | ||
| if (model && getAvailableModels()[model]?.transcription) { | ||
| Object.assign(baseSupport, toMediaTypeSupport(AUDIO_MEDIA_TYPES)); | ||
|
Comment on lines
+155
to
+157
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a flagged OpenAI transcription model is selected, AGENTS.md reference: AGENTS.md:L6-L12 Useful? React with 👍 / 👎.
Comment on lines
+155
to
+157
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a browser reports a supported AGENTS.md reference: AGENTS.md:L6-L12 Useful? React with 👍 / 👎. |
||
| } | ||
|
|
||
| return new Set( | ||
| Object.entries(baseSupport) | ||
| .filter(([_, supported]) => supported) | ||
|
|
@@ -158,7 +167,7 @@ export function getSupportedMediaTypes( | |
| export function isMediaTypeSupported( | ||
| mediaType: string, | ||
| format: ModelFormat, | ||
| model?: ModelName, | ||
| model?: string, | ||
| ): boolean { | ||
| return getSupportedMediaTypes(format, model).has(mediaType); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This model-aware media filtering determines which files the transcription request path accepts, so it is request/upload shaping in the deprecated proxy. The root
AGENTS.mdassigns that behavior to the parentgateway/implementation and permits only the catalog JSON exception here; keeping active behavior in this package risks the gateway and deprecated proxy diverging. Move this logic to the paired gateway change and retain only the catalog update here.AGENTS.md reference: AGENTS.md:L6-L15
Useful? React with 👍 / 👎.