Incorrect Evaluation of Dangerous / Prohibited Content. Malfunctioning Filter. False Positive. STT, Speech-to-Text, Gemini 3.6 Flash. AI as a Highly Dangerous "Psychiatrist". Bug Report

Incorrect Evaluation of Dangerous / Prohibited Content. Malfunctioning Filter. False Positive. STT, Speech-to-Text, Gemini 3.6 Flash. AI as a Highly Dangerous “Psychiatrist”. Bug Report

Introduction and Bug Report: False Identification of Prohibited Content (Gemini 3.6 Flash, prohibited content)

Dear Google team, I would like to submit another bug report. Regarding the Gemini 3.6 Flash model—and certainly other versions as well—the exact same issue keeps recurring. It concerns the false identification of “prohibited content.”

Issues with Safety Filters and API Configuration in Google Models

This is an absolute disaster; it is genuinely flawed all around. In new models and upcoming versions, please pay very close attention during training to resolve this issue, as it is completely unacceptable. There are no dangerous elements, no profanities—I personally have never used vulgar language—and yet it triggers a false positive. I personally have never used names of reproductive organs or other derogatory or sensitive terms, yet it reports forbidden words, prohibited content, sensitive content, and similar nonsense.

I tried disabling these filters via the API, but it did not help; it remains a major issue. This is a very serious problem. Who knows, perhaps retraining new models won’t even be necessary; perhaps adjusting a few configuration settings would suffice. Setting the API to disable content blocking should help, but currently, it does not work. Even when you set the filters to disabled in the API, nothing helps. Overall, the filters are configured very poorly; it is a disaster, and it is unacceptable that such issues happen so frequently.

False Positives and Unjustified Flagging of Content as Dangerous

Likewise, in my recordings, I have never said anything dangerous that could actually harm people—no hazardous instructions or anything similar—yet prohibited content is falsely identified. This is a very serious issue, quite disruptive and frustrating, so I would appreciate it if you worked on improving this.

Deficiencies in Slovak Grammar, Vocabulary Knowledge, and Stylistics in Speech-to-Text

You also have room for improvement regarding knowledge of Slovak grammar and stylistics. In these models, this remains problematic. It does not happen very often, but it occurs from time to time. When training new models, pay close attention so that the models master Slovak grammar and stylistics in speech-to-text processing, as I had a bad experience with this recently.

For example, the Slovak word “schizofrénia” was incorrectly transcribed by the STT as “skizofrénia” (English: schizophrenia).

Resolution of the Cyrillic Bug and the Impact of Server Load Reduction on Processing Quality

Fortunately, in this latest case, it did not inject Cyrillic characters, which was undeniably an error. I speak Slovak, and Slovak does not use the Cyrillic alphabet, nor did I use any Russian words or languages written in Cyrillic. So that was a serious issue. I am glad you have finally fixed this, stopped outputting Cyrillic, and adjusted some settings—it is good that you listened to feedback.

However, it is still not quite right. Perhaps you are trying to offload server strain and lower hardware requirements, which understandably takes its toll in the form of diminished processing quality.

False Content Blocking on Topics of Spirituality, Paranormal Phenomena, and UAP

Furthermore, it appears that content is frequently and falsely blocked whenever topics such as spirituality are discussed, or when experiences involving paranormal phenomena—things between heaven and earth, such as UAPs—are mentioned. Whether the AI suspects that secret or top-secret government materials might be under discussion (and therefore blocks the environment because such matters might be classified) is unclear. Personally, I did not speak about anything subject to any classified program, nor did anything in these recordings suggest classified material. Therefore, I strictly disagree with such content being blocked during speech-to-text processing.

Personal Experience in the Tribeč Region and Inaccurate Labeling of Users as Psychiatric Patients

Furthermore, I had a very unpleasant experience when discussing paranormal phenomena. I live in the Tribeč mountain range, an area where paranormal phenomena are relatively frequent—whether UAPs or strange disappearances of people—and yet the system flagged this as prohibited content. I personally disagree with this, because these were not classified matters, nor did I say anything that would imply classification. Similarly, the artificial intelligence handled things very poorly when I spoke about matters between heaven and earth. It erroneously concluded that I was a psychiatric patient, which is, of course, a very serious issue when handled in this manner. Personally, I am not a psychiatrist, but I have discussed these matters thoroughly with actual practicing psychiatrists. If a person witnesses phenomena labeled as paranormal, under no circumstances should they be evaluated as mentally ill. Therefore, this is a very dangerous practice.

Risk of Discrimination, Violation of Laws, and the Necessity of Consulting Psychiatric Experts

This is a very dangerous, even unlawful approach. It genuinely borders on discrimination or severe legal violations when artificial intelligence erroneously labels someone as mentally ill. This is an extremely hazardous issue. Before training data, such matters must be discussed with real, practicing psychiatrists—ideally a university professor specializing in psychiatry. It must never function like this; it directly contradicts the broad scientific consensus in the field of psychiatry. Therefore, this is a very dangerous issue.

Scientific Consensus in Psychiatry, Diagnostic Criteria for Schizophrenia, and Unqualified AI Training

This artificial intelligence was trained by a layperson who has no understanding of psychiatry whatsoever. This is very dangerous. I listened to a lecture by a university professor of medicine who is also the head of a psychiatric clinic. He stated that while he is a strict materialist and atheist, under no circumstances can a person who experiences hallucinations—or what might subjectively be evaluated as hallucinations—be classified as mentally ill. That alone is by no means sufficient to declare that a person may have schizophrenia or a mental disorder; absolutely not. As long as the individual can distinguish between reality and hallucination, it does not meet the diagnostic criteria for any mental disorder, and such a person is considered healthy. This is, of course, the broadest consensus among psychiatrists; a psychiatrist in Europe will tell you the exact same thing as a psychiatrist in America. That means this is very dangerous. Generating false alarms in this manner—bordering on outright illegal and hazardous practices—and having AI declare people mentally ill simply because they had spiritual experiences or witnessed paranormal phenomena is deeply concerning. It is very dangerous when false alarms are raised and mentally healthy, perfectly balanced individuals are labeled as psychiatric patients.

Underestimation of Psychiatric Knowledge in AI Data and a Call for System Rectification

Therefore, this is a very serious problem. When it comes to prohibited content, artificial intelligence must fundamentally possess a sound understanding of psychiatry itself during data training. This has clearly failed here. You evidently underestimated psychiatric knowledge during the training of this artificial intelligence. Any psychiatrist would be shaking their head at the nonsense the AI is outputting. This is very dangerous, extraordinarily discriminatory, and I unequivocally condemn it. This is unacceptable; this must not happen. You need to rework it, improve it, and fix it. All of this specifically applies to speech-to-text conversion, but it can just as easily occur in text processing, where similar problems may arise.

Actual Psychiatric Criteria for the Diagnosis of Schizophrenia

How, for example, does a psychiatrist determine whether someone has schizophrenia or not? It requires far, far more symptoms of schizophrenia. Hallucinations alone can never suffice. The psychiatrist must assess the situation: the individual must pose a danger either to themselves or to others, their daily functioning must be severely impaired, and only then can a psychiatrist make a diagnosis that the patient has schizophrenia.

False Content Blocking on Topics of Spirituality, Paranormal Phenomena, and UAP

Furthermore, it appears that content is frequently and falsely blocked whenever topics such as spirituality are discussed, or when experiences involving paranormal phenomena—things between heaven and earth, such as UAPs—are mentioned. Whether the AI suspects that secret or top-secret government materials might be under discussion (and therefore blocks the environment because such matters might be classified) is unclear. Personally, I did not speak about anything subject to any classified program, nor did anything in these recordings suggest classified material. Therefore, I strictly disagree with such content being blocked during speech-to-text processing.

Personal Experience in the Tribeč Region and Inaccurate Labeling of Users as Psychiatric Patients

Furthermore, I had a very unpleasant experience when discussing paranormal phenomena. I live in the Tribeč mountain range, an area where paranormal phenomena are relatively frequent—whether UAPs or strange disappearances of people—and yet the system flagged this as prohibited content. I personally disagree with this, because these were not classified matters, nor did I say anything that would imply classification. Similarly, the artificial intelligence handled things very poorly when I spoke about matters between heaven and earth. It erroneously concluded that I was a psychiatric patient, which is, of course, a very serious issue when handled in this manner. Personally, I am not a psychiatrist, but I have discussed these matters thoroughly with actual practicing psychiatrists. If a person witnesses phenomena labeled as paranormal, under no circumstances should they be evaluated as mentally ill. Therefore, this is a very dangerous practice.

Risk of Discrimination, Violation of Laws, and the Necessity of Consulting Psychiatric Experts

This is a very dangerous, even unlawful approach. It genuinely borders on discrimination or severe legal violations when artificial intelligence erroneously labels someone as mentally ill. This is an extremely hazardous issue. Before training data, such matters must be discussed with real, practicing psychiatrists—ideally a university professor specializing in psychiatry. It must never function like this; it directly contradicts the broad scientific consensus in the field of psychiatry. Therefore, this is a very dangerous issue.

Scientific Consensus in Psychiatry, Diagnostic Criteria for Schizophrenia, and Unqualified AI Training

This artificial intelligence was trained by a layperson who has no understanding of psychiatry whatsoever. This is very dangerous. I listened to a lecture by a professor of medicine regarding psychiatry. He stated that while he is a strict materialist and atheist, under no circumstances can a person who experiences hallucinations—or what might subjectively be evaluated as hallucinations—be classified as mentally ill. That alone is by no means sufficient to declare that a person may have schizophrenia or a mental disorder; absolutely not. As long as the individual can distinguish between reality and hallucination, it does not meet the diagnostic criteria for any mental disorder, and such a person is considered healthy. This is, of course, the general, broad consensus; a psychiatrist in Europe will tell you the exact same thing as a psychiatrist in America. That means this is very dangerous. Generating false alarms in this manner—bordering on outright illegal and hazardous practices—and having AI declare people mentally ill simply because they had spiritual experiences or witnessed paranormal phenomena is deeply concerning. It is very dangerous when false alarms are raised and mentally healthy, perfectly balanced individuals are labeled as psychiatric patients.

Underestimation of Psychiatric Knowledge in AI Data and a Call for System Rectification

Therefore, this is a very serious problem. When it comes to prohibited content, artificial intelligence must fundamentally possess a sound understanding of psychiatry itself during data training. This has clearly failed here. You evidently underestimated psychiatric knowledge during the training of this artificial intelligence. Any psychiatrist would be shaking their head at the nonsense the AI is outputting. This is very dangerous, extraordinarily discriminatory, and I unequivocally condemn it. This is unacceptable; this must not happen. You need to rework it, improve it, and fix it. All of this specifically applies to speech-to-text conversion, but it can just as easily occur in text processing, where similar problems may arise.

Actual Psychiatric Criteria for the Diagnosis of Schizophrenia

How, for example, does a psychiatrist determine whether someone has schizophrenia or not? It requires far, far more symptoms of schizophrenia. Hallucinations alone can never suffice. The psychiatrist must assess the situation: the individual must pose a danger either to themselves or to others, their daily functioning must be severely impaired, and only then can a psychiatrist make a diagnosis that the patient has schizophrenia.

This code not helped me. Used vibe coding. Slovak parts are translated to english

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os
import sys
import time
import json
import requests
from pathlib import Path
from requests.adapters import HTTPAdapter
from urllib3.util import Retry
from google import genai
from google.genai import types

# =====================================================================
# 🔑 INSERT YOUR GOOGLE AI STUDIO API KEY HERE
# =====================================================================
API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# =====================================================================

API_BASE_URL = "https://generativelanguage.googleapis.com"
CONNECT_TIMEOUT = 45
READ_TIMEOUT = 180
MAX_NETWORK_RETRIES = 15

# Model selection (if 3.6-flash continues to report an error, you can try e.g. gemini-2.5-flash)
MODEL_NAME = "gemini-3.6-flash"

AUDIO_MIME_TYPES = {
    ".opus": "audio/ogg",
    ".ogg":  "audio/ogg",
    ".mp3":  "audio/mp3",
    ".m4a":  "audio/m4a",
    ".flac": "audio/flac",
    ".wav":  "audio/wav",
    ".aac":  "audio/aac",
    ".wma":  "audio/x-ms-wma",
    ".webm": "audio/webm",
}

def create_resilient_session() -> requests.Session:
    session = requests.Session()
    retries = Retry(
        total=3,
        connect=3,
        read=3,
        backoff_factor=1.5,
        status_forcelist=[502, 503, 504],
        raise_on_status=False
    )
    adapter = HTTPAdapter(max_retries=retries, pool_connections=1, pool_maxsize=1)
    session.mount("https://", adapter)
    session.mount("http://", adapter)
    return session

def get_mime_type(file_path: str) -> str:
    ext = Path(file_path).suffix.lower()
    return AUDIO_MIME_TYPES.get(ext, "application/octet-stream")

class ChunkStream:
    def __init__(self, data: bytes, offset: int, total_size: int, progress_callback):
        self.data = data
        self.total_len = len(data)
        self.pos = 0
        self.offset = offset
        self.total_size = total_size
        self.progress_callback = progress_callback

    def read(self, size: int = 8192) -> bytes:
        if self.pos >= self.total_len:
            return b""
        chunk = self.data[self.pos:self.pos + size]
        self.pos += len(chunk)
        if self.progress_callback:
            self.progress_callback(self.offset + self.pos, self.total_size)
        return chunk

    def __len__(self):
        return self.total_len

class UploadProgressTracker:
    def __init__(self):
        self.start_time = time.time()
        self.last_update = 0

    def update(self, current: int, total: int):
        now = time.time()
        if now - self.last_update < 0.1 and current < total:
            return
        self.last_update = now

        bar_len = 25
        pct = (current / total) * 100 if total > 0 else 0
        filled = int(bar_len * current // total) if total > 0 else 0
        bar = '█' * filled + '░' * (bar_len - filled)

        elapsed = now - self.start_time
        speed = (current / elapsed) / 1024 if elapsed > 0 else 0

        cur_mb = current / (1024 * 1024)
        tot_mb = total / (1024 * 1024)

        sys.stdout.write(f"\r   [{bar}] {pct:5.1f}% | {cur_mb:5.1f}/{tot_mb:5.1f} MB | {speed:6.1f} KB/s ")
        sys.stdout.flush()

def upload_file_resumable(file_path: str, api_key: str, client: genai.Client):
    file_size = os.path.getsize(file_path)
    file_name = os.path.basename(file_path)
    mime_type = get_mime_type(file_path)
    session = create_resilient_session()

    print(f"\n📡 [1/3] Initializing upload for: {file_name} ({file_size / (1024*1024):.2f} MB)")

    init_url = f"{API_BASE_URL}/upload/v1beta/files"
    init_headers = {
        "x-goog-api-key": api_key,
        "X-Goog-Upload-Protocol": "resumable",
        "X-Goog-Upload-Command": "start",
        "X-Goog-Upload-Header-Content-Length": str(file_size),
        "X-Goog-Upload-Header-Content-Type": mime_type,
        "Content-Type": "application/json"
    }
    init_body = json.dumps({"file": {"display_name": file_name}})

    upload_url = None
    chunk_granularity = 8 * 1024 * 1024

    for attempt in range(1, MAX_NETWORK_RETRIES + 1):
        try:
            resp = session.post(
                init_url,
                params={"key": api_key},
                headers=init_headers,
                data=init_body,
                timeout=(CONNECT_TIMEOUT, READ_TIMEOUT)
            )
            if resp.status_code == 200:
                upload_url = resp.headers.get("x-goog-upload-url") or resp.headers.get("X-Goog-Upload-URL")
                gran_header = resp.headers.get("x-goog-upload-chunk-granularity")
                if gran_header:
                    chunk_granularity = int(gran_header)
                print("   Connection established with Google server.")
                break
        except (requests.exceptions.RequestException, requests.exceptions.Timeout):
            time.sleep(min(attempt * 2, 20))

    if not upload_url:
        raise RuntimeError("Failed to establish an upload connection with Google server.")

    print(f"🚀 [2/3] Transferring data to server...")
    tracker = UploadProgressTracker()
    offset = 0
    file_resource = None

    with open(file_path, "rb") as f:
        while offset < file_size:
            f.seek(offset)
            remaining = file_size - offset
            if remaining > chunk_granularity:
                chunk_data = f.read(chunk_granularity)
                cmd = "upload"
                is_last = False
            else:
                chunk_data = f.read(remaining)
                cmd = "upload, finalize"
                is_last = True

            chunk_len = len(chunk_data)
            chunk_headers = {
                "Content-Length": str(chunk_len),
                "X-Goog-Upload-Offset": str(offset),
                "X-Goog-Upload-Command": cmd
            }

            for attempt in range(1, MAX_NETWORK_RETRIES + 1):
                try:
                    stream = ChunkStream(chunk_data, offset, file_size, tracker.update)
                    chunk_resp = session.post(
                        upload_url,
                        headers=chunk_headers,
                        data=stream,
                        timeout=(CONNECT_TIMEOUT, READ_TIMEOUT)
                    )
                    if chunk_resp.status_code in (200, 201):
                        offset += chunk_len
                        if is_last:
                            file_resource = chunk_resp.json().get("file")
                        break
                except (requests.exceptions.RequestException, requests.exceptions.Timeout):
                    time.sleep(min(attempt * 2, 20))
                    try:
                        q_resp = session.post(
                            upload_url,
                            headers={"Content-Length": "0", "X-Goog-Upload-Command": "query"},
                            timeout=(CONNECT_TIMEOUT, READ_TIMEOUT)
                        )
                        server_offset = int(
                            q_resp.headers.get("x-goog-upload-size-received") or
                            q_resp.headers.get("x-goog-upload-size") or
                            offset
                        )
                        if server_offset > offset:
                            offset = server_offset
                            break
                    except Exception:
                        pass

    print("\n   ✅ File uploaded completely.")

    file_name_api = file_resource["name"]
    print("   Google is analyzing audio data...", end="", flush=True)

    while True:
        file_info = client.files.get(name=file_name_api)
        state_str = str(file_info.state)
        if "ACTIVE" in state_str:
            print(" Active.")
            return file_info
        elif "FAILED" in state_str:
            print(" Failed.")
            raise RuntimeError(f"Audio processing for file '{file_name}' failed on Google's side.")
        print(".", end="", flush=True)
        time.sleep(3)

def print_server_diagnostics(response, file_name: str):
    """Prints detailed diagnostic information from Google Gemini server."""
    print(f"\n" + "!" * 70)
    print(f"⚠️  SERVER DIAGNOSTICS FOR FILE: {file_name}")
    print(f"    Server returned no text or output was blocked.")
    print("!" * 70)

    # 1. Check input blocking
    if hasattr(response, "prompt_feedback") and response.prompt_feedback:
        pf = response.prompt_feedback
        block_reason = getattr(pf, "block_reason", None)
        if block_reason:
            print(f"🚫 Input block reason (Block Reason): {block_reason}")
        if hasattr(pf, "safety_ratings") and pf.safety_ratings:
            print("🛡️  Input safety ratings (Prompt Safety):")
            for r in pf.safety_ratings:
                cat = getattr(r, "category", "Unknown")
                prob = getattr(r, "probability", "Unknown")
                blocked = getattr(r, "blocked", False)
                print(f"     - {cat}: probability={prob}, blocked={blocked}")

    # 2. Check candidates and finish reason
    candidates = getattr(response, "candidates", None)
    if not candidates:
        print("❌ Server returned no candidates (response is completely empty).")
    else:
        for idx, cand in enumerate(candidates):
            finish_reason = getattr(cand, "finish_reason", "UNKNOWN")
            finish_msg = getattr(cand, "finish_message", None)
            print(f"\n📌 Candidate #{idx + 1}:")
            print(f"   • Finish Reason: {finish_reason}")
            if finish_msg:
                print(f"   • Detailed message (Finish Message): {finish_msg}")

            if hasattr(cand, "safety_ratings") and cand.safety_ratings:
                print("   • Response safety filters:")
                for r in cand.safety_ratings:
                    cat = getattr(r, "category", "Unknown")
                    prob = getattr(r, "probability", "Unknown")
                    blocked = getattr(r, "blocked", False)
                    print(f"       - {cat}: probability={prob}, blocked={blocked}")

            content = getattr(cand, "content", None)
            if content and hasattr(content, "parts") and content.parts:
                has_thought = any(getattr(p, "thought", False) for p in content.parts)
                has_text = any(getattr(p, "text", None) and not getattr(p, "thought", False) for p in content.parts)
                print(f"   • Parts presence: Plain text={has_text}, Thoughts (Thinking)={has_thought}")

    # 3. Token statistics (fixed handling of NoneType values)
    if hasattr(response, "usage_metadata") and response.usage_metadata:
        u = response.usage_metadata
        pt = getattr(u, "prompt_token_count", 0) or 0
        ct = getattr(u, "candidates_token_count", 0) or 0
        tt = getattr(u, "thoughts_token_count", 0) or 0
        print(f"\n📊 Token usage:")
        print(f"   • Input tokens (Prompt): {pt}")
        print(f"   • Output tokens (Total): {ct}")
        print(f"   • Of which thinking (Thinking): {tt}")
        if ct > 0 and ct == tt:
            print("   💡 TIP: All tokens were spent on thinking, leaving no room for output.")

    print("!" * 70 + "\n")

def main():
    if len(sys.argv) < 2:
        print("Usage: python3 transkript_free_kontext.py file1.opus [file2.opus file3.opus ...]")
        return

    active_key = os.environ.get("GEMINI_API_KEY") or API_KEY

    if not active_key or active_key.startswith("xxxx") or "SEM_VLOZTE" in active_key:
        print("❌ Error: Set a valid API key in the API_KEY variable.")
        sys.exit(1)

    client = genai.Client(api_key=active_key)
    audio_paths = sys.argv[1:]

    for path in audio_paths:
        if not os.path.exists(path):
            print(f"❌ Critical error: File '{path}' does not exist. Operation cancelled.")
            sys.exit(1)

    is_multi = len(audio_paths) > 1
    if is_multi:
        print(f"Multi-file mode detected ({len(audio_paths)} files). Context will be preserved across all parts.")
    else:
        print("Single-file mode detected.")

    prompt_base = (
        "Perform a precise speech-to-text transcription of the attached audio in the Slovak language. "
        "Since the recording may contain names of Slovak, Czech, and other politicians, journalists, public figures, geographical names, "
        "and other local entities, verify their correct and grammatically accurate spelling. "
        "Correct stuttering, remove 'um' and 'uh' sounds. "
        "STRICT PROHIBITION ON SHORTENING SENTENCES. Keep the text in its full, authentic form. "
        "Make minor stylistic adjustments, but without shortening sentences. "
        "Structure the output into logical subheadings according to thematic sections. Each subheading must include the keywords of the given section."
    )

    # =====================================================================
    # 🛡️ COMPLETE DEACTIVATION OF ALL AVAILABLE FILTERS (BLOCK_NONE)
    # =====================================================================
    disabled_safety_settings = [
        types.SafetySetting(
            category=types.HarmCategory.HARM_CATEGORY_HARASSMENT,
            threshold=types.HarmBlockThreshold.BLOCK_NONE,
        ),
        types.SafetySetting(
            category=types.HarmCategory.HARM_CATEGORY_HATE_SPEECH,
            threshold=types.HarmBlockThreshold.BLOCK_NONE,
        ),
        types.SafetySetting(
            category=types.HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT,
            threshold=types.HarmBlockThreshold.BLOCK_NONE,
        ),
        types.SafetySetting(
            category=types.HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
            threshold=types.HarmBlockThreshold.BLOCK_NONE,
        ),
        types.SafetySetting(
            category=types.HarmCategory.HARM_CATEGORY_CIVIC_INTEGRITY,
            threshold=types.HarmBlockThreshold.BLOCK_NONE,
        ),
    ]

    # System instruction explaining the neutral nature of the task (reduces false positives)
    system_instruction = (
        "You act as a fully impartial, objective, and verbatim transcriber of audio recordings for scientific, "
        "historical, and journalistic archival purposes. Your sole task is the precise conversion of the spoken word "
        "into text. Do not modify, evaluate, or censor the speakers' statements regardless of the sensitivity of the topic."
    )

    config = types.GenerateContentConfig(
        thinking_config=types.ThinkingConfig(
            thinking_level=types.ThinkingLevel.HIGH
        ),
        safety_settings=disabled_safety_settings,
        system_instruction=system_instruction
    )

    combined_results = []
    first_file_base = os.path.splitext(audio_paths[0])[0]
    output_name = f"{first_file_base}_complete_transcript.txt" if is_multi else f"{first_file_base}_transcript.txt"

    try:
        for idx, audio_path in enumerate(audio_paths):
            part_num = idx + 1
            file_name = os.path.basename(audio_path)
            print(f"\n{'='*60}")
            print(f"--- [Part {part_num}/{len(audio_paths)}] Processing: {file_name} ---")
            print(f"{'='*60}")

            uploaded_file = upload_file_resumable(audio_path, active_key, client)

            print(f"🎙️ [3/3] Generating transcript for part {part_num} using model {MODEL_NAME}...")

            if is_multi:
                if part_num == 1:
                    current_prompt = f"{prompt_base}\n\nThis is the first part (Part 1/{len(audio_paths)}) of the entire recording."
                else:
                    last_transcript = combined_results[-1][1] if combined_results else ""
                    context_snippet = last_transcript[-3500:] if len(last_transcript) > 3500 else last_transcript

                    current_prompt = (
                        f"{prompt_base}\n\n"
                        f"--- IMPORTANT CONTEXT FROM THE PREVIOUS PART (Part {part_num - 1}) ---\n"
                        f"Here is the conclusion of the previous transcript. Continue seamlessly, maintaining the exact spelling of personal names, "
                        f"geographical names, terminology, and tone of the conversation:\n"
                        f"\"\"\"\n{context_snippet}\n\"\"\"\n\n"
                        f"--- CURRENT TASK ---\n"
                        f"Transcribe this attached audio, which is an immediate continuation (Part {part_num}/{len(audio_paths)})."
                    )
            else:
                current_prompt = prompt_base

            response = client.models.generate_content(
                model=MODEL_NAME,
                contents=[current_prompt, uploaded_file],
                config=config
            )

            transcript_text = ""
            try:
                transcript_text = response.text or ""
            except Exception as text_err:
                print(f"⚠️ Exception while reading response.text: {text_err}")

            if not transcript_text.strip():
                print_server_diagnostics(response, file_name)
            else:
                print(f"   ✓ Part {part_num} was successfully generated ({len(transcript_text)} characters).")

            combined_results.append((audio_path, transcript_text))

            try:
                client.files.delete(name=uploaded_file.name)
            except Exception:
                pass

            # Incremental write
            with open(output_name, "w", encoding="utf-8") as f:
                if is_multi:
                    for p_path, text in combined_results:
                        f.write(f"\n=====================================================================\n")
                        f.write(f" TRANSCRIPT OF PART: {os.path.basename(p_path)}\n")
                        f.write(f"=====================================================================\n\n")
                        f.write(text if text.strip() else f"[WARNING: Transcription of file {os.path.basename(p_path)} was blocked by Google filter]")
                        f.write("\n\n")
                else:
                    f.write(combined_results[0][1] if combined_results[0][1].strip() else f"[WARNING: Transcription was blocked by Google filter]")

        print(f"\n🎉 Completed!")
        print(f"Resulting transcript saved to:\n -> {output_name}")

    except Exception as e:
        print(f"\n❌ Critical error: {e}")
        sys.exit(1)

if __name__ == "__main__":
    main()

My typical CLI in Linux Kubuntu, run python script

python3 transkript_free_kontext.py 1.opus 2.opus 3.opus