Cortex AI オーディオ

Cortex AI オーディオには、以下のような高度な LLM 駆動型の音声処理機能が用意されています。

  • 文字起こし: 会話言語をテキストに変換します。

  • 話者の識別: 複数の話者が存在する音声ファイルの各部分で、誰が会話しているかを識別します。

  • タイムスタンプ抽出: 発話された各単語のタイムスタンプを識別します。

これらの機能は AI_TRANSCRIBE 関数を介して利用できます。AI_TRANSCRIBE はSnowflake内で管理およびホストされているため、煩わしいセットアップやインフラストラクチャ管理を必要とすることなく、音声処理をデータワークフローに簡単に統合できます。

音声処理用ステージの作成

音声の処理を開始する前に、処理する音声ファイルの保存に適したステージを作成します。ステージには、ディレクトリテーブルとサーバー側の暗号化が必要です。以下の SQL は適切な内部ステージを作成します。

CREATE OR REPLACE STAGE input_stage
    DIRECTORY = ( ENABLE = true )
    ENCRYPTION = ( TYPE = 'SNOWFLAKE_SSE' );
Copy

次の SQL はAmazon S3で外部ステージを作成します。AzureおよびGoogle Cloudの外部ステージもサポートされています。

CREATE OR REPLACE STAGE input_stage
    URL='s3://<s3-path>/'
    DIRECTORY = ( ENABLE = true )
    CREDENTIALS = (AWS_KEY_ID = <aws_key_id>
    AWS_SECRET_KEY = <aws_secret_key>)
    ENCRYPTION = ( TYPE = 'AWS_SSE_S3' );
Copy

Tip

新しいファイルまたは更新されたファイルが利用可能になったときに外部ステージのディレクトリテーブルを自動的に更新するには、ステージの作成時に AUTO_REFRESH = TRUE を設定します。詳細については、CREATE STAGE をご参照ください。

AI_TRANSCRIBE

AI_TRANSCRIBE は、テキスト、タイムスタンプ、話者に関する情報を抽出してステージに保存された音声ファイルを文字起こしする完全に管理された SQL 関数です。内部的には、文字起こしと話者のダイアライゼーションのための最適化された AI モデルをオーケストレートし、最長2時間の長さの音声ファイルを処理します。AI_TRANSCRIBE は水平方向にスケーラブルであり、複数のファイルを同時に処理することによる効率的なバッチ処理が可能です。オブジェクトストレージから直接音声を処理することによって、不要なデータ移動を回避できます。

デフォルトでは、AI_TRANSCRIBE は音声ファイルをクリーンで判読可能なテキストに変換します。タイムスタンプの粒度を指定して、各単語や話者の変更のタイムスタンプを抽出することもできます。単語レベルのタイムスタンプは、サブタイトルなどのアプリケーションで、または文字起こし結果内の単語をクリックして、ユーザーが音声の特定の部分にジャンプできるようにする際に活用できます。話者レベルのタイムスタンプは、会議、インタビュー、または電話での通話で誰が何を述べたかを理解する際に活用できます。

タイムスタンプの粒度モード

結果

デフォルト

音声ファイル全体を1部分に文字起こし

単語

各単語にタイムスタンプが付加された文字起こし

話者

話者が変更されるたびに、誰が話しているか、およびタイムスタンプを示します

サポートされている言語

AI_TRANSCRIBE は自動的に検出される以下の言語をサポートしています。ファイルには、サポートされている複数の言語が含まれるようにすることができます。

注釈

言語を検出するには、ファイルの最初の5秒以内に音声が開始される必要があります。最良の結果を得るには、アップロードする前に余分な無音部分をトリムしてください。

  • アラビア語

  • ブルガリア語

  • 広東語

  • カタロニア語

  • 中国語

  • チェコ語

  • オランダ語

  • 英語

  • フランス語

  • ドイツ語

  • ギリシャ語

  • ハンガリー語

  • インドネシア語

  • イタリア語

  • 日本語

  • 韓国語

  • ラトビア語

  • ポーランド語

  • ポルトガル語

  • ルーマニア語

  • ロシア語

  • セルビア語

  • スロベニア語

  • スペイン語

  • スウェーデン語

  • タイ

  • トルコ語

  • ウクライナ語

制限事項

機能

サポートされているファイルタイプ

ファイルあたりの分数

ファイルサイズ

テキストの文字起こし

FLAC、MP3、Ogg、WAV、WebM

120

700 MB

タイムスタンプの粒度「単語」

FLAC、MP3、OGG、WAV、WebM

60

700 MB

タイムスタンプの粒度「話者」

FLAC、MP3、OGG、WAV、WebM

60

700 MB

正確な言語検出のために、音声はファイルの最初の5秒以内に始まる必要があります。

テキストの文字起こし

次の例では、financial_consultation ステージに保存されている:download:音声ファイル </samples/cortex/audio/consultation.wav> をダウンロードして、ファイル全体のテキストの文字起こし結果を返しています。TO_FILE 関数 は、ステージングされたファイルをファイル参照に変換します。

SELECT AI_TRANSCRIBE(TO_FILE(
    '@financial_consultation', 'consultation.wav'));
Copy

応答:

{"audio_duration":321.78,"text":"Good afternoon, Robert. Thanks for calling in
today. I understand you had some concerns about your portfolio you wanted to
discuss. Yes, I'm really worried. I've been watching the news and the market's
been all over the place lately. I'm thinking maybe I should just sell
everything, all my stocks and mutual funds and put it all in bonds or CDs. At
least then I could sleep at night. I can definitely understand that concern,
Robert. Market volatility can be unsettling, especially when you're seeing
those daily swings in the headlines. Before we talk about any major moves, can
you help me understand what specifically is driving this anxiety? Is it the
recent tech sector pullback or something more general? It's everything. I'm 52
years old and I keep thinking about what happened in 2008. I lost so much then
and I'm worried we're heading for another crash with this new administration. I
can't afford to lose my retirement savings. Those are absolutely valid
concerns, and I appreciate you sharing that context. That was a really
challenging time for everyone. Let me ask you this. When we last reviewed your
portfolio in March, we had you allocated at about 70% equities and 30% bonds,
correct? And your target retirement age is still 62%. That's right. But
honestly, 70% in stocks feels way too risky right now. I'm thinking more like
20% stocks, 80% bonds, maybe even less in stocks. I understand that instinct,
Robert. Let's walk through this together. First, I want to remind you of
something important. Your current portfolio is already designed with volatility
in mind. You're not in individual stocks. You're in diversified index funds and
some actively managed funds across different sectors and even international
markets. but they're still going down. My quarterly statement showed I was down
8% this quarter alone. You're absolutely right, and that's painful to see, but
let's put this in perspective. Over the past 12 months, even with this recent
volatility, your portfolio is still up about 3%. The market has given back some
gains, but we're not in crisis territory. Remember, we built your allocation
specifically because you have 10 years until retirement. That time horizon is
actually your biggest asset here. So you're saying I should just do nothing?
Not exactly nothing, but I am suggesting we don't make dramatic changes based
on short-term market movements. However, I do hear your concern about risk
tolerance. What if we made a smaller adjustment? Instead of going to 20%
stocks, what if we moved to 60% stocks and 40% bonds? That would reduce your
equity exposure by 10%, which might help you sleep better, but wouldn't take
you completely out of the growth potential you need for retirement. That
actually sounds more reasonable, but I'm still worried about losing more
money. I understand completely. Let me ask you this. What's your bigger worry,
the volatility of the next year, two or two, or having enough money to retire
comfortably at 62? Because if we get too conservative now, inflation alone
could erode your purchasing power over the next decade. I didn't really thought
about inflation that way. I guess I've been so focused on not losing money that
I forgot about the money I might not make. Exactly. And remember, Robert,
you're not alone in this. I've had this conversation with many clients over the
past few weeks. The ones who stayed disciplined during previous market
downturns are generally glad they did. What if we also set up a plan where we
review your portfolio monthly for the next few months? That way you'll have
regular check-ins and won't feel like you're just riding this out blindly.
Monthly reviews would definitely help. And maybe the 60-40 split is a good
compromise. I just, I don't want to be stupid about this. Overt, wanting to
protect your retirement isn't stupid. It's exactly what you should be thinking
about. The key is making sure we're protecting it in the right way. Staying
invested in a diversified portfolio, even with some volatility, has
historically been the best way to preserve and grow wealth over time. okay, I
think I can live with moving to 60% stocks, but if things get really bad... If
things get really bad, we'll talk again. That's what I'm here for. And
remember, we'll be reviewing this monthly anyway. You're not locked into
anything forever. But I do want to emphasize that market timing is incredibly
difficult, even for professionals. The goal isn't to avoid all volatility.
It's to stay invested long enough to benefit from the market's long-term
upward trend. All right, Sarah, let's do the rebalancing to 60-40 and I'll try
to stop checking my account balance every day. It sounds like a solid plan,
Robert. And yes, definitely limit the daily balance checking. That's a recipe
for anxiety. I'll send you some research on historical market recoveries after
our call and we'll schedule our first monthly review for next month. How does
that sound? That sounds good. Thanks for talking me through this, Sarah. I feel
a lot better than when I call. I'm so glad to hear that, Robert. Remember,
staying invested requires patience, but your future self will thank you for it.
I'll have the rebalancing done by tomorrow morning, and you should see the
changes reflected in your account by Thursday. Perfect. Thanks again, Sarah. I
thank you deeply for your patience and understanding. I'll talk to you next
month."}

タイムスタンプによる単語レベルのセグメンテーション

タイムスタンプの粒度を「単語」に設定すると、会話で使用されたすべての単語に対して正確なタイムスタンプが抽出され、検索可能でナビゲーション可能な文字起こしが可能になります。この音声ファイル ではスペイン語が使用されている点に留意してください。

SELECT AI_TRANSCRIBE(TO_FILE('@financial_consultation', 'consultation_3_sp.wav'),
    {'timestamp_granularity': 'word'});
Copy

応答:

注釈

出力は簡潔にするために切り捨てられます。詳細な出力結果には、音声ファイルで会話に使用された各単語のセグメントが含まれます。

{
    "audio_duration": 150.66,
    "segments": [
        {
            "end": 1.513,
            "start": 0.031,
            "text": "«Buenos"
        },
        {
            "end": 2.034,
            "start": 1.553,
            "text": "días,"
        },
        {
            "end": 2.334,
            "start": 2.054,
            "text": "doña"
        },
        {
            "end": 4.457,
            "start": 2.374,
            "text": "Esperanza."
        },
        {
            "end": 4.597,
            "start": 4.477,
            "text": "¿En"
        },
        {
            "end": 4.857,
            "start": 4.697,
            "text": "qué"
        },
        {
            "end": 5.118,
            "start": 4.917,
            "text": "puedo"
        },
        {
            "end": 5.518,
            "start": 5.178,
            "text": "ayudarla"
        },
        {
            "end": 6.5,
            "start": 5.578,
            "text": "hoy?»"
        },

        ...

        {
            "end": 146.671,
            "start": 146.551,
            "text": "Ya"
        },
        {
            "end": 147.234,
            "start": 146.732,
            "text": "veremos,"
        },
        {
            "end": 147.837,
            "start": 147.355,
            "text": "Roberto."
        },
        {
            "end": 148.581,
            "start": 148.078,
            "text": "Gracias"
        },
        {
            "end": 148.822,
            "start": 148.661,
            "text": "por"
        },
        {
            "end": 149.646,
            "start": 148.902,
            "text": "tu"
        },
        {
            "end": 150.711,
            "start": 150.249,
            "text": "ayuda."
        }
    ],
    "text": "«Buenos días, doña Esperanza. ¿En qué puedo ayudarla hoy?» «Roberto, quiero
    hacer un cambio grande en mi portafolio. Quiero vender todo y compra solo acciones
    de Tesla». «¿Tesla? Doña Esperanza, usted tiene 72 años. ¿Por qué quiere poner todo
    su dinero en una sola compañía?» «¿Por qué Tesla va a ser el futuro?» Un minuto me
    explico que van a dominar los carros eléctricos. Dice que puedo triplicar mi dinero
    en dos años. Entiendo que Tesla es una impresión innovador, pero poner todos sus
    ajuros en una sola acción es muy arriesgado. ¿Qué pasa si Tesla baja? No va a bajar.
    Elon Musk es un genio. Además, mi vecina compró Teslas. Teslas es tres años. Y Aorus
    tiene el doble de dinero. Doña Esperanza, su vecina tuvo suerte, pero las yantes
    individuales pueden ser muy volátiles. Usted necesita dinero estable para sus gastos
    de retiro. Roberto, tengo $400,000 en mi cuenta. Si te la sube como dismi, voy a
    tener más de un año. Podré dejarle más dinero a mi familia. Pero también podría
    perder la mitad de su dinero o más. Te sabía Jairo 60% antes. No puedo recomendarle
    que haga esto. Entonces no me dejas escuchando. Yo sé lo que quiero hacer con mi
    dinero. Es mi decisión. Tienes razón, es su dinero. Pero como su asesor tengo que
    decir que esto es extremamanda peligroso para alguien de su edad. Eva, no importa.
    Quiero tomar este riesgo. Vas a Edom o no. Doña Esperanza, ¿qué tal si compramos
    algo de Tesla perronoto? ¿Podríamos poner 10% en Tesla y el resto en versiones más
    seguras? No, Roberto, quiero el 100% en Tesla. Si no me ayudas, voy a alcanzar otro
    asesor. Que sí lo haga. Está bien, Doña Presanza. Voy a procesar la orden, pero voy
    a documentar que fue contra mi recomendación profesional. Perfecto. Hazlo hoy mismo.
    Quiero compra antes que suba más. Será ahora. Él considera lo que le estoy diciendo.
    Esto puede ser ver muy mal a la vida. Ya veremos, Roberto. Gracias por tu ayuda."
}

話者の認識

会話や会議における固有の話者を検出、分離、識別するには、タイムスタンプの粒度を「話者」に設定します。この例では、2人の話者が存在し、1人は英語を、もう1人はスペイン語を話している音声ファイルである:download:音声ファイル </samples/cortex/audio/consultation_5_mix_es_en.wav> を使用しています。

SELECT AI_TRANSCRIBE(TO_FILE('@financial_consultation', 'consultation_5_mix_es_en.wav'),
    {'timestamp_granularity': 'speaker'});
Copy

応答:

注釈

出力は簡潔にするために切り捨てられます。詳細な出力結果には、音声ファイルの各会話「ターン」のセグメントが含まれています。

{
    "audio_duration": 208.66,
    "segments": [
        {
            "end": 3.076,
            "speaker_label": "SPEAKER_00",
            "start": 0.031,
            "text": "Good afternoon, this is Aaliyah Johnson from Secure Financial Services."
        },
        {
            "end": 4.297,
            "speaker_label": "SPEAKER_02",
            "start": 3.196,
            "text": "How can I help you today?"
        },
        {
            "end": 7.182,
            "speaker_label": "SPEAKER_02",
            "start": 5.139,
            "text": "Hola, necesito ayuda con mis inversiones."
        },
        {
            "end": 11.528,
            "speaker_label": "SPEAKER_02",
            "start": 7.482,
            "text": "Estoy muy preocupada porque he perdido mucho dinero y no sé qué hacer."
        },
        {
            "end": 14.132,
            "speaker_label": "SPEAKER_02",
            "start": 12.289,
            "text": "I'm sorry, I'm not understanding."
        },
        {
            "end": 15.795,
            "speaker_label": "SPEAKER_02",
            "start": 14.553,
            "text": "Do you speak English?"
        },
        ...
        {
            "end": 189.169,
            "speaker_label": "SPEAKER_02",
            "start": 185.841,
            "text": "Es muy difícil entender estas cosas en inglés."
        },
        {
            "end": 192.326,
            "speaker_label": "SPEAKER_01",
            "start": 190.178,
            "text": "Por supuesto, señora Ramírez."
        },
        {
            "end": 197.145,
            "speaker_label": "SPEAKER_01",
            "start": 192.788,
            "text": "Es muy importante que entienda completamente sus opciones."
        },
        {
            "end": 203.229,
            "speaker_label": "SPEAKER_01",
            "start": 197.165,
            "text": "Voy a hacer los cambios hoy mismo y la llamaré la próxima semana para ver cómo se siente."
        },
        {
            "end": 205.759,
            "speaker_label": "SPEAKER_02",
            "start": 203.891,
            "text": "Muchísimas gracias, María."
        },
        {
            "end": 208.71,
            "speaker_label": "SPEAKER_02",
            "start": 206.18,
            "text": "Me siento mucho más tranquila ahora."
        }
    ],
    "text": "Good afternoon, this is Aaliyah Johnson from Secure Financial Services.
    How can I help you today? Hola, necesito ayuda con mis inversiones. Estoy muy
    preocupada porque he perdido mucho dinero y no sé qué hacer. I'm sorry, I'm not
    understanding. Do you speak English? Un poquito, pero es muy difícil para mí. Aquí
    hay alguien que habla español, ¿ok? Es muy importante. He perdido miles de dólares.
    I'm really sorry, but I don't speak Spanish. Let me see. I think we might have
    someone who speaks Spanish, but they're not available right now. ¿Cuándo pueden
    ayudarme? Necesito hablar con a lguien hoy. Mi esposo está muy enojado y quiere que
    vendamos todo. I understand you need someone who speaks Spanish. Let me check if
    Maria is available. She's our Spanish-speaking advisor. Can you hold for just a
    moment? No entiendo. Mañana. Pero necesito ayuda ahora. ¿No hay nadie más? I am
    going to transfer you to Maria right now. She'll be able to help you with your
    investment concerns. Hola, soy María González. Entiendo que necesita ayuda con sus
    inversiones. ¿Cómo está usted? ¡Ay, qué alivio! Sí, estoy muy preocupada. He
    perdido casi 20.000 dólares en las últimas semanas y mi esposo quiere que vendamos
    todo. Comprendo perfectamente su preocupación, señora Ramírez. Perder dinero es muy
    estresante. Cuénteme un poco más sobre su situación. ¿Qué tipo de inversiones
    tiene? Tengo fondos mutuos y algunas acciones. Todo está bajando mucho. Mi esposo
    dice que es mejor tener el dinero en el banco, pero yo no estoy segura. Es natural
    sentirse nerviosa cuando el mercado está volátil. Pero antes de tomar decisiones
    importantes, vamos a revisar su situación completa. ¿Cuántos años tiene usted y
    cuándo planea retirarse? Tengo 55 años y quiero retirarme a los 65, pero con estas
    pérdidas no sé si voy a poder. Señora Ramírez, usted todavía tiene 10 años hasta el
    retiro. Eso es tiempo suficiente para que sus inversiones se recuperen. El mercado
    siempre tiene altibajos, pero históricamente se ha recuperado. ¿Pero qué pasa si no
    se recupera esta vez? No puedo perder más dinero. Entiendo su miedo. ¿Qué le parece
    si hacemos algunos ajustes para que se sienta más cómoda? Podemos mover parte de su
    dinero a inversiones más conservadoras, como bonos. Eso suena mejor. No quiero
    arriesgar todo, pero tampoco quiero perder la oportunidad de crecer mi dinero.
    Perfecto. Vamos a encontrar un equilibrio. ¿Qué tal si movemos el 40% de sus
    acciones a bonos? Así tendrá menos riesgo, pero todavía podrá crecer su dinero para
    el retiro. Sí, eso me hace sentir mucho mejor. Gracias por explicarme todo en
    español. Es muy difícil entender estas cosas en inglés. Por supuesto, señora
    Ramírez. Es muy importante que entienda completamente sus opciones. Voy a hacer los
    cambios hoy mismo y la llamaré la próxima semana para ver cómo se siente. Muchísimas
    gracias, María. Me siento mucho más tranquila ahora."
}

他の AISQL 関数との併用

AI_TRANSCRIBE の出力を他の AISQL に渡して、さらに処理を行うことができます。たとえば、AI_SUMMARIZE を使用して、文字起こしを要約する、または AI_CLASSIFY を使用して文字起こしのコンテンツを分類することができます。この例では、AI_SENTIMENT および AI_COMPLETE を使用して、お客様の通話音声 から文字起こしされたテキストを分析し、4つのディメンションに対する感情とエージェントの評価を提示しています。

注釈

AI_SENTIMENT はテキストのみを分析し、音声のトーンなどの会話特性を考慮しません。

WITH transcriptions AS
    ( SELECT TO_VARCHAR (AI_TRANSCRIBE(TO_FILE('@financial_consultation',
        'consultation_1.wav'))) AS transcribed_call )
SELECT
    AI_SENTIMENT(transcribed_call, ['Professionalism', 'Resolution',
        'Wait Time', 'Market Conditions']) AS call_sentiment,
    AI_COMPLETE ('claude-4-opus', CONCAT ('Summarize how the agent can improve in 50 words',
        transcribed_call)) AS agent_assessment
FROM transcriptions
Copy

AI_SENTIMENT の応答:

{
    "categories": [
        {
            "name": "overall",
            "sentiment": "negative"
        },
        {
            "name": "Market Conditions",
            "sentiment": "negative"
        },
        {
            "name": "Professionalism",
            "sentiment": "negative"
        },
        {
            "name": "Resolution",
            "sentiment": "negative"
        },
        {
            "name": "Wait Time",
            "sentiment": "unknown"
        }
    ]
}

AI_COMPLETE の応答:

"The agent needs significant improvement in empathy, active listening, and client-centered communication. Instead of
dismissing concerns and using condescending language, they should validate emotions, explain market conditions
professionally, present multiple options, and guide clients through informed decision-making while respecting their
risk tolerance and personal circumstances."

コストの考慮事項

すべての AISQL 機能の請求は、トークンの消費量に基づいています。文字起こしの場合、言語やセグメンテーション方法に関係なく、処理される音声は1秒あたり50トークンです。したがって、1時間の音声は180,000トークンです。100万トークンの処理には1.3クレジットを要し、Snowflakeクレジットのコストは毎時間 US、処理される音声の1時間あたりのコストは US $0.117であると想定しています。この見積もりは変更される可能性があります。現在の価格設定情報については、Snowflakeサービス利用表 をご参照ください。

注釈

AI_TRANSCRIBE の請求の対象となる最小期間は1分です。1分より短いファイルについても処理されますが、1分で請求されます。多数の短い音声ファイルを効率的に処理するには、それらをバッチ処理して1つのファイルにし、タイムスタンプを使用して、生成された文字起こし結果に含まれる元の各ファイルの開始時点と終了時点を特定することを検討してください。