@@ -664,12 +664,11 @@ def start_recognizing_media(
664
664
dtmf_inter_tone_timeout : Optional [int ] = None ,
665
665
dtmf_max_tones_to_collect : Optional [int ] = None ,
666
666
dtmf_stop_tones : Optional [List [Union [str , 'DtmfTone' ]]] = None ,
667
- speech_language : Optional [str ] = None ,
667
+ speech_language : Optional [Union [ str , List [ str ]] ] = None ,
668
668
choices : Optional [List ["RecognitionChoice" ]] = None ,
669
669
end_silence_timeout : Optional [int ] = None ,
670
670
speech_recognition_model_endpoint_id : Optional [str ] = None ,
671
671
operation_callback_url : Optional [str ] = None ,
672
- speech_languages : Optional [List [str ]] = None ,
673
672
enable_sentiment_analysis : Optional [bool ] = None ,
674
673
** kwargs ,
675
674
) -> None :
@@ -704,8 +703,9 @@ def start_recognizing_media(
704
703
:keyword dtmf_stop_tones: List of tones that will stop recognizing. Will be ignored
705
704
unless input_type is 'dtmf' or 'speechOrDtmf'.
706
705
:paramtype dtmf_stop_tones: list[str or ~azure.communication.callautomation.DtmfTone]
707
- :keyword speech_language: Speech language to be recognized, If not set default is en-US.
708
- :paramtype speech_language: str
706
+ :keyword speech_language: Speech language to be recognized, If not set default is en-US
707
+ or list of languages for Language Identification.
708
+ :paramtype speech_language: str or list[str]
709
709
:keyword choices: Defines Ivr choices for recognize. Will be ignored unless input_type is 'choices'.
710
710
:paramtype choices: list[~azure.communication.callautomation.RecognitionChoice]
711
711
:keyword end_silence_timeout: The length of end silence when user stops speaking and cogservice
@@ -718,8 +718,6 @@ def start_recognizing_media(
718
718
This setup is per-action. If this is not set, the default callback URL set by
719
719
CreateCall/AnswerCall will be used.
720
720
:paramtype operation_callback_url: str or None
721
- :keyword speech_languages: Gets or sets a list of languages for Language Identification.
722
- :paramtype speech_languages: list[str]
723
721
:keyword enable_sentiment_analysis: Gets or sets a value indicating if sentiment analysis should
724
722
be used.
725
723
:paramtype enable_sentiment_analysis: bool
@@ -731,7 +729,6 @@ def start_recognizing_media(
731
729
interrupt_prompt = interrupt_prompt ,
732
730
initial_silence_timeout_in_seconds = initial_silence_timeout ,
733
731
target_participant = serialize_identifier (target_participant ),
734
- speech_language = speech_language ,
735
732
speech_recognition_model_endpoint_id = speech_recognition_model_endpoint_id ,
736
733
enable_sentiment_analysis = enable_sentiment_analysis ,
737
734
)
@@ -771,15 +768,15 @@ def start_recognizing_media(
771
768
options .choices = [choice ._to_generated () for choice in choices ] # pylint:disable=protected-access
772
769
else :
773
770
raise ValueError (f"Input type '{ input_type } ' is not supported." )
774
- if speech_languages :
775
- options .speech_languages = speech_languages
776
771
recognize_request = RecognizeRequest (
777
772
recognize_input_type = input_type ,
778
773
play_prompt = play_prompt_single ._to_generated () if play_prompt_single else None , # pylint:disable=protected-access
779
774
play_prompts = [prompt ._to_generated () for prompt in play_prompts ] if play_prompts else None , # pylint:disable=protected-access
775
+ speech_languages = speech_language if isinstance (speech_language , list ) else None ,
780
776
interrupt_call_media_operation = interrupt_call_media_operation ,
781
777
operation_context = operation_context ,
782
778
recognize_options = options ,
779
+ speech_language = speech_language if not isinstance (speech_language , list ) else None ,
783
780
operation_callback_uri = operation_callback_url ,
784
781
)
785
782
self ._call_media_client .recognize (self ._call_connection_id , recognize_request , ** kwargs )
@@ -952,20 +949,20 @@ def cancel_add_participant_operation(
952
949
def start_transcription (
953
950
self ,
954
951
* ,
955
- locale : Optional [str ] = None ,
952
+ locale : Optional [Union [ str , list [ str ]] ] = None ,
956
953
operation_context : Optional [str ] = None ,
957
954
speech_recognition_model_endpoint_id : Optional [str ] = None ,
958
955
operation_callback_url : Optional [str ] = None ,
959
- pii_redaction_options : Optional ["PiiRedactionOptions" ] = None ,
956
+ pii_redaction : Optional ["PiiRedactionOptions" ] = None ,
960
957
enable_sentiment_analysis : Optional [bool ] = None ,
961
- locales : Optional [List [str ]] = None ,
962
- summarization_options : Optional ["SummarizationOptions" ] = None ,
958
+ summarization : Optional ["SummarizationOptions" ] = None ,
963
959
** kwargs
964
960
) -> None :
965
961
"""Starts transcription in the call.
966
962
967
963
:keyword locale: Defines Locale for the transcription e,g en-US.
968
- :paramtype locale: str
964
+ List of languages for Language Identification.
965
+ :paramtype locale: str or list[str]
969
966
:keyword operation_context: The value to identify context of the operation.
970
967
:paramtype operation_context: str
971
968
:keyword speech_recognition_model_endpoint_id: Endpoint where the custom model was deployed.
@@ -975,30 +972,27 @@ def start_transcription(
975
972
This setup is per-action. If this is not set, the default callback URL set by
976
973
CreateCall/AnswerCall will be used.
977
974
:paramtype operation_callback_url: str or None
978
- :keyword pii_redaction_options: PII redaction configuration options.
979
- :paramtype pii_redaction_options:
980
- ~azure.communication.callautomation.models.PiiRedactionOptions
975
+ :keyword pii_redaction: PII redaction configuration options.
976
+ :paramtype pii_redaction: ~azure.communication.callautomation.models.PiiRedactionOptions
981
977
:keyword enable_sentiment_analysis: Indicating if sentiment analysis should be used.
982
978
:paramtype enable_sentiment_analysis: bool
983
- :keyword locales: List of languages for Language Identification.
984
- :paramtype locales: list[str]
985
- :keyword summarization_options: Summarization configuration options.
986
- :paramtype summarization_options:
979
+ :keyword summarization: Summarization configuration options.
980
+ :paramtype summarization:
987
981
~azure.communication.callautomation.models.SummarizationOptions
988
982
:return: None
989
983
:rtype: None
990
984
:raises ~azure.core.exceptions.HttpResponseError:
991
985
"""
992
986
993
987
start_transcription_request = StartTranscriptionRequest (
994
- locale = locale ,
988
+ locale = locale if not isinstance ( locale , list ) else None ,
995
989
operation_context = operation_context ,
996
990
speech_recognition_model_endpoint_id = speech_recognition_model_endpoint_id ,
997
991
operation_callback_uri = operation_callback_url ,
998
- pii_redaction_options = pii_redaction_options ._to_generated () if pii_redaction_options else None , # pylint:disable=protected-access
992
+ pii_redaction_options = pii_redaction ._to_generated () if pii_redaction else None , # pylint:disable=protected-access
999
993
enable_sentiment_analysis = enable_sentiment_analysis ,
1000
- locales = locales ,
1001
- summarization_options = summarization_options ._to_generated () if summarization_options else None , # pylint:disable=protected-access
994
+ locales = locale if isinstance ( locale , list ) else None ,
995
+ summarization_options = summarization ._to_generated () if summarization else None , # pylint:disable=protected-access
1002
996
** kwargs
1003
997
)
1004
998
self ._call_media_client .start_transcription (self ._call_connection_id , start_transcription_request )
@@ -1038,9 +1032,9 @@ def update_transcription(
1038
1032
operation_context : Optional [str ] = None ,
1039
1033
speech_recognition_model_endpoint_id : Optional [str ] = None ,
1040
1034
operation_callback_url : Optional [str ] = None ,
1041
- pii_redaction_options : Optional ["PiiRedactionOptions" ] = None ,
1035
+ pii_redaction : Optional ["PiiRedactionOptions" ] = None ,
1042
1036
enable_sentiment_analysis : Optional [bool ] = None ,
1043
- summarization_options : Optional ["SummarizationOptions" ] = None ,
1037
+ summarization : Optional ["SummarizationOptions" ] = None ,
1044
1038
** kwargs ) -> None :
1045
1039
"""API to change transcription language.
1046
1040
@@ -1055,12 +1049,12 @@ def update_transcription(
1055
1049
This setup is per-action. If this is not set, the default callback URL set by
1056
1050
CreateCall/AnswerCall will be used.
1057
1051
:paramtype operation_callback_url: str or None
1058
- :keyword pii_redaction_options : PII redaction configuration options.
1059
- :paramtype pii_redaction_options : ~azure.communication.callautomation.models.PiiRedactionOptions
1052
+ :keyword pii_redaction : PII redaction configuration options.
1053
+ :paramtype pii_redaction : ~azure.communication.callautomation.models.PiiRedactionOptions
1060
1054
:keyword enable_sentiment_analysis: Indicating if sentiment analysis should be used.
1061
1055
:paramtype enable_sentiment_analysis: bool
1062
- :keyword summarization_options : Summarization configuration options.
1063
- :paramtype summarization_options : ~azure.communication.callautomation.models.SummarizationOptions
1056
+ :keyword summarization : Summarization configuration options.
1057
+ :paramtype summarization : ~azure.communication.callautomation.models.SummarizationOptions
1064
1058
:return: None
1065
1059
:rtype: None
1066
1060
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1071,9 +1065,9 @@ def update_transcription(
1071
1065
operation_context = operation_context ,
1072
1066
speech_recognition_model_endpoint_id = speech_recognition_model_endpoint_id ,
1073
1067
operation_callback_uri = operation_callback_url ,
1074
- pii_redaction_options = pii_redaction_options ._to_generated () if pii_redaction_options else None , # pylint:disable=protected-access
1068
+ pii_redaction_options = pii_redaction ._to_generated () if pii_redaction else None , # pylint:disable=protected-access
1075
1069
enable_sentiment_analysis = enable_sentiment_analysis ,
1076
- summarization_options = summarization_options ._to_generated () if summarization_options else None , # pylint:disable=protected-access
1070
+ summarization_options = summarization ._to_generated () if summarization else None , # pylint:disable=protected-access
1077
1071
** kwargs
1078
1072
)
1079
1073
self ._call_media_client .update_transcription (self ._call_connection_id , update_transcription_request )
@@ -1084,7 +1078,7 @@ def summarize_call(
1084
1078
* ,
1085
1079
operation_context : Optional [str ] = None ,
1086
1080
operation_callback_url : Optional [str ] = None ,
1087
- summarization_options : Optional [SummarizationOptions ] = None ,
1081
+ summarization : Optional [SummarizationOptions ] = None ,
1088
1082
** kwargs
1089
1083
) -> None :
1090
1084
""" Summary details of call.
@@ -1096,8 +1090,8 @@ def summarize_call(
1096
1090
This setup is per-action. If this is not set, the default callback URL set by
1097
1091
CreateCall/AnswerCall will be used.
1098
1092
:paramtype operation_callback_url: str or None
1099
- :keyword summarization_options : Summarization configuration options.
1100
- :paramtype summarization_options : ~azure.communication.callautomation.models.SummarizationOptions
1093
+ :keyword summarization : Summarization configuration options.
1094
+ :paramtype summarization : ~azure.communication.callautomation.models.SummarizationOptions
1101
1095
:type locale: str
1102
1096
:return: None
1103
1097
:rtype: None
@@ -1107,7 +1101,7 @@ def summarize_call(
1107
1101
summarize_call_request = SummarizeCallRequest (
1108
1102
operation_context = operation_context ,
1109
1103
operation_callback_uri = operation_callback_url ,
1110
- summarization_options = summarization_options ._to_generated () if summarization_options else None , # pylint:disable=protected-access
1104
+ summarization_options = summarization ._to_generated () if summarization else None , # pylint:disable=protected-access
1111
1105
** kwargs
1112
1106
)
1113
1107
0 commit comments