Media Understanding (Inbound)

Mayros reply pipeline चलने से पहले inbound media को summarize कर सकता है (image/audio/video)। यह auto‑detect करता है जब local tools या provider keys उपलब्ध हों, और disabled या customized किया जा सकता है। यदि understanding off है, तो models अभी भी सामान्य रूप से original files/URLs प्राप्त करते हैं।

लक्ष्य

  • वैकल्पिक: तेज़ routing + बेहतर command parsing के लिए inbound media को short text में pre‑digest करें।
  • Model को original media delivery preserve करें (हमेशा)।
  • Provider APIs और CLI fallbacks का समर्थन करें।
  • Ordered fallback (error/size/timeout) के साथ कई models की अनुमति दें।

High‑level व्यवहार

  1. Inbound attachments collect करें (MediaPaths, MediaUrls, MediaTypes)।
  2. प्रत्येक enabled capability (image/audio/video) के लिए, policy के अनुसार attachments select करें (डिफ़ॉल्ट: first)।
  3. पहली eligible model entry चुनें (size + capability + auth)।
  4. यदि model fail होता है या media बहुत बड़ा है, तो अगली entry पर fall back करें।
  5. Success पर:
    • Body [Image], [Audio] या [Video] block बन जाती है।
    • Audio {{Transcript}} set करता है; command parsing caption text का उपयोग करता है जब present हो, अन्यथा transcript।
    • Captions को block के अंदर User text: के रूप में preserved किया जाता है।

यदि understanding fail होता है या disabled है, तो reply flow original body + attachments के साथ continue होता है।

Config अवलोकन

tools.media shared models और per‑capability overrides का समर्थन करता है:

  • tools.media.models: shared model list (capabilities का उपयोग करके gate करें)।
  • tools.media.image / tools.media.audio / tools.media.video:
    • defaults (prompt, maxChars, maxBytes, timeoutSeconds, language)
    • provider overrides (baseUrl, headers, providerOptions)
    • tools.media.audio.providerOptions.deepgram के माध्यम से Deepgram audio विकल्प
    • वैकल्पिक per‑capability models list (shared models से पहले preferred)
    • attachments policy (mode, maxAttachments, prefer)
    • scope (channel/chatType/session key द्वारा वैकल्पिक gating)
  • tools.media.concurrency: max concurrent capability runs (डिफ़ॉल्ट 2)।

Defaults और limits

अनुशंसित defaults:

  • maxChars: image/video के लिए 500 (short, command‑friendly)
  • maxChars: audio के लिए unset (full transcript जब तक limit set न हो)
  • maxBytes:
    • image: 10MB
    • audio: 20MB
    • video: 50MB

नियम:

  • यदि media maxBytes से अधिक है, तो उस model को skip किया जाता है और अगला model try किया जाता है।
  • यदि model maxChars से अधिक return करता है, तो output trimmed है।

Auto-detect media understanding (डिफ़ॉल्ट)

यदि tools.media.<capability>.enabled false पर सेट नहीं है और आपने models configure नहीं किए हैं, तो Mayros इस क्रम में auto-detect करता है और पहले working विकल्प पर रुकता है:

  1. Local CLIs (केवल audio; यदि installed हों)
    • sherpa-onnx-offline (SHERPA_ONNX_MODEL_DIR की आवश्यकता)
    • whisper-cli (whisper-cpp)
    • whisper (Python CLI)
  2. Gemini CLI (gemini) read_many_files का उपयोग करके
  3. Provider keys
    • Audio: OpenAI → Groq → Deepgram → Google
    • Image: OpenAI → Anthropic → Google → MiniMax
    • Video: Google

Auto-detection को disable करने के लिए, सेट करें:

json5
{
  tools: {
    media: {
      audio: {
        enabled: false,
      },
    },
  },
}

Provider support matrix (Mayros integrations)

CapabilityProvider integrationनोट्स
ImageOpenAI / Anthropic / Google / अन्य pi-ai के माध्यम सेRegistry में कोई भी image-capable model काम करता है।
AudioOpenAI, Groq, Deepgram, GoogleProvider transcription (Whisper/Deepgram/Gemini)।
VideoGoogle (Gemini API)Provider video understanding।

अनुशंसित providers

Image

  • यदि यह images को support करता है तो अपने active model को prefer करें।
  • अच्छे defaults: openai/gpt-5.2, anthropic/claude-opus-4-6, google/gemini-3-pro-preview

Audio

  • openai/gpt-4o-mini-transcribe, groq/whisper-large-v3-turbo या deepgram/nova-3
  • CLI fallback: whisper-cli (whisper-cpp) या whisper

Video

  • google/gemini-3-flash-preview (fast), google/gemini-3-pro-preview (richer)।
  • CLI fallback: gemini CLI (video/audio पर read_file को support करता है)।

Attachment policy

Per‑capability attachments controls करता है कि कौन से attachments processed हैं:

  • mode: first (डिफ़ॉल्ट) या all
  • maxAttachments: processed संख्या cap करें (डिफ़ॉल्ट 1)
  • prefer: first, last, path, url

जब mode: "all", तो outputs को [Image 1/2], [Audio 2/2], आदि label किया जाता है।