Breaking Changes
- Renamed
begin_analyze_batch_actionstobegin_analyze_actions. - Renamed
AnalyzeBatchActionsTypetoAnalyzeActionsType. - Renamed
AnalyzeBatchActionsResulttoAnalyzeActionsResult. - Renamed
AnalyzeBatchActionsErrortoAnalyzeActionsError.
New Features
- Added enums
EntityConditionality,EntityCertainty, andEntityAssociation. - Added
AnalyzeSentimentActionas a supported action type forbegin_analyze_batch_actions. - Added kwarg
disable_service_logs. If set to true, you opt-out of having your text input logged on the service side for troubleshooting.
Breaking Changes
- By default, we now target the service's
v3.1-preview.4endpoint through enum valueTextAnalyticsApiVersion.V3_1_PREVIEW - Removed property
related_entitiesonHealthcareEntityand addedentity_relationsonto the document response level for healthcare - Renamed properties
aspectandopinionstotargetandassessmentsrespectively in classMinedOpinion. - Renamed classes
AspectSentimentandOpinionSentimenttoTargetSentimentandAssessmentSentimentrespectively.
New Features
- Added
RecognizeLinkedEntitiesActionas a supported action type forbegin_analyze_batch_actions. - Added parameter
categories_filterto therecognize_pii_entitiesclient method. - Added enum
PiiEntityCategoryType. - Add property
normalized_texttoHealthcareEntity. This property is a normalized version of thetextproperty that already exists on theHealthcareEntity - Add property
assertionontoHealthcareEntity. This contains assertions about the entity itself, i.e. if the entity represents a diagnosis, is this diagnosis conditional on a symptom?
Known Issues
begin_analyze_healthcare_entitiesis currently in gated preview and can not be used with AAD credentials. For more information, see the Text Analytics for Health documentation.- At time of this SDK release, the service is not respecting the value passed through
model_versiontobegin_analyze_healthcare_entities, it only uses the latest model.
Breaking Changes
- Rename
begin_analyzetobegin_analyze_batch_actions. - Now instead of separate parameters for all of the different types of actions you can pass to
begin_analyze_batch_actions, we accept one parameteractions, which is a list of actions you would like performed. The results of the actions are returned in the same order as when inputted. - The response object from
begin_analyze_batch_actionshas also changed. Now, after the completion of your long running operation, we return a paged iterable of action results, in the same order they've been inputted. The actual document results for each action are included under propertydocument_resultsof each action result.
New Features
- Renamed
begin_analyze_healthcaretobegin_analyze_healthcare_entities. - Renamed
AnalyzeHealthcareResulttoAnalyzeHealthcareEntitiesResultandAnalyzeHealthcareResultItemtoAnalyzeHealthcareEntitiesResultItem. - Renamed
HealthcareEntityLinktoHealthcareEntityDataSourceand renamed its propertiesidtoentity_idanddata_sourcetoname. - Removed
relationsfromAnalyzeHealthcareEntitiesResultItemand addedrelated_entitiestoHealthcareEntity. - Moved the cancellation logic for the Analyze Healthcare Entities service from
the service client to the poller object returned from
begin_analyze_healthcare_entities. - Exposed Analyze Healthcare Entities operation metadata on the poller object returned from
begin_analyze_healthcare_entities. - No longer need to specify
api_version=TextAnalyticsApiVersion.V3_1_PREVIEW_3when callingbegin_analyzeandbegin_analyze_healthcare_entities.begin_analyze_healthcare_entitiesis still in gated preview though. - Added a new parameter
string_index_typeto the service client methodsbegin_analyze_healthcare_entities,analyze_sentiment,recognize_entities,recognize_pii_entities, andrecognize_linked_entitieswhich tells the service how to interpret string offsets. - Added property
lengthtoCategorizedEntity,SentenceSentiment,LinkedEntityMatch,AspectSentiment,OpinionSentiment,PiiEntityandHealthcareEntity.
Bug Fixes
- Package requires azure-core version 1.8.2 or greater
New Features
- We have added method
begin_analyze, which supports long-running batch process of Named Entity Recognition, Personally identifiable Information, and Key Phrase Extraction. To use, you must specifyapi_version=TextAnalyticsApiVersion.V3_1_PREVIEW_3when creating your client. - We have added method
begin_analyze_healthcare, which supports the service's Health API. Since the Health API is currently only available in a gated preview, you need to have your subscription on the service's allow list, and you must specifyapi_version=TextAnalyticsApiVersion.V3_1_PREVIEW_3when creating your client. Note that since this is a gated preview, AAD is not supported. More information here.
Breaking changes
- Removed property
lengthfromCategorizedEntity,SentenceSentiment,LinkedEntityMatch,AspectSentiment,OpinionSentiment, andPiiEntity. To get the length of the text in these models, just calllen()on thetextproperty. - When a parameter or endpoint is not compatible with the API version you specify, we will now return a
ValueErrorinstead of aNotImplementedError. - Client side validation of input is now disabled by default. This means there will be no
ValidationErrors thrown by the client SDK in the case of malformed input. The error will now be thrown by the service through anHttpResponseError.
New features
- We are now targeting the service's v3.1-preview API as the default. If you would like to still use version v3.0 of the service,
pass in
v3.0to the kwargapi_versionwhen creating your TextAnalyticsClient - We have added an API
recognize_pii_entitieswhich returns entities containing personally identifiable information for a batch of documents. Only available for API version v3.1-preview and up. - Added
offsetandlengthproperties forCategorizedEntity,SentenceSentiment, andLinkedEntityMatch. These properties are only available for API versions v3.1-preview and up.lengthis the number of characters in the text of these modelsoffsetis the offset of the text from the start of the document
- We now have added support for opinion mining. To use this feature, you need to make sure you are using the service's
v3.1-preview API. To get this support pass
show_opinion_miningas True when calling theanalyze_sentimentendpoint - Add property
bing_entity_search_api_idto theLinkedEntityclass. This property is only available for v3.1-preview and up, and it is to be used in conjunction with the Bing Entity Search API to fetch additional relevant information about the returned entity.
- Re-release of GA version 1.0.0 with an updated version
- First stable release of the azure-ai-textanalytics package. Targets the service's v3.0 API.
New features
- We now have a
warningsproperty on each document-level response object returned from the endpoints. It is a list ofTextAnalyticsWarnings. - Added
textproperty toSentenceSentiment
Breaking changes
- Now targets only the service's v3.0 API, instead of the v3.0-preview.1 API
scoreattribute ofDetectedLanguagehas been renamed toconfidence_score- Removed
grapheme_offsetandgrapheme_lengthfromCategorizedEntity,SentenceSentiment, andLinkedEntityMatch TextDocumentStatisticsattributegrapheme_counthas been renamed tocharacter_count
- This was a broken release
Breaking changes
- Removed the
recognize_pii_entitiesendpoint and all related models (RecognizePiiEntitiesResultandPiiEntity) from this library. - Removed
TextAnalyticsApiKeyCredentialand now usingAzureKeyCredentialfrom azure.core.credentials as key credential scoreattribute has been renamed toconfidence_scorefor theCategorizedEntity,LinkedEntityMatch, andPiiEntitymodels- All input parameters
inputshave been renamed todocuments
Breaking changes
SentimentScorePerLabelhas been renamed toSentimentConfidenceScoresAnalyzeSentimentResultandSentenceSentimentattributesentiment_scoreshas been renamed toconfidence_scoresTextDocumentStatisticsattributecharacter_counthas been renamed tographeme_countLinkedEntityattributeidhas been renamed todata_source_entity_id- Parameters
country_hintandlanguageare now passed as keyword arguments - The keyword argument
response_hookhas been renamed toraw_response_hook lengthandoffsetattributes have been renamed tographeme_lengthandgrapheme_offsetfor theSentenceSentiment,CategorizedEntity,PiiEntity, andLinkedEntityMatchmodels
New features
- Pass
country_hint="none"to not use the default country hint of"US".
Dependency updates
- Adopted azure-core version 1.3.0 or greater
Breaking changes
- The single text, module-level operations
single_detect_language(),single_recognize_entities(),single_extract_key_phrases(),single_analyze_sentiment(),single_recognize_pii_entities(), andsingle_recognize_linked_entities()have been removed from the client library. Use the batching methods for optimal performance in production environments. - To use an API key as the credential for authenticating the client, a new credential class
TextAnalyticsApiKeyCredential("<api_key>")must be passed in for thecredentialparameter. Passing the API key as a string is no longer supported. detect_languages()is renamed todetect_language().- The
TextAnalyticsErrormodel has been simplified to an object with only attributescode,message, andtarget. NamedEntityhas been renamed toCategorizedEntityand its attributestypetocategoryandsubtypetosubcategory.RecognizePiiEntitiesResultnow contains on the object a list ofPiiEntityinstead ofNamedEntity.AnalyzeSentimentResultattributedocument_scoreshas been renamed tosentiment_scores.SentenceSentimentattributesentence_scoreshas been renamed tosentiment_scores.SentimentConfidenceScorePerLabelhas been renamed toSentimentScorePerLabel.DetectLanguageResultno longer has attributedetected_languages. Useprimary_languageto access the detected language in text.
New features
- Credential class
TextAnalyticsApiKeyCredentialprovides anupdate_key()method which allows you to update the API key for long-lived clients.
Fixes and improvements
__repr__has been added to all of the response objects.- If you try to access a result attribute on a
DocumentErrorobject, anAttributeErroris raised with a custom error message that provides the document ID and error of the invalid document.
Version (1.0.0b1) is the first preview of our efforts to create a user-friendly and Pythonic client library for Azure Text Analytics. For more information about this, and preview releases of other Azure SDK libraries, please visit https://azure.github.io/azure-sdk/releases/latest/python.html.
Breaking changes: New API design
-
New namespace/package name:
- The namespace/package name for Azure Text Analytics client library has changed from
azure.cognitiveservices.language.textanalyticstoazure.ai.textanalytics
- The namespace/package name for Azure Text Analytics client library has changed from
-
New operations and naming:
detect_languageis renamed todetect_languagesentitiesis renamed torecognize_entitieskey_phrasesis renamed toextract_key_phrasessentimentis renamed toanalyze_sentiment- New operation
recognize_pii_entitiesfinds personally identifiable information entities in text - New operation
recognize_linked_entitiesprovides links from a well-known knowledge base for each recognized entity - New module-level operations
single_detect_language,single_recognize_entities,single_extract_key_phrases,single_analyze_sentiment,single_recognize_pii_entities, andsingle_recognize_linked_entitiesperform function on a single string instead of a batch of text documents and can be imported from theazure.ai.textanalyticsnamespace. - New client and module-level async APIs added to subnamespace
azure.ai.textanalytics.aio. MultiLanguageInputhas been renamed toTextDocumentInputLanguageInputhas been renamed toDetectLanguageInputDocumentLanguagehas been renamed toDetectLanguageResultDocumentEntitieshas been renamed toRecognizeEntitiesResultDocumentLinkedEntitieshas been renamed toRecognizeLinkedEntitiesResultDocumentKeyPhraseshas been renamed toExtractKeyPhrasesResultDocumentSentimenthas been renamed toAnalyzeSentimentResultDocumentStatisticshas been renamed toTextDocumentStatisticsRequestStatisticshas been renamed toTextDocumentBatchStatisticsEntityhas been renamed toNamedEntityMatchhas been renamed toLinkedEntityMatch- The batching methods'
documentsparameter has been renamedinputs
-
New input types:
detect_languagescan take as input alist[DetectLanguageInput]or alist[str]. A list of dict-like objects in the same shape asDetectLanguageInputis still accepted as input.recognize_entities,recognize_pii_entities,recognize_linked_entities,extract_key_phrases,analyze_sentimentcan take as input alist[TextDocumentInput]orlist[str]. A list of dict-like objects in the same shape asTextDocumentInputis still accepted as input.
-
New parameters/keyword arguments:
- All operations now take a keyword argument
model_versionwhich allows the user to specify a string referencing the desired model version to be used for analysis. If no string specified, it will default to the latest, non-preview version. detect_languagesnow takes a parametercountry_hintwhich allows you to specify the country hint for the entire batch. Any per-item country hints will take precedence over a whole batch hint.recognize_entities,recognize_pii_entities,recognize_linked_entities,extract_key_phrases,analyze_sentimentnow take a parameterlanguagewhich allows you to specify the language for the entire batch. Any per-item specified language will take precedence over a whole batch hint.- A
default_country_hintordefault_languagekeyword argument can be passed at client instantiation to set the default values for all operations. - A
response_hookkeyword argument can be passed with a callback to use the raw response from the service. Additionally, values returned forTextDocumentBatchStatisticsandmodel_versionused must be retrieved using a response hook. show_statsandmodel_versionparameters move to keyword only arguments.
- All operations now take a keyword argument
-
New return types
- The return types for the batching methods (
detect_languages,recognize_entities,recognize_pii_entities,recognize_linked_entities,extract_key_phrases,analyze_sentiment) now return a heterogeneous list of result objects and document errors in the order passed in with the request. To iterate over the list and filter for result or error, a boolean property on each object calledis_errorcan be used to determine whether the returned response object at that index is a result or an error: detect_languagesnow returns a List[Union[DetectLanguageResult,DocumentError]]recognize_entitiesnow returns a List[Union[RecognizeEntitiesResult,DocumentError]]recognize_pii_entitiesnow returns a List[Union[RecognizePiiEntitiesResult,DocumentError]]recognize_linked_entitiesnow returns a List[Union[RecognizeLinkedEntitiesResult,DocumentError]]extract_key_phrasesnow returns a List[Union[ExtractKeyPhrasesResult,DocumentError]]analyze_sentimentnow returns a List[Union[AnalyzeSentimentResult,DocumentError]]- The module-level, single text operations will return a single result object or raise the error found on the document:
single_detect_languagesreturns aDetectLanguageResultsingle_recognize_entitiesreturns aRecognizeEntitiesResultsingle_recognize_pii_entitiesreturns aRecognizePiiEntitiesResultsingle_recognize_linked_entitiesreturns aRecognizeLinkedEntitiesResultsingle_extract_key_phrasesreturns aExtractKeyPhrasesResultsingle_analyze_sentimentreturns aAnalyzeSentimentResult
- The return types for the batching methods (
-
New underlying REST pipeline implementation, based on the new
azure-corelibrary. -
Client and pipeline configuration is now available via keyword arguments at both the client level, and per-operation. See README for a full list of optional configuration arguments.
-
Authentication using
azure-identitycredentials- see the Azure Identity documentation for more information
-
New error hierarchy:
- All service errors will now use the base type:
azure.core.exceptions.HttpResponseError - There is one exception type derived from this base type for authentication errors:
ClientAuthenticationError: Authentication failed.
- All service errors will now use the base type:
Features
- Client class can be used as a context manager to keep the underlying HTTP session open for performance
- New method "entities"
- Model KeyPhraseBatchResultItem has a new parameter statistics
- Model KeyPhraseBatchResult has a new parameter statistics
- Model LanguageBatchResult has a new parameter statistics
- Model LanguageBatchResultItem has a new parameter statistics
- Model SentimentBatchResult has a new parameter statistics
Breaking changes
- TextAnalyticsAPI main client has been renamed TextAnalyticsClient
- TextAnalyticsClient parameter is no longer a region but a complete endpoint
General Breaking changes
This version uses a next-generation code generator that might introduce breaking changes.
-
Model signatures now use only keyword-argument syntax. All positional arguments must be re-written as keyword-arguments. To keep auto-completion in most cases, models are now generated for Python 2 and Python 3. Python 3 uses the "*" syntax for keyword-only arguments.
-
Enum types now use the "str" mixin (class AzureEnum(str, Enum)) to improve the behavior when unrecognized enum values are encountered. While this is not a breaking change, the distinctions are important, and are documented here: https://docs.python.org/3/library/enum.html#others At a glance:
- "is" should not be used at all.
- "format" will return the string value, where "%s" string formatting will return
NameOfEnum.stringvalue. Format syntax should be prefered.
Bugfixes
- Compatibility of the sdist with wheel 0.31.0
- Initial Release