sarvamai 0.1.6__tar.gz → 0.1.7a0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sarvamai-0.1.7a0/PKG-INFO +1192 -0
- sarvamai-0.1.7a0/README.md +1164 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/pyproject.toml +1 -1
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/__init__.py +60 -1
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/client.py +3 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/core/client_wrapper.py +2 -2
- sarvamai-0.1.7a0/src/sarvamai/errors/service_unavailable_error.py +10 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/__init__.py +22 -0
- sarvamai-0.1.7a0/src/sarvamai/requests/base_job_parameters.py +7 -0
- sarvamai-0.1.7a0/src/sarvamai/requests/bulk_job_callback.py +15 -0
- sarvamai-0.1.7a0/src/sarvamai/requests/bulk_job_init_response_v_1.py +27 -0
- sarvamai-0.1.7a0/src/sarvamai/requests/file_signed_url_details.py +10 -0
- sarvamai-0.1.7a0/src/sarvamai/requests/files_download_response.py +15 -0
- sarvamai-0.1.7a0/src/sarvamai/requests/files_request.py +10 -0
- sarvamai-0.1.7a0/src/sarvamai/requests/files_upload_response.py +15 -0
- sarvamai-0.1.7a0/src/sarvamai/requests/job_status_v_1.py +70 -0
- sarvamai-0.1.7a0/src/sarvamai/requests/speech_to_text_job_parameters.py +32 -0
- sarvamai-0.1.7a0/src/sarvamai/requests/task_detail_v_1.py +15 -0
- sarvamai-0.1.7a0/src/sarvamai/requests/task_file_details.py +8 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text/raw_client.py +8 -9
- sarvamai-0.1.7a0/src/sarvamai/speech_to_text_job/client.py +454 -0
- sarvamai-0.1.7a0/src/sarvamai/speech_to_text_job/raw_client.py +1189 -0
- sarvamai-0.1.7a0/src/sarvamai/text_to_speech/__init__.py +4 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/__init__.py +28 -0
- sarvamai-0.1.7a0/src/sarvamai/types/base_job_parameters.py +17 -0
- sarvamai-0.1.7a0/src/sarvamai/types/bulk_job_callback.py +27 -0
- sarvamai-0.1.7a0/src/sarvamai/types/bulk_job_init_response_v_1.py +39 -0
- sarvamai-0.1.7a0/src/sarvamai/types/file_signed_url_details.py +20 -0
- sarvamai-0.1.7a0/src/sarvamai/types/files_download_response.py +25 -0
- sarvamai-0.1.7a0/src/sarvamai/types/files_request.py +20 -0
- sarvamai-0.1.7a0/src/sarvamai/types/files_upload_response.py +25 -0
- sarvamai-0.1.7a0/src/sarvamai/types/job_state.py +5 -0
- sarvamai-0.1.7a0/src/sarvamai/types/job_status_v_1.py +80 -0
- sarvamai-0.1.7a0/src/sarvamai/types/speech_to_text_job_parameters.py +44 -0
- sarvamai-0.1.7a0/src/sarvamai/types/storage_container_type.py +5 -0
- sarvamai-0.1.7a0/src/sarvamai/types/task_detail_v_1.py +25 -0
- sarvamai-0.1.7a0/src/sarvamai/types/task_file_details.py +20 -0
- sarvamai-0.1.7a0/src/sarvamai/types/task_state.py +5 -0
- sarvamai-0.1.6/PKG-INFO +0 -28
- sarvamai-0.1.6/README.md +0 -0
- sarvamai-0.1.6/src/sarvamai/errors/service_unavailable_error.py +0 -11
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/chat/__init__.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/chat/client.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/chat/raw_client.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/core/__init__.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/core/api_error.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/core/datetime_utils.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/core/events.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/core/file.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/core/force_multipart.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/core/http_client.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/core/http_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/core/jsonable_encoder.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/core/pydantic_utilities.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/core/query_encoder.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/core/remove_none_from_dict.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/core/request_options.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/core/serialization.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/environment.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/errors/__init__.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/errors/bad_request_error.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/errors/forbidden_error.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/errors/internal_server_error.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/errors/too_many_requests_error.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/errors/unprocessable_entity_error.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/play.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/py.typed +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/audio_data.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/audio_message.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/chat_completion_request_assistant_message.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/chat_completion_request_message.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/chat_completion_request_system_message.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/chat_completion_request_user_message.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/chat_completion_response_message.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/choice.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/completion_usage.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/config_message.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/create_chat_completion_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/diarized_entry.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/diarized_transcript.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/error_data.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/error_details.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/error_message.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/events_data.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/language_identification_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/speech_to_text_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/speech_to_text_response_data.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/speech_to_text_streaming_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/speech_to_text_transcription_data.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/speech_to_text_translate_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/speech_to_text_translate_response_data.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/speech_to_text_translate_streaming_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/speech_to_text_translate_transcription_data.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/stop_configuration.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/text_to_speech_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/timestamps_model.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/transcription_metrics.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/translation_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/requests/transliteration_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text/__init__.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text/client.py +0 -0
- {sarvamai-0.1.6/src/sarvamai/text → sarvamai-0.1.7a0/src/sarvamai/speech_to_text_job}/__init__.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text_streaming/__init__.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text_streaming/client.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text_streaming/raw_client.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text_streaming/socket_client.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text_streaming/types/__init__.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_high_vad_sensitivity.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_language_code.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_model.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_vad_signals.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text_translate_streaming/__init__.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text_translate_streaming/client.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text_translate_streaming/raw_client.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text_translate_streaming/socket_client.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text_translate_streaming/types/__init__.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text_translate_streaming/types/speech_to_text_translate_streaming_high_vad_sensitivity.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text_translate_streaming/types/speech_to_text_translate_streaming_model.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/speech_to_text_translate_streaming/types/speech_to_text_translate_streaming_vad_signals.py +0 -0
- {sarvamai-0.1.6/src/sarvamai/text_to_speech → sarvamai-0.1.7a0/src/sarvamai/text}/__init__.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/text/client.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/text/raw_client.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/text_to_speech/client.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/text_to_speech/raw_client.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/audio_data.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/audio_message.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/chat_completion_request_assistant_message.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/chat_completion_request_message.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/chat_completion_request_system_message.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/chat_completion_request_user_message.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/chat_completion_response_message.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/choice.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/completion_usage.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/config_message.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/create_chat_completion_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/diarized_entry.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/diarized_transcript.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/error_code.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/error_data.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/error_details.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/error_message.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/events_data.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/finish_reason.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/format.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/language_identification_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/numerals_format.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/reasoning_effort.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/response_type.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/role.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/sarvam_model_ids.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/speech_sample_rate.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/speech_to_text_language.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/speech_to_text_model.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/speech_to_text_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/speech_to_text_response_data.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/speech_to_text_streaming_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/speech_to_text_transcription_data.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/speech_to_text_translate_language.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/speech_to_text_translate_model.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/speech_to_text_translate_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/speech_to_text_translate_response_data.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/speech_to_text_translate_streaming_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/speech_to_text_translate_transcription_data.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/spoken_form_numerals_format.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/stop_configuration.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/text_to_speech_language.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/text_to_speech_model.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/text_to_speech_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/text_to_speech_speaker.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/timestamps_model.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/transcription_metrics.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/translate_mode.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/translate_model.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/translate_source_language.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/translate_speaker_gender.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/translate_target_language.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/translation_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/translatiterate_target_language.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/transliterate_mode.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/transliterate_source_language.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/types/transliteration_response.py +0 -0
- {sarvamai-0.1.6 → sarvamai-0.1.7a0}/src/sarvamai/version.py +0 -0
|
@@ -0,0 +1,1192 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: sarvamai
|
|
3
|
+
Version: 0.1.7a0
|
|
4
|
+
Summary:
|
|
5
|
+
Requires-Python: >=3.8,<4.0
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: Operating System :: MacOS
|
|
8
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Operating System :: POSIX
|
|
11
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Dist: httpx (>=0.21.2)
|
|
22
|
+
Requires-Dist: pydantic (>=1.9.2)
|
|
23
|
+
Requires-Dist: pydantic-core (>=2.18.2,<3.0.0)
|
|
24
|
+
Requires-Dist: typing_extensions (>=4.0.0)
|
|
25
|
+
Requires-Dist: websockets (==12.0)
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# Sarvam Python Library
|
|
29
|
+
|
|
30
|
+
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fsarvamai%2Fsarvam-python-sdk)
|
|
31
|
+
[](https://pypi.python.org/pypi/sarvamai)
|
|
32
|
+
|
|
33
|
+
The Sarvam Python library provides convenient access to the Sarvam API from Python.
|
|
34
|
+
|
|
35
|
+
## Documentation
|
|
36
|
+
|
|
37
|
+
API reference documentation is available [here](https://docs.sarvam.ai/api-reference-docs/speech-to-text/).
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
pip install sarvamai
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Reference
|
|
46
|
+
|
|
47
|
+
A full reference for this library is available [here](#References).
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
Instantiate and use the client with the following:
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from sarvamai import SarvamAI
|
|
55
|
+
|
|
56
|
+
client = SarvamAI(
|
|
57
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
58
|
+
)
|
|
59
|
+
client.text.translate(
|
|
60
|
+
input="input",
|
|
61
|
+
source_language_code="auto",
|
|
62
|
+
target_language_code="bn-IN",
|
|
63
|
+
)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Async Client
|
|
67
|
+
|
|
68
|
+
The SDK also exports an `async` client so that you can make non-blocking calls to our API.
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
import asyncio
|
|
72
|
+
|
|
73
|
+
from sarvamai import AsyncSarvamAI
|
|
74
|
+
|
|
75
|
+
client = AsyncSarvamAI(
|
|
76
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
async def main() -> None:
|
|
81
|
+
await client.text.translate(
|
|
82
|
+
input="input",
|
|
83
|
+
source_language_code="auto",
|
|
84
|
+
target_language_code="bn-IN",
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
asyncio.run(main())
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Exception Handling
|
|
92
|
+
|
|
93
|
+
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
|
|
94
|
+
will be thrown.
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
from sarvamai.core.api_error import ApiError
|
|
98
|
+
|
|
99
|
+
try:
|
|
100
|
+
client.text.translate(...)
|
|
101
|
+
except ApiError as e:
|
|
102
|
+
print(e.status_code)
|
|
103
|
+
print(e.body)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Advanced
|
|
107
|
+
|
|
108
|
+
### Retries
|
|
109
|
+
|
|
110
|
+
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
|
|
111
|
+
as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
|
|
112
|
+
retry limit (default: 2).
|
|
113
|
+
|
|
114
|
+
A request is deemed retryable when any of the following HTTP status codes is returned:
|
|
115
|
+
|
|
116
|
+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
|
117
|
+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
|
118
|
+
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
|
|
119
|
+
|
|
120
|
+
Use the `max_retries` request option to configure this behavior.
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
client.text.translate(..., request_options={
|
|
124
|
+
"max_retries": 1
|
|
125
|
+
})
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Timeouts
|
|
129
|
+
|
|
130
|
+
The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
|
|
134
|
+
from sarvamai import SarvamAI
|
|
135
|
+
|
|
136
|
+
client = SarvamAI(
|
|
137
|
+
...,
|
|
138
|
+
timeout=20.0,
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
# Override timeout for a specific method
|
|
143
|
+
client.text.translate(..., request_options={
|
|
144
|
+
"timeout_in_seconds": 1
|
|
145
|
+
})
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Custom Client
|
|
149
|
+
|
|
150
|
+
You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
|
|
151
|
+
and transports.
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
import httpx
|
|
155
|
+
from sarvamai import SarvamAI
|
|
156
|
+
|
|
157
|
+
client = SarvamAI(
|
|
158
|
+
...,
|
|
159
|
+
httpx_client=httpx.Client(
|
|
160
|
+
proxies="http://my.test.proxy.example.com",
|
|
161
|
+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
|
|
162
|
+
),
|
|
163
|
+
)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Contributing
|
|
167
|
+
|
|
168
|
+
While we value open-source contributions to this SDK, this library is generated programmatically.
|
|
169
|
+
Additions made directly to this library would have to be moved over to our generation code,
|
|
170
|
+
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
|
|
171
|
+
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
|
|
172
|
+
an issue first to discuss with us!
|
|
173
|
+
|
|
174
|
+
On the other hand, contributions to the README are always very welcome!
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## References
|
|
179
|
+
|
|
180
|
+
### Text
|
|
181
|
+
<details><summary><code>client.text.<a href="src/sarvamai/text/client.py">translate</a>(...)</code></summary>
|
|
182
|
+
<dl>
|
|
183
|
+
<dd>
|
|
184
|
+
|
|
185
|
+
#### 📝 Description
|
|
186
|
+
|
|
187
|
+
<dl>
|
|
188
|
+
<dd>
|
|
189
|
+
|
|
190
|
+
<dl>
|
|
191
|
+
<dd>
|
|
192
|
+
|
|
193
|
+
**Translation** converts text from one language to another while preserving its meaning.
|
|
194
|
+
For Example: **'मैं ऑफिस जा रहा हूँ'** translates to **'I am going to the office'** in English, where the script and language change, but the original meaning remains the same.
|
|
195
|
+
|
|
196
|
+
Available languages:
|
|
197
|
+
- **`bn-IN`**: Bengali
|
|
198
|
+
- **`en-IN`**: English
|
|
199
|
+
- **`gu-IN`**: Gujarati
|
|
200
|
+
- **`hi-IN`**: Hindi
|
|
201
|
+
- **`kn-IN`**: Kannada
|
|
202
|
+
- **`ml-IN`**: Malayalam
|
|
203
|
+
- **`mr-IN`**: Marathi
|
|
204
|
+
- **`od-IN`**: Odia
|
|
205
|
+
- **`pa-IN`**: Punjabi
|
|
206
|
+
- **`ta-IN`**: Tamil
|
|
207
|
+
- **`te-IN`**: Telugu
|
|
208
|
+
|
|
209
|
+
#### Newly added languages:
|
|
210
|
+
- **`as-IN`**: Assamese
|
|
211
|
+
- **`brx-IN`**: Bodo
|
|
212
|
+
- **`doi-IN`**: Dogri
|
|
213
|
+
- **`kok-IN`**: Konkani
|
|
214
|
+
- **`ks-IN`**: Kashmiri
|
|
215
|
+
- **`mai-IN`**: Maithili
|
|
216
|
+
- **`mni-IN`**: Manipuri (Meiteilon)
|
|
217
|
+
- **`ne-IN`**: Nepali
|
|
218
|
+
- **`sa-IN`**: Sanskrit
|
|
219
|
+
- **`sat-IN`**: Santali
|
|
220
|
+
- **`sd-IN`**: Sindhi
|
|
221
|
+
- **`ur-IN`**: Urdu
|
|
222
|
+
|
|
223
|
+
For hands-on practice, you can explore the notebook tutorial on [Translate API Tutorial](https://github.com/sarvamai/sarvam-ai-cookbook/blob/main/notebooks/translate/Translate_API_Tutorial.ipynb).
|
|
224
|
+
</dd>
|
|
225
|
+
</dl>
|
|
226
|
+
</dd>
|
|
227
|
+
</dl>
|
|
228
|
+
|
|
229
|
+
#### 🔌 Usage
|
|
230
|
+
|
|
231
|
+
<dl>
|
|
232
|
+
<dd>
|
|
233
|
+
|
|
234
|
+
<dl>
|
|
235
|
+
<dd>
|
|
236
|
+
|
|
237
|
+
```python
|
|
238
|
+
from sarvamai import SarvamAI
|
|
239
|
+
|
|
240
|
+
client = SarvamAI(
|
|
241
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
242
|
+
)
|
|
243
|
+
client.text.translate(
|
|
244
|
+
input="input",
|
|
245
|
+
source_language_code="auto",
|
|
246
|
+
target_language_code="bn-IN",
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
</dd>
|
|
251
|
+
</dl>
|
|
252
|
+
</dd>
|
|
253
|
+
</dl>
|
|
254
|
+
|
|
255
|
+
#### ⚙️ Parameters
|
|
256
|
+
|
|
257
|
+
<dl>
|
|
258
|
+
<dd>
|
|
259
|
+
|
|
260
|
+
<dl>
|
|
261
|
+
<dd>
|
|
262
|
+
|
|
263
|
+
**input:** `str` — The text you want to translate is the input text that will be processed by the translation model. The maximum is 1000 characters for Mayura:v1 and 2000 characters for Sarvam-Translate:v1.
|
|
264
|
+
|
|
265
|
+
</dd>
|
|
266
|
+
</dl>
|
|
267
|
+
|
|
268
|
+
<dl>
|
|
269
|
+
<dd>
|
|
270
|
+
|
|
271
|
+
**source_language_code:** `TranslateSourceLanguage`
|
|
272
|
+
|
|
273
|
+
Source language code for translation input.
|
|
274
|
+
|
|
275
|
+
**mayura:v1 Languages:** Bengali, English, Gujarati, Hindi, Kannada, Malayalam, Marathi, Odia, Punjabi, Tamil, Telugu
|
|
276
|
+
|
|
277
|
+
**sarvam-translate:v1 Languages:** All mayura:v1 languages and Assamese, Bodo, Dogri, Konkani, Kashmiri, Maithili, Manipuri, Nepali, Sanskrit, Santali, Sindhi, Urdu
|
|
278
|
+
|
|
279
|
+
**Note:** mayura:v1 supports automatic language detection using 'auto' as the source language code.
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
</dd>
|
|
283
|
+
</dl>
|
|
284
|
+
|
|
285
|
+
<dl>
|
|
286
|
+
<dd>
|
|
287
|
+
|
|
288
|
+
**target_language_code:** `TranslateTargetLanguage`
|
|
289
|
+
|
|
290
|
+
The language code of the translated text. This specifies the target language for translation.
|
|
291
|
+
|
|
292
|
+
**mayura:v1 Languages:** Bengali, English, Gujarati, Hindi, Kannada, Malayalam, Marathi, Odia, Punjabi, Tamil, Telugu
|
|
293
|
+
|
|
294
|
+
**sarvam-translate:v1 Languages:** All mayura:v1 and Assamese, Bodo, Dogri, Konkani, Kashmiri, Maithili, Manipuri, Nepali, Sanskrit, Santali, Sindhi, Urdu
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
</dd>
|
|
298
|
+
</dl>
|
|
299
|
+
|
|
300
|
+
<dl>
|
|
301
|
+
<dd>
|
|
302
|
+
|
|
303
|
+
**speaker_gender:** `typing.Optional[TranslateSpeakerGender]` — Please specify the gender of the speaker for better translations.
|
|
304
|
+
|
|
305
|
+
</dd>
|
|
306
|
+
</dl>
|
|
307
|
+
|
|
308
|
+
<dl>
|
|
309
|
+
<dd>
|
|
310
|
+
|
|
311
|
+
**mode:** `typing.Optional[TranslateMode]`
|
|
312
|
+
|
|
313
|
+
Specifies the tone or style of the translation.
|
|
314
|
+
|
|
315
|
+
**Model Support:**
|
|
316
|
+
- **mayura:v1**: Supports formal, classic-colloquial, and modern-colloquial modes
|
|
317
|
+
- **sarvam-translate:v1**: Only formal mode is supported
|
|
318
|
+
|
|
319
|
+
**Default:** formal
|
|
320
|
+
|
|
321
|
+
</dd>
|
|
322
|
+
</dl>
|
|
323
|
+
|
|
324
|
+
<dl>
|
|
325
|
+
<dd>
|
|
326
|
+
|
|
327
|
+
**model:** `typing.Optional[TranslateModel]`
|
|
328
|
+
|
|
329
|
+
Specifies the translation model to use.
|
|
330
|
+
- mayura:v1: Supports 12 languages with all modes, output scripts, and automatic language detection.
|
|
331
|
+
- sarvam-translate:v1: Supports all 22 scheduled languages of India, formal mode only.
|
|
332
|
+
|
|
333
|
+
</dd>
|
|
334
|
+
</dl>
|
|
335
|
+
|
|
336
|
+
<dl>
|
|
337
|
+
<dd>
|
|
338
|
+
|
|
339
|
+
**enable_preprocessing:** `typing.Optional[bool]`
|
|
340
|
+
|
|
341
|
+
This will enable custom preprocessing of the input text which can result in better translations.
|
|
342
|
+
Recommendation- You can switch on whenever there is some complex text with difficult vocabulary and sentences, for which you want simple translations that people can understand.
|
|
343
|
+
|
|
344
|
+
</dd>
|
|
345
|
+
</dl>
|
|
346
|
+
|
|
347
|
+
<dl>
|
|
348
|
+
<dd>
|
|
349
|
+
|
|
350
|
+
**output_script:** `typing.Optional[TransliterateMode]`
|
|
351
|
+
|
|
352
|
+
**output_script**: This is an optional parameter which controls the transliteration style applied to the output text.
|
|
353
|
+
|
|
354
|
+
**Transliteration**: Converting text from one script to another while preserving pronunciation.
|
|
355
|
+
|
|
356
|
+
For mayura:v1 - We support transliteration with four options:
|
|
357
|
+
- **`null`**(default): No transliteration applied.
|
|
358
|
+
- **`roman`**: Transliteration in Romanized script.
|
|
359
|
+
- **`fully-native`**: Transliteration in the native script with formal style.
|
|
360
|
+
- **`spoken-form-in-native`**: Transliteration in the native script with spoken style.
|
|
361
|
+
|
|
362
|
+
For sarvam-translate:v1 - Transliteration is not supported.
|
|
363
|
+
#### Example:
|
|
364
|
+
English: Your EMI of Rs. 3000 is pending.
|
|
365
|
+
Default modern translation: आपका Rs. 3000 का EMI pending है (when `null` is passed).
|
|
366
|
+
|
|
367
|
+
With postprocessing enabled:
|
|
368
|
+
- **roman output**: aapka Rs. 3000 ka EMI pending hai.
|
|
369
|
+
|
|
370
|
+
</dd>
|
|
371
|
+
</dl>
|
|
372
|
+
|
|
373
|
+
<dl>
|
|
374
|
+
<dd>
|
|
375
|
+
|
|
376
|
+
**numerals_format:** `typing.Optional[NumeralsFormat]`
|
|
377
|
+
|
|
378
|
+
`numerals_format` is an optional parameter with two options (supported for both mayura:v1 and sarvam-translate:v1):
|
|
379
|
+
|
|
380
|
+
- **`international`** (default): Uses regular numerals (0-9).
|
|
381
|
+
- **`native`**: Uses language-specific native numerals.
|
|
382
|
+
|
|
383
|
+
#### Example:
|
|
384
|
+
- If `international` format is selected, we use regular numerals (0-9). For example: `मेरा phone number है: 9840950950`.
|
|
385
|
+
- If `native` format is selected, we use language-specific native numerals, like: `मेरा phone number है: ९८४०९५०९५०`.
|
|
386
|
+
|
|
387
|
+
</dd>
|
|
388
|
+
</dl>
|
|
389
|
+
|
|
390
|
+
<dl>
|
|
391
|
+
<dd>
|
|
392
|
+
|
|
393
|
+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
|
|
394
|
+
|
|
395
|
+
</dd>
|
|
396
|
+
</dl>
|
|
397
|
+
</dd>
|
|
398
|
+
</dl>
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
</dd>
|
|
402
|
+
</dl>
|
|
403
|
+
</details>
|
|
404
|
+
|
|
405
|
+
<details><summary><code>client.text.<a href="src/sarvamai/text/client.py">identify_language</a>(...)</code></summary>
|
|
406
|
+
<dl>
|
|
407
|
+
<dd>
|
|
408
|
+
|
|
409
|
+
#### 📝 Description
|
|
410
|
+
|
|
411
|
+
<dl>
|
|
412
|
+
<dd>
|
|
413
|
+
|
|
414
|
+
<dl>
|
|
415
|
+
<dd>
|
|
416
|
+
|
|
417
|
+
Identifies the language (e.g., en-IN, hi-IN) and script (e.g., Latin, Devanagari) of the input text, supporting multiple languages.
|
|
418
|
+
</dd>
|
|
419
|
+
</dl>
|
|
420
|
+
</dd>
|
|
421
|
+
</dl>
|
|
422
|
+
|
|
423
|
+
#### 🔌 Usage
|
|
424
|
+
|
|
425
|
+
<dl>
|
|
426
|
+
<dd>
|
|
427
|
+
|
|
428
|
+
<dl>
|
|
429
|
+
<dd>
|
|
430
|
+
|
|
431
|
+
```python
|
|
432
|
+
from sarvamai import SarvamAI
|
|
433
|
+
|
|
434
|
+
client = SarvamAI(
|
|
435
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
436
|
+
)
|
|
437
|
+
client.text.identify_language(
|
|
438
|
+
input="input",
|
|
439
|
+
)
|
|
440
|
+
|
|
441
|
+
```
|
|
442
|
+
</dd>
|
|
443
|
+
</dl>
|
|
444
|
+
</dd>
|
|
445
|
+
</dl>
|
|
446
|
+
|
|
447
|
+
#### ⚙️ Parameters
|
|
448
|
+
|
|
449
|
+
<dl>
|
|
450
|
+
<dd>
|
|
451
|
+
|
|
452
|
+
<dl>
|
|
453
|
+
<dd>
|
|
454
|
+
|
|
455
|
+
**input:** `str` — The text input for language and script identification.
|
|
456
|
+
|
|
457
|
+
</dd>
|
|
458
|
+
</dl>
|
|
459
|
+
|
|
460
|
+
<dl>
|
|
461
|
+
<dd>
|
|
462
|
+
|
|
463
|
+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
|
|
464
|
+
|
|
465
|
+
</dd>
|
|
466
|
+
</dl>
|
|
467
|
+
</dd>
|
|
468
|
+
</dl>
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
</dd>
|
|
472
|
+
</dl>
|
|
473
|
+
</details>
|
|
474
|
+
|
|
475
|
+
<details><summary><code>client.text.<a href="src/sarvamai/text/client.py">transliterate</a>(...)</code></summary>
|
|
476
|
+
<dl>
|
|
477
|
+
<dd>
|
|
478
|
+
|
|
479
|
+
#### 📝 Description
|
|
480
|
+
|
|
481
|
+
<dl>
|
|
482
|
+
<dd>
|
|
483
|
+
|
|
484
|
+
<dl>
|
|
485
|
+
<dd>
|
|
486
|
+
|
|
487
|
+
**Transliteration** converts text from one script to another while preserving the original pronunciation. For example, **'नमस्ते'** becomes **'namaste'** in English, and **'how are you'** can be written as **'हाउ आर यू'** in Devanagari. This process ensures that the sound of the original text remains intact, even when written in a different script.
|
|
488
|
+
|
|
489
|
+
Transliteration is useful when you want to represent words phonetically across different writing systems, such as converting **'मैं ऑफिस जा रहा हूँ'** to **'main office ja raha hun'** in English letters.
|
|
490
|
+
|
|
491
|
+
**Translation**, on the other hand, converts text from one language to another while preserving the meaning rather than pronunciation. For example, **'मैं ऑफिस जा रहा हूँ'** translates to **'I am going to the office'** in English, changing both the script and the language while conveying the intended message.
|
|
492
|
+
#### Examples of **Transliteration**:
|
|
493
|
+
- **'Good morning'** becomes **'गुड मॉर्निंग'** in Hindi, where the pronunciation is preserved but the meaning is not translated.
|
|
494
|
+
- **'सुप्रभात'** becomes **'suprabhat'** in English.
|
|
495
|
+
|
|
496
|
+
Available languages:
|
|
497
|
+
- **`en-IN`**: English
|
|
498
|
+
- **`hi-IN`**: Hindi
|
|
499
|
+
- **`bn-IN`**: Bengali
|
|
500
|
+
- **`gu-IN`**: Gujarati
|
|
501
|
+
- **`kn-IN`**: Kannada
|
|
502
|
+
- **`ml-IN`**: Malayalam
|
|
503
|
+
- **`mr-IN`**: Marathi
|
|
504
|
+
- **`od-IN`**: Odia
|
|
505
|
+
- **`pa-IN`**: Punjabi
|
|
506
|
+
- **`ta-IN`**: Tamil
|
|
507
|
+
- **`te-IN`**: Telugu
|
|
508
|
+
|
|
509
|
+
For hands-on practice, you can explore the notebook tutorial on [Transliterate API Tutorial](https://github.com/sarvamai/sarvam-ai-cookbook/blob/main/notebooks/transliterate/Transliterate_API_Tutorial.ipynb).
|
|
510
|
+
</dd>
|
|
511
|
+
</dl>
|
|
512
|
+
</dd>
|
|
513
|
+
</dl>
|
|
514
|
+
|
|
515
|
+
#### 🔌 Usage
|
|
516
|
+
|
|
517
|
+
<dl>
|
|
518
|
+
<dd>
|
|
519
|
+
|
|
520
|
+
<dl>
|
|
521
|
+
<dd>
|
|
522
|
+
|
|
523
|
+
```python
|
|
524
|
+
from sarvamai import SarvamAI
|
|
525
|
+
|
|
526
|
+
client = SarvamAI(
|
|
527
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
528
|
+
)
|
|
529
|
+
client.text.transliterate(
|
|
530
|
+
input="input",
|
|
531
|
+
source_language_code="auto",
|
|
532
|
+
target_language_code="bn-IN",
|
|
533
|
+
)
|
|
534
|
+
|
|
535
|
+
```
|
|
536
|
+
</dd>
|
|
537
|
+
</dl>
|
|
538
|
+
</dd>
|
|
539
|
+
</dl>
|
|
540
|
+
|
|
541
|
+
#### ⚙️ Parameters
|
|
542
|
+
|
|
543
|
+
<dl>
|
|
544
|
+
<dd>
|
|
545
|
+
|
|
546
|
+
<dl>
|
|
547
|
+
<dd>
|
|
548
|
+
|
|
549
|
+
**input:** `str` — The text you want to transliterate.
|
|
550
|
+
|
|
551
|
+
</dd>
|
|
552
|
+
</dl>
|
|
553
|
+
|
|
554
|
+
<dl>
|
|
555
|
+
<dd>
|
|
556
|
+
|
|
557
|
+
**source_language_code:** `TransliterateSourceLanguage`
|
|
558
|
+
|
|
559
|
+
The language code of the input text. This specifies the source language for transliteration.
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
Note: The source language should either be an Indic language or English. As we supports both Indic-to-English and English-to-Indic transliteration.
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
</dd>
|
|
567
|
+
</dl>
|
|
568
|
+
|
|
569
|
+
<dl>
|
|
570
|
+
<dd>
|
|
571
|
+
|
|
572
|
+
**target_language_code:** `TranslatiterateTargetLanguage`
|
|
573
|
+
|
|
574
|
+
The language code of the transliteration text. This specifies the target language for transliteration.
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
Note:The target language should either be an Indic language or English. As we supports both Indic-to-English and English-to-Indic transliteration.
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
</dd>
|
|
582
|
+
</dl>
|
|
583
|
+
|
|
584
|
+
<dl>
|
|
585
|
+
<dd>
|
|
586
|
+
|
|
587
|
+
**numerals_format:** `typing.Optional[NumeralsFormat]`
|
|
588
|
+
|
|
589
|
+
`numerals_format` is an optional parameter with two options:
|
|
590
|
+
|
|
591
|
+
- **`international`** (default): Uses regular numerals (0-9).
|
|
592
|
+
- **`native`**: Uses language-specific native numerals.
|
|
593
|
+
|
|
594
|
+
#### Example:
|
|
595
|
+
- If `international` format is selected, we use regular numerals (0-9). For example: `मेरा phone number है: 9840950950`.
|
|
596
|
+
- If `native` format is selected, we use language-specific native numerals, like: `मेरा phone number है: ९८४०९५०९५०`.
|
|
597
|
+
|
|
598
|
+
</dd>
|
|
599
|
+
</dl>
|
|
600
|
+
|
|
601
|
+
<dl>
|
|
602
|
+
<dd>
|
|
603
|
+
|
|
604
|
+
**spoken_form_numerals_language:** `typing.Optional[SpokenFormNumeralsFormat]`
|
|
605
|
+
|
|
606
|
+
`spoken_form_numerals_language` is an optional parameter with two options and only works when spoken_form is true:
|
|
607
|
+
|
|
608
|
+
- **`english`** : Numbers in the text will be spoken in English.
|
|
609
|
+
- **`native(default)`**: Numbers in the text will be spoken in the native language.
|
|
610
|
+
|
|
611
|
+
#### Examples:
|
|
612
|
+
- **Input:** "मेरे पास ₹200 है"
|
|
613
|
+
- If `english` format is selected: "मेरे पास टू हन्डर्ड रूपीस है"
|
|
614
|
+
- If `native` format is selected: "मेरे पास दो सौ रुपये है"
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
</dd>
|
|
618
|
+
</dl>
|
|
619
|
+
|
|
620
|
+
<dl>
|
|
621
|
+
<dd>
|
|
622
|
+
|
|
623
|
+
**spoken_form:** `typing.Optional[bool]`
|
|
624
|
+
|
|
625
|
+
- Default: `False`
|
|
626
|
+
- Converts text into a natural spoken form when `True`.
|
|
627
|
+
- **Note:** No effect if output language is `en-IN`.
|
|
628
|
+
|
|
629
|
+
#### Example:
|
|
630
|
+
- **Input:** `मुझे कल 9:30am को appointment है`
|
|
631
|
+
- **Output:** `मुझे कल सुबह साढ़े नौ बजे को अपॉइंटमेंट है`
|
|
632
|
+
|
|
633
|
+
</dd>
|
|
634
|
+
</dl>
|
|
635
|
+
|
|
636
|
+
<dl>
|
|
637
|
+
<dd>
|
|
638
|
+
|
|
639
|
+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
|
|
640
|
+
|
|
641
|
+
</dd>
|
|
642
|
+
</dl>
|
|
643
|
+
</dd>
|
|
644
|
+
</dl>
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
</dd>
|
|
648
|
+
</dl>
|
|
649
|
+
</details>
|
|
650
|
+
|
|
651
|
+
### SpeechToText
|
|
652
|
+
<details><summary><code>client.speech_to_text.<a href="src/sarvamai/speech_to_text/client.py">transcribe</a>(...)</code></summary>
|
|
653
|
+
<dl>
|
|
654
|
+
<dd>
|
|
655
|
+
|
|
656
|
+
#### 📝 Description
|
|
657
|
+
|
|
658
|
+
<dl>
|
|
659
|
+
<dd>
|
|
660
|
+
|
|
661
|
+
<dl>
|
|
662
|
+
<dd>
|
|
663
|
+
|
|
664
|
+
### Real-Time Speech to Text API
|
|
665
|
+
|
|
666
|
+
This API transcribes speech to text in multiple Indian languages and English. Supports real-time transcription for interactive applications.
|
|
667
|
+
|
|
668
|
+
#### Available Options:
|
|
669
|
+
- **Real-Time API** (Current Endpoint): For quick responses under 30 seconds with immediate results
|
|
670
|
+
- **Batch API**: For longer audio files, requires following a notebook script - [View Notebook](https://github.com/sarvamai/sarvam-ai-cookbook/tree/main/notebooks/stt/stt-batch-api)
|
|
671
|
+
- Supports diarization (speaker identification)
|
|
672
|
+
|
|
673
|
+
#### Note:
|
|
674
|
+
- Pricing differs for Real-Time and Batch APIs
|
|
675
|
+
- Diarization is only available in Batch API with separate pricing
|
|
676
|
+
- Please refer to [dashboard.sarvam.ai](https://dashboard.sarvam.ai) for detailed pricing information
|
|
677
|
+
</dd>
|
|
678
|
+
</dl>
|
|
679
|
+
</dd>
|
|
680
|
+
</dl>
|
|
681
|
+
|
|
682
|
+
#### 🔌 Usage
|
|
683
|
+
|
|
684
|
+
<dl>
|
|
685
|
+
<dd>
|
|
686
|
+
|
|
687
|
+
<dl>
|
|
688
|
+
<dd>
|
|
689
|
+
|
|
690
|
+
```python
|
|
691
|
+
from sarvamai import SarvamAI
|
|
692
|
+
|
|
693
|
+
client = SarvamAI(
|
|
694
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
695
|
+
)
|
|
696
|
+
client.speech_to_text.transcribe()
|
|
697
|
+
|
|
698
|
+
```
|
|
699
|
+
</dd>
|
|
700
|
+
</dl>
|
|
701
|
+
</dd>
|
|
702
|
+
</dl>
|
|
703
|
+
|
|
704
|
+
#### ⚙️ Parameters
|
|
705
|
+
|
|
706
|
+
<dl>
|
|
707
|
+
<dd>
|
|
708
|
+
|
|
709
|
+
<dl>
|
|
710
|
+
<dd>
|
|
711
|
+
|
|
712
|
+
**file:** `from __future__ import annotations
|
|
713
|
+
|
|
714
|
+
core.File` — See core.File for more documentation
|
|
715
|
+
|
|
716
|
+
</dd>
|
|
717
|
+
</dl>
|
|
718
|
+
|
|
719
|
+
<dl>
|
|
720
|
+
<dd>
|
|
721
|
+
|
|
722
|
+
**model:** `typing.Optional[SpeechToTextModel]`
|
|
723
|
+
|
|
724
|
+
Specifies the model to use for speech-to-text conversion.
|
|
725
|
+
Note:- Default model is `saarika:v2`
|
|
726
|
+
|
|
727
|
+
</dd>
|
|
728
|
+
</dl>
|
|
729
|
+
|
|
730
|
+
<dl>
|
|
731
|
+
<dd>
|
|
732
|
+
|
|
733
|
+
**language_code:** `typing.Optional[SpeechToTextLanguage]`
|
|
734
|
+
|
|
735
|
+
Specifies the language of the input audio. This parameter is required to ensure accurate transcription.
|
|
736
|
+
For the `saarika:v1` model, this parameter is mandatory.
|
|
737
|
+
For the `saarika:v2` model, it is optional.
|
|
738
|
+
`unknown`: Use this when the language is not known; the API will detect it automatically.
|
|
739
|
+
Note:- that the `saarika:v1` model does not support `unknown` language code.
|
|
740
|
+
|
|
741
|
+
</dd>
|
|
742
|
+
</dl>
|
|
743
|
+
|
|
744
|
+
<dl>
|
|
745
|
+
<dd>
|
|
746
|
+
|
|
747
|
+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
|
|
748
|
+
|
|
749
|
+
</dd>
|
|
750
|
+
</dl>
|
|
751
|
+
</dd>
|
|
752
|
+
</dl>
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
</dd>
|
|
756
|
+
</dl>
|
|
757
|
+
</details>
|
|
758
|
+
|
|
759
|
+
<details><summary><code>client.speech_to_text.<a href="src/sarvamai/speech_to_text/client.py">translate</a>(...)</code></summary>
|
|
760
|
+
<dl>
|
|
761
|
+
<dd>
|
|
762
|
+
|
|
763
|
+
#### 📝 Description
|
|
764
|
+
|
|
765
|
+
<dl>
|
|
766
|
+
<dd>
|
|
767
|
+
|
|
768
|
+
<dl>
|
|
769
|
+
<dd>
|
|
770
|
+
|
|
771
|
+
### Real-Time Speech to Text Translation API
|
|
772
|
+
|
|
773
|
+
This API automatically detects the input language, transcribes the speech, and translates the text to English.
|
|
774
|
+
|
|
775
|
+
#### Available Options:
|
|
776
|
+
- **Real-Time API** (Current Endpoint): For quick responses under 30 seconds with immediate results
|
|
777
|
+
- **Batch API**: For longer audio files, requires following a notebook script - [View Notebook](https://github.com/sarvamai/sarvam-ai-cookbook/tree/main/notebooks/stt-translate/stt-translate-batch-api)
|
|
778
|
+
- Supports diarization (speaker identification)
|
|
779
|
+
|
|
780
|
+
#### Note:
|
|
781
|
+
- Pricing differs for Real-Time and Batch APIs
|
|
782
|
+
- Diarization is only available in Batch API with separate pricing
|
|
783
|
+
- Please refer to [dashboard.sarvam.ai](https://dashboard.sarvam.ai) for detailed pricing information
|
|
784
|
+
</dd>
|
|
785
|
+
</dl>
|
|
786
|
+
</dd>
|
|
787
|
+
</dl>
|
|
788
|
+
|
|
789
|
+
#### 🔌 Usage
|
|
790
|
+
|
|
791
|
+
<dl>
|
|
792
|
+
<dd>
|
|
793
|
+
|
|
794
|
+
<dl>
|
|
795
|
+
<dd>
|
|
796
|
+
|
|
797
|
+
```python
|
|
798
|
+
from sarvamai import SarvamAI
|
|
799
|
+
|
|
800
|
+
client = SarvamAI(
|
|
801
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
802
|
+
)
|
|
803
|
+
client.speech_to_text.translate()
|
|
804
|
+
|
|
805
|
+
```
|
|
806
|
+
</dd>
|
|
807
|
+
</dl>
|
|
808
|
+
</dd>
|
|
809
|
+
</dl>
|
|
810
|
+
|
|
811
|
+
#### ⚙️ Parameters
|
|
812
|
+
|
|
813
|
+
<dl>
|
|
814
|
+
<dd>
|
|
815
|
+
|
|
816
|
+
<dl>
|
|
817
|
+
<dd>
|
|
818
|
+
|
|
819
|
+
**file:** `from __future__ import annotations
|
|
820
|
+
|
|
821
|
+
core.File` — See core.File for more documentation
|
|
822
|
+
|
|
823
|
+
</dd>
|
|
824
|
+
</dl>
|
|
825
|
+
|
|
826
|
+
<dl>
|
|
827
|
+
<dd>
|
|
828
|
+
|
|
829
|
+
**prompt:** `typing.Optional[str]` — Conversation context can be passed as a prompt to boost model accuracy. However, the current system is at an experimentation stage and doesn’t match the prompt performance of large language models.
|
|
830
|
+
|
|
831
|
+
</dd>
|
|
832
|
+
</dl>
|
|
833
|
+
|
|
834
|
+
<dl>
|
|
835
|
+
<dd>
|
|
836
|
+
|
|
837
|
+
**model:** `typing.Optional[SpeechToTextTranslateModel]` — Model to be used for converting speech to text in target language
|
|
838
|
+
|
|
839
|
+
</dd>
|
|
840
|
+
</dl>
|
|
841
|
+
|
|
842
|
+
<dl>
|
|
843
|
+
<dd>
|
|
844
|
+
|
|
845
|
+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
|
|
846
|
+
|
|
847
|
+
</dd>
|
|
848
|
+
</dl>
|
|
849
|
+
</dd>
|
|
850
|
+
</dl>
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
</dd>
|
|
854
|
+
</dl>
|
|
855
|
+
</details>
|
|
856
|
+
|
|
857
|
+
### TextToSpeech
|
|
858
|
+
<details><summary><code>client.text_to_speech.<a href="src/sarvamai/text_to_speech/client.py">convert</a>(...)</code></summary>
|
|
859
|
+
<dl>
|
|
860
|
+
<dd>
|
|
861
|
+
|
|
862
|
+
#### 📝 Description
|
|
863
|
+
|
|
864
|
+
<dl>
|
|
865
|
+
<dd>
|
|
866
|
+
|
|
867
|
+
<dl>
|
|
868
|
+
<dd>
|
|
869
|
+
|
|
870
|
+
This is the model to convert text into spoken audio.
|
|
871
|
+
The output is a wave file encoded as a base64 string.
|
|
872
|
+
</dd>
|
|
873
|
+
</dl>
|
|
874
|
+
</dd>
|
|
875
|
+
</dl>
|
|
876
|
+
|
|
877
|
+
#### 🔌 Usage
|
|
878
|
+
|
|
879
|
+
<dl>
|
|
880
|
+
<dd>
|
|
881
|
+
|
|
882
|
+
<dl>
|
|
883
|
+
<dd>
|
|
884
|
+
|
|
885
|
+
```python
|
|
886
|
+
from sarvamai import SarvamAI
|
|
887
|
+
|
|
888
|
+
client = SarvamAI(
|
|
889
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
890
|
+
)
|
|
891
|
+
client.text_to_speech.convert(
|
|
892
|
+
text="text",
|
|
893
|
+
target_language_code="bn-IN",
|
|
894
|
+
)
|
|
895
|
+
|
|
896
|
+
```
|
|
897
|
+
</dd>
|
|
898
|
+
</dl>
|
|
899
|
+
</dd>
|
|
900
|
+
</dl>
|
|
901
|
+
|
|
902
|
+
#### ⚙️ Parameters
|
|
903
|
+
|
|
904
|
+
<dl>
|
|
905
|
+
<dd>
|
|
906
|
+
|
|
907
|
+
<dl>
|
|
908
|
+
<dd>
|
|
909
|
+
|
|
910
|
+
**text:** `str`
|
|
911
|
+
|
|
912
|
+
</dd>
|
|
913
|
+
</dl>
|
|
914
|
+
|
|
915
|
+
<dl>
|
|
916
|
+
<dd>
|
|
917
|
+
|
|
918
|
+
**target_language_code:** `TextToSpeechLanguage` — The language of the text is BCP-47 format
|
|
919
|
+
|
|
920
|
+
</dd>
|
|
921
|
+
</dl>
|
|
922
|
+
|
|
923
|
+
<dl>
|
|
924
|
+
<dd>
|
|
925
|
+
|
|
926
|
+
**speaker:** `typing.Optional[TextToSpeechSpeaker]`
|
|
927
|
+
|
|
928
|
+
The speaker voice to be used for the output audio.
|
|
929
|
+
|
|
930
|
+
**Default:** Meera
|
|
931
|
+
|
|
932
|
+
**Model Compatibility (Speakers compatible with respective models):**
|
|
933
|
+
- **bulbul:v1:**
|
|
934
|
+
- Female: Diya, Maya, Meera, Pavithra, Maitreyi, Misha
|
|
935
|
+
- Male: Amol, Arjun, Amartya, Arvind, Neel, Vian
|
|
936
|
+
|
|
937
|
+
- **bulbul:v2:**
|
|
938
|
+
- Female: Anushka, Manisha, Vidya, Arya
|
|
939
|
+
- Male: Abhilash, Karun, Hitesh
|
|
940
|
+
|
|
941
|
+
**Note:** Speaker selection must match the chosen model version.
|
|
942
|
+
|
|
943
|
+
</dd>
|
|
944
|
+
</dl>
|
|
945
|
+
|
|
946
|
+
<dl>
|
|
947
|
+
<dd>
|
|
948
|
+
|
|
949
|
+
**pitch:** `typing.Optional[float]` — Controls the pitch of the audio. Lower values result in a deeper voice, while higher values make it sharper. The suitable range is between -0.75 and 0.75. Default is 0.0.
|
|
950
|
+
|
|
951
|
+
</dd>
|
|
952
|
+
</dl>
|
|
953
|
+
|
|
954
|
+
<dl>
|
|
955
|
+
<dd>
|
|
956
|
+
|
|
957
|
+
**pace:** `typing.Optional[float]` — Controls the speed of the audio. Lower values result in slower speech, while higher values make it faster. The suitable range is between 0.5 and 2.0. Default is 1.0.
|
|
958
|
+
|
|
959
|
+
</dd>
|
|
960
|
+
</dl>
|
|
961
|
+
|
|
962
|
+
<dl>
|
|
963
|
+
<dd>
|
|
964
|
+
|
|
965
|
+
**loudness:** `typing.Optional[float]` — Controls the loudness of the audio. Lower values result in quieter audio, while higher values make it louder. The suitable range is between 0.3 and 3.0. Default is 1.0.
|
|
966
|
+
|
|
967
|
+
</dd>
|
|
968
|
+
</dl>
|
|
969
|
+
|
|
970
|
+
<dl>
|
|
971
|
+
<dd>
|
|
972
|
+
|
|
973
|
+
**speech_sample_rate:** `typing.Optional[SpeechSampleRate]` — Specifies the sample rate of the output audio. Supported values are 8000, 16000, 22050, 24000 Hz. If not provided, the default is 22050 Hz.
|
|
974
|
+
|
|
975
|
+
</dd>
|
|
976
|
+
</dl>
|
|
977
|
+
|
|
978
|
+
<dl>
|
|
979
|
+
<dd>
|
|
980
|
+
|
|
981
|
+
**enable_preprocessing:** `typing.Optional[bool]` — Controls whether normalization of English words and numeric entities (e.g., numbers, dates) is performed. Set to true for better handling of mixed-language text. Default is false.
|
|
982
|
+
|
|
983
|
+
</dd>
|
|
984
|
+
</dl>
|
|
985
|
+
|
|
986
|
+
<dl>
|
|
987
|
+
<dd>
|
|
988
|
+
|
|
989
|
+
**model:** `typing.Optional[TextToSpeechModel]` — Specifies the model to use for text-to-speech conversion. Default is bulbul:v1.
|
|
990
|
+
|
|
991
|
+
</dd>
|
|
992
|
+
</dl>
|
|
993
|
+
|
|
994
|
+
<dl>
|
|
995
|
+
<dd>
|
|
996
|
+
|
|
997
|
+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
|
|
998
|
+
|
|
999
|
+
</dd>
|
|
1000
|
+
</dl>
|
|
1001
|
+
</dd>
|
|
1002
|
+
</dl>
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
</dd>
|
|
1006
|
+
</dl>
|
|
1007
|
+
</details>
|
|
1008
|
+
|
|
1009
|
+
### Chat
|
|
1010
|
+
<details><summary><code>client.chat.<a href="src/sarvamai/chat/client.py">completions</a>(...)</code></summary>
|
|
1011
|
+
<dl>
|
|
1012
|
+
<dd>
|
|
1013
|
+
|
|
1014
|
+
#### 📝 Description
|
|
1015
|
+
|
|
1016
|
+
<dl>
|
|
1017
|
+
<dd>
|
|
1018
|
+
|
|
1019
|
+
<dl>
|
|
1020
|
+
<dd>
|
|
1021
|
+
|
|
1022
|
+
Calls Sarvam LLM API to get the chat completion. Supported model(s): `sarvam-m`.
|
|
1023
|
+
</dd>
|
|
1024
|
+
</dl>
|
|
1025
|
+
</dd>
|
|
1026
|
+
</dl>
|
|
1027
|
+
|
|
1028
|
+
#### 🔌 Usage
|
|
1029
|
+
|
|
1030
|
+
<dl>
|
|
1031
|
+
<dd>
|
|
1032
|
+
|
|
1033
|
+
<dl>
|
|
1034
|
+
<dd>
|
|
1035
|
+
|
|
1036
|
+
```python
|
|
1037
|
+
from sarvamai import SarvamAI
|
|
1038
|
+
|
|
1039
|
+
client = SarvamAI(
|
|
1040
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
1041
|
+
)
|
|
1042
|
+
client.chat.completions(
|
|
1043
|
+
messages=[{"content": "content", "role": "assistant"}],
|
|
1044
|
+
)
|
|
1045
|
+
|
|
1046
|
+
```
|
|
1047
|
+
</dd>
|
|
1048
|
+
</dl>
|
|
1049
|
+
</dd>
|
|
1050
|
+
</dl>
|
|
1051
|
+
|
|
1052
|
+
#### ⚙️ Parameters
|
|
1053
|
+
|
|
1054
|
+
<dl>
|
|
1055
|
+
<dd>
|
|
1056
|
+
|
|
1057
|
+
<dl>
|
|
1058
|
+
<dd>
|
|
1059
|
+
|
|
1060
|
+
**messages:** `typing.Sequence[ChatCompletionRequestMessageParams]` — A list of messages comprising the conversation so far.
|
|
1061
|
+
|
|
1062
|
+
</dd>
|
|
1063
|
+
</dl>
|
|
1064
|
+
|
|
1065
|
+
<dl>
|
|
1066
|
+
<dd>
|
|
1067
|
+
|
|
1068
|
+
**temperature:** `typing.Optional[float]`
|
|
1069
|
+
|
|
1070
|
+
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
|
|
1071
|
+
We generally recommend altering this or `top_p` but not both.
|
|
1072
|
+
|
|
1073
|
+
</dd>
|
|
1074
|
+
</dl>
|
|
1075
|
+
|
|
1076
|
+
<dl>
|
|
1077
|
+
<dd>
|
|
1078
|
+
|
|
1079
|
+
**top_p:** `typing.Optional[float]`
|
|
1080
|
+
|
|
1081
|
+
An alternative to sampling with temperature, called nucleus sampling,
|
|
1082
|
+
where the model considers the results of the tokens with top_p probability
|
|
1083
|
+
mass. So 0.1 means only the tokens comprising the top 10% probability mass
|
|
1084
|
+
are considered.
|
|
1085
|
+
|
|
1086
|
+
We generally recommend altering this or `temperature` but not both.
|
|
1087
|
+
|
|
1088
|
+
</dd>
|
|
1089
|
+
</dl>
|
|
1090
|
+
|
|
1091
|
+
<dl>
|
|
1092
|
+
<dd>
|
|
1093
|
+
|
|
1094
|
+
**reasoning_effort:** `typing.Optional[ReasoningEffort]`
|
|
1095
|
+
|
|
1096
|
+
</dd>
|
|
1097
|
+
</dl>
|
|
1098
|
+
|
|
1099
|
+
<dl>
|
|
1100
|
+
<dd>
|
|
1101
|
+
|
|
1102
|
+
**max_tokens:** `typing.Optional[int]` — The maximum number of tokens that can be generated in the chat completion.
|
|
1103
|
+
|
|
1104
|
+
</dd>
|
|
1105
|
+
</dl>
|
|
1106
|
+
|
|
1107
|
+
<dl>
|
|
1108
|
+
<dd>
|
|
1109
|
+
|
|
1110
|
+
**stream:** `typing.Optional[bool]`
|
|
1111
|
+
|
|
1112
|
+
If set to true, the model response data will be streamed to the client
|
|
1113
|
+
as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
|
|
1114
|
+
|
|
1115
|
+
</dd>
|
|
1116
|
+
</dl>
|
|
1117
|
+
|
|
1118
|
+
<dl>
|
|
1119
|
+
<dd>
|
|
1120
|
+
|
|
1121
|
+
**stop:** `typing.Optional[StopConfigurationParams]`
|
|
1122
|
+
|
|
1123
|
+
</dd>
|
|
1124
|
+
</dl>
|
|
1125
|
+
|
|
1126
|
+
<dl>
|
|
1127
|
+
<dd>
|
|
1128
|
+
|
|
1129
|
+
**n:** `typing.Optional[int]` — How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs.
|
|
1130
|
+
|
|
1131
|
+
</dd>
|
|
1132
|
+
</dl>
|
|
1133
|
+
|
|
1134
|
+
<dl>
|
|
1135
|
+
<dd>
|
|
1136
|
+
|
|
1137
|
+
**seed:** `typing.Optional[int]`
|
|
1138
|
+
|
|
1139
|
+
This feature is in Beta.
|
|
1140
|
+
If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result.
|
|
1141
|
+
Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.
|
|
1142
|
+
|
|
1143
|
+
</dd>
|
|
1144
|
+
</dl>
|
|
1145
|
+
|
|
1146
|
+
<dl>
|
|
1147
|
+
<dd>
|
|
1148
|
+
|
|
1149
|
+
**frequency_penalty:** `typing.Optional[float]`
|
|
1150
|
+
|
|
1151
|
+
Number between -2.0 and 2.0. Positive values penalize new tokens based on
|
|
1152
|
+
their existing frequency in the text so far, decreasing the model's
|
|
1153
|
+
likelihood to repeat the same line verbatim.
|
|
1154
|
+
|
|
1155
|
+
</dd>
|
|
1156
|
+
</dl>
|
|
1157
|
+
|
|
1158
|
+
<dl>
|
|
1159
|
+
<dd>
|
|
1160
|
+
|
|
1161
|
+
**presence_penalty:** `typing.Optional[float]`
|
|
1162
|
+
|
|
1163
|
+
Number between -2.0 and 2.0. Positive values penalize new tokens based on
|
|
1164
|
+
whether they appear in the text so far, increasing the model's likelihood
|
|
1165
|
+
to talk about new topics.
|
|
1166
|
+
|
|
1167
|
+
</dd>
|
|
1168
|
+
</dl>
|
|
1169
|
+
|
|
1170
|
+
<dl>
|
|
1171
|
+
<dd>
|
|
1172
|
+
|
|
1173
|
+
**wiki_grounding:** `typing.Optional[bool]` — If this parameter is enabled, then the model uses a RAG based approach to retrieve relevant chunks from Wikipedia and uses them to answer the question. This is particularly useful for queries seeking factual information.
|
|
1174
|
+
|
|
1175
|
+
</dd>
|
|
1176
|
+
</dl>
|
|
1177
|
+
|
|
1178
|
+
<dl>
|
|
1179
|
+
<dd>
|
|
1180
|
+
|
|
1181
|
+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
|
|
1182
|
+
|
|
1183
|
+
</dd>
|
|
1184
|
+
</dl>
|
|
1185
|
+
</dd>
|
|
1186
|
+
</dl>
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
</dd>
|
|
1190
|
+
</dl>
|
|
1191
|
+
</details>
|
|
1192
|
+
|