-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[translation] simplify input to translation #19060
Conversation
) | ||
] | ||
except (AttributeError, TypeError, IndexError): | ||
raise ValueError("Pass either 'inputs' or 'source_url', 'target_url', and 'target_language_code'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nit: in the response you can say pass "inputs" for multiple inputs, or these for single
@@ -118,8 +146,41 @@ async def begin_translation( | |||
:caption: Translate the documents in your storage container. | |||
""" | |||
|
|||
continuation_token = kwargs.pop("continuation_token", None) | |||
|
|||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: since this code is the same, can you decompose into a helper?
) | ||
] | ||
document_translation_client = DocumentTranslationClient("<endpoint>", AzureKeyCredential("<api_key>")) | ||
poller = document_translation_client.begin_translation("<sas_url_to_source>", "<sas_url_to_target", "fr") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: do you think it is worth creating a variable language_code="fr"
and then use that variable so the user understands what fr
is? or maybe just follow the same pattern you have and do <language_code>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw we do this in .NET too. If you agree I can create an issue for .NET. If you think it is not important will leave as is :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to demonstrate that these can be passed positionally. I think I'll update to "<target_language_code>" here to be consistent. Thanks for pointing that out!
source_container_sas_url_en = "<sas-url-en>" | ||
target_container_sas_url_es = "<sas-url-es>" | ||
target_container_sas_url_fr = "<sas-url-fr>" | ||
target_container_sas_url_ar = "<sas-url-fr>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
target_container_sas_url_ar = "<sas-url-fr>" | |
target_container_sas_url_ar = "<sas-url-ar>" |
Resolves #17916
Waiting on #19041 to merge firstyay
Live tests pass: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=925612&view=results