def diarization_using_vet_library(
        self, audio_file: str, embeddings_list: np.ndarray, diarized_folder: str
    ) -> tuple[list[str], list[str] | None]:

        # Create directory if it doesn't exist
        if not os.path.isdir(diarized_folder):
            os.mkdir(diarized_folder)

        diarization = self.pipeline(audio_file)
        audio: AudioSegment = AudioSegment.from_wav(audio_file)

        current_speaker = None
        current_segment = None
        current_duration = 0
        segment_counter = 0
        speakers: list[str] = []

        for i, (turn, _, speaker) in enumerate(diarization.itertracks(yield_label=True)):
            start_time = int(turn.start * 1000)  # Start time in milliseconds
            end_time = int(turn.end * 1000)  # End time in milliseconds

            # Skip segments shorter than 1 second
            if end_time - start_time < 2000:
                continue

            segment = audio[start_time:end_time]


            # temp_segment_path = f"segment_{speaker}_{i}.wav"
            # segment.export(temp_segment_path, format="wav")

            # highest_is_doctor = 0.0  
            # detected_speaker = "OWNER" 

            # try:
            #     for embd in embeddings_list:
            #         is_doctor = self.speakers_comparision(temp_segment_path, embd)

            #         # Update highest_is_doctor and detected_speaker if is_doctor is high
            #         if is_doctor < 0.80:
            #             highest_is_doctor = is_doctor
            #             detected_speaker = "VETERINARIAN"
                        
            # finally:
            # if os.path.exists(temp_segment_path):
            #     os.remove(temp_segment_path)  # Clean up temporary file

            #print(f"Highest is_doctor value: {highest_is_doctor}, Detected speaker: {detected_speaker}")

            segment_duration = len(segment)

            if current_speaker is None:
                # Initialize the first speaker and segment
                current_speaker = speaker
                current_segment = segment
                current_duration = segment_duration

            elif current_speaker == speaker:
                # If the same speaker, combine the segments if under 60 seconds
                if current_duration + segment_duration > 60000:
                    # Export combined segment
                    current_segment.export(
                        os.path.join(diarized_folder, f"segment_{current_speaker}_{segment_counter}.wav"), format="wav"
                    )
                    speakers.append(current_speaker)
                    segment_counter += 1
                    current_segment = segment
                    current_duration = segment_duration
                else:
                    current_segment += segment
                    current_duration += segment_duration
            else:
                # If the speaker changes, export the current combined segment
                current_segment.export(
                    os.path.join(diarized_folder, f"segment_{current_speaker}_{segment_counter}.wav"), format="wav"
                )
                speakers.append(current_speaker)

                # Start a new segment for the new speaker
                segment_counter += 1
                current_speaker = speaker
                current_segment = segment
                current_duration = segment_duration
        
        # Export the last segment
        if current_segment:
            current_segment.export(
                os.path.join(diarized_folder, f"segment_{current_speaker}_{segment_counter}.wav"), format="wav"
            )
            speakers.append(current_speaker)

        for embd in embeddings_list:
            is_doctor = self.speakers_comparision(current_segment, embd)

            # Update highest_is_doctor and detected_speaker if is_doctor is high
            highest_is_doctor = 0.0  
            detected_speaker = "OWNER" 

            if is_doctor < 0.80:
                highest_is_doctor = is_doctor
                detected_speaker = "VETERINARIAN"
        
        if os.path.exists(current_segment):
                os.remove(current_segment)

        for i, (turn, _, speaker) in enumerate(diarization.itertracks(yield_label=True)):
            start_time = int(turn.start * 1000)  # Start time in milliseconds
            end_time = int(turn.end * 1000)  # End time in milliseconds

            # Skip segments shorter than 1 second
            if end_time - start_time < 2000:
                continue

            segment = audio[start_time:end_time]


            temp_segment_path = f"segment_{speaker}_{i}.wav"
            segment.export(temp_segment_path, format="wav")
                        
            # finally:
            if os.path.exists(temp_segment_path):
                os.remove(temp_segment_path)  # Clean up temporary file

            #print(f"Highest is_doctor value: {highest_is_doctor}, Detected speaker: {detected_speaker}")

            segment_duration = len(segment)

            if current_speaker is None:
                # Initialize the first speaker and segment
                current_speaker = speaker
                current_segment = segment
                current_duration = segment_duration

            elif current_speaker == speaker:
                # If the same speaker, combine the segments if under 60 seconds
                if current_duration + segment_duration > 60000:
                    # Export combined segment
                    current_segment.export(
                        os.path.join(diarized_folder, f"segment_{current_speaker}_{detected_speaker}.wav"), format="wav"
                    )
                    speakers.append(current_speaker)
                    segment_counter += 1
                    current_segment = segment
                    current_duration = segment_duration
                else:
                    current_segment += segment
                    current_duration += segment_duration
            else:
                # If the speaker changes, export the current combined segment
                current_segment.export(
                    os.path.join(diarized_folder, f"segment_{current_speaker}_{detected_speaker}.wav"), format="wav"
                )
                speakers.append(current_speaker)

                # Start a new segment for the new speaker
                segment_counter += 1
                current_speaker = speaker
                current_segment = segment
                current_duration = segment_duration




        logger.info(f"Final speakers list: {speakers}")

        # Sort the diarized files by their numeric suffix
        def extract_number(filename: str) -> int | float:
            match = re.search(r"(\d+)", filename)
            return int(match.group(0)) if match else float("inf")

        files = sorted(os.listdir(diarized_folder), key=extract_number)
        logger.info(f"Audio files: {files}")

        # Construct full paths to the diarized files
        prefixed_files = [os.path.join(diarized_folder, file) for file in files]

        # Return None for speakers if no files were diarized
        print("Speakers: ", speakers)
        if files == [] or speakers == []:
            return prefixed_files, speakers

        return prefixed_files, speakers

I wanna save audio files like  segment_SPEAKER_00_1, segment_SPEAKER_01_3, segment_SPEAKER_00_6, segment_SPEAKER_00_7 and so on attaching and merging samples of one speaker together in order if another speaker like 01 does interact the order of 00 speaker we stop and switch to him, remain the order of one speaker because each sample contains a conversation, and I wanna merge them together and remain the order of speakers and samples. Then I wanna push each merged sample to the loop with speakers_comparision function to detect if speaker's voice is VET'S or not and then add this label to it