Repository: livekit/agents
File: livekit-plugins/livekit-plugins-google/livekit/plugins/google/stt.py (Python)

Code before:
        if is_given(spoken_punctuation):
            self._config.spoken_punctuation = spoken_punctuation
        if is_given(profanity_filter):
            self._config.profanity_filter = profanity_filter
        if is_given(model):
            old_version = self._config.version
            self._config.model = model
            if self._config.version != old_version:
                self._pool.invalidate()

        if is_given(location):
            self._location = location
            # if location is changed, fetch a new client and recognizer as per the new location
            self._pool.invalidate()
        if is_given(denoiser_config):
            self._config.denoiser_config = denoiser_config
        if is_given(adaptation):
            self._validate_adaptation(adaptation, self._config.version)
            self._config.adaptation = adaptation
        if is_given(keywords):
            self._config.keywords = keywords
        if is_given(speech_start_timeout):
            self._config.speech_start_timeout = speech_start_timeout
        if is_given(speech_end_timeout):
            self._config.speech_end_timeout = speech_end_timeout

        for stream in self._streams:
            stream.update_options(
                languages=languages,
                detect_language=detect_language,
                interim_results=interim_results,
                punctuate=punctuate,
                spoken_punctuation=spoken_punctuation,
                profanity_filter=profanity_filter,
                model=model,
                denoiser_config=denoiser_config,
                adaptation=adaptation,
                keywords=keywords,
                speech_start_timeout=speech_start_timeout,
                speech_end_timeout=speech_end_timeout,
            )

    async def aclose(self) -> None:
        await self._pool.aclose()
        await super().aclose()

    def _validate_adaptation(
        self,
        adaptation: cloud_speech_v2.SpeechAdaptation | resource_v1.SpeechAdaptation,
        api_version: int,
    ) -> None:

Review comment (suggestion):
we should warn about keywords here too (neither `self._config.keywords` or `keywords` should be given).

Code after:
        if is_given(spoken_punctuation):
            self._config.spoken_punctuation = spoken_punctuation
        if is_given(profanity_filter):
            self._config.profanity_filter = profanity_filter
        new_version = (
            (2 if model in get_args(SpeechModelsV2) else 1)
            if is_given(model)
            else self._config.version
        )
        effective_adaptation = adaptation if is_given(adaptation) else self._config.adaptation
        if is_given(effective_adaptation) and (is_given(adaptation) or is_given(model)):
            self._validate_adaptation(effective_adaptation, new_version)

        if is_given(model):
            old_version = self._config.version
            self._config.model = model
            if self._config.version != old_version:
                self._pool.invalidate()

        if is_given(location):
            self._location = location
            # if location is changed, fetch a new client and recognizer as per the new location
            self._pool.invalidate()
        if is_given(denoiser_config):
            self._config.denoiser_config = denoiser_config
        if is_given(adaptation):
            if is_given(keywords) or is_given(self._config.keywords):
                logger.warning(
                    "Both 'adaptation' and 'keywords' are set; 'keywords' will be ignored."
                )
            self._config.adaptation = adaptation
        if is_given(keywords):
            if is_given(self._config.adaptation) and not is_given(adaptation):
                logger.warning(
                    "Both 'adaptation' and 'keywords' are set; 'keywords' will be ignored."
                )
            self._config.keywords = keywords
        if is_given(speech_start_timeout):
            self._config.speech_start_timeout = speech_start_timeout
        if is_given(speech_end_timeout):
            self._config.speech_end_timeout = speech_end_timeout

        for stream in self._streams:
            stream.update_options(
                languages=languages,
                detect_language=detect_language,
                interim_results=interim_results,
                punctuate=punctuate,
                spoken_punctuation=spoken_punctuation,
                profanity_filter=profanity_filter,
                model=model,