MCPcopy Index your code
hub / github.com/simstudioai/sim / isMimeTypeSupportedByProvider

Function isMimeTypeSupportedByProvider

apps/sim/providers/attachments.ts:274–316  ·  view source on GitHub ↗
(
  provider: AttachmentProvider,
  mimeType: string,
  contentType: PreparedProviderAttachment['contentType'],
  extension: string
)

Source from the content-addressed store, hash-verified

272}
273
274function isMimeTypeSupportedByProvider(
275 provider: AttachmentProvider,
276 mimeType: string,
277 contentType: PreparedProviderAttachment['contentType'],
278 extension: string
279): boolean {
280 switch (provider) {
281 case 'openai':
282 return isImageMimeType(mimeType) || isOpenAIDocumentMimeType(mimeType)
283 case 'anthropic':
284 return (
285 isImageMimeType(mimeType) || mimeType === PDF_MIME_TYPE || isTextDocumentMimeType(mimeType)
286 )
287 case 'google':
288 return GEMINI_INLINE_MIME_TYPES.has(mimeType) || isTextDocumentMimeType(mimeType)
289 case 'bedrock':
290 return (
291 (contentType === 'image' && BEDROCK_IMAGE_FORMATS.has(extension)) ||
292 (contentType === 'document' && BEDROCK_DOCUMENT_FORMATS.has(extension)) ||
293 (contentType === 'video' && BEDROCK_VIDEO_FORMATS.has(extension))
294 )
295 case 'openrouter':
296 return isImageMimeType(mimeType) || mimeType === PDF_MIME_TYPE
297 case 'mistral':
298 case 'groq':
299 case 'fireworks':
300 case 'together':
301 case 'baseten':
302 case 'ollama':
303 case 'vllm':
304 case 'litellm':
305 case 'xai':
306 return isImageMimeType(mimeType)
307 case 'deepseek':
308 case 'cerebras':
309 case 'sakana':
310 return false
311 default: {
312 const _exhaustive: never = provider
313 return _exhaustive
314 }
315 }
316}
317
318function validateProviderSupport(
319 attachment: Omit<PreparedProviderAttachment, 'providerMimeType' | 'dataUrl' | 'text'>,

Callers 1

validateProviderSupportFunction · 0.85

Calls 3

isImageMimeTypeFunction · 0.85
isOpenAIDocumentMimeTypeFunction · 0.85
isTextDocumentMimeTypeFunction · 0.85

Tested by

no test coverage detected