feat(audio): add native audio support to type system and model clients

- Add AudioSource interface and 'audio' variant to MessageContentPart union
- Update buildUserMessage() to create audio content parts from attachments
- Add attachmentToAudioSource(), hasAudio(), stripAudioParts() helpers
- Gemini: native audio via inlineData (same format as images)
- OpenAI/GitHub: native audio via input_audio content parts
- Anthropic/Bedrock: graceful fallback to transcript text
- Update getMessageTextWithTools() to handle audio blocks for local models
This commit is contained in:
William Valentin
2026-02-11 18:17:33 -08:00
parent a875bcc4ae
commit 32e1a2724a
8 changed files with 169 additions and 22 deletions
+5
View File
@@ -10,15 +10,20 @@ export { withRetry, isRetryable, DEFAULT_RETRY_CONFIG, type RetryConfig } from '
export { estimateCost, MODEL_COSTS_PER_MILLION } from './costs.js';
export {
isSupportedImage,
isSupportedAudio,
attachmentToImageSource,
attachmentToAudioSource,
buildUserMessage,
getMessageText,
hasImages,
hasAudio,
stripAudioParts,
} from './media.js';
export type {
Message,
MessageContentPart,
ImageSource,
AudioSource,
ChatRequest,
ChatResponse,
ChatStreamEvent,