Skip to content

Commit 4b79413

Browse files
authored
re-gen clu LLC client (#21417)
* regenrate client * update model names * tmp commit * update model names * fixing tests * fix samples * update readme * fix remaining samples * fix env key error * add recorded tests * update samples * add additional samples * async samples * disable some samples * update samples readme * revert setup.py * fix broken link
1 parent 91f6d74 commit 4b79413

File tree

49 files changed

+2361
-1918
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2361
-1918
lines changed

sdk/cognitivelanguage/azure-ai-language-conversations/README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
# Azure Conversational Language Understanding client library for Python
44
Conversational Language Understanding, aka **CLU** for short, is a cloud-based conversational AI service which is mainly used in bots to extract useful information from user utterance (natural language processing).
5-
The CLU **analyze api** encompasses two projects; deepstack, and workflow projects.
6-
You can use the "deepstack" project if you want to extract intents (intention behind a user utterance] and custom entities.
7-
You can also use the "workflow" project which orchestrates multiple language apps to get the best response (language apps like Question Answering, Luis, and Deepstack).
5+
The CLU **analyze api** encompasses two projects; conversation, and orchestration projects.
6+
You can use the "conversation" project if you want to extract intents (intention behind a user utterance) and custom entities.
7+
You can also use the "orchestration" project which orchestrates multiple language apps to get the best response (language apps like Question Answering, Luis, and Conversation).
88

99
[Source code][conversationallanguage_client_src] | [Package (PyPI)][conversationallanguage_pypi_package] | [API reference documentation][conversationallanguage_refdocs] | [Product documentation][conversationallanguage_docs] | [Samples][conversationallanguage_samples]
1010

@@ -67,16 +67,16 @@ The `azure-ai-language-conversation` client library provides both synchronous an
6767

6868
The following examples show common scenarios using the `client` [created above](#create-conversationanalysisclient).
6969

70-
### Analyze a conversation with a Deepstack App
71-
If you would like to extract custom intents and entities from a user utterance, you can call the `client.analyze_conversations()` method with your deepstack's project name as follows:
70+
### Analyze a conversation with a Conversation App
71+
If you would like to extract custom intents and entities from a user utterance, you can call the `client.analyze_conversations()` method with your conversation's project name as follows:
7272

7373
```python
7474
# import libraries
7575
import os
7676
from azure.core.credentials import AzureKeyCredential
7777

7878
from azure.ai.language.conversations import ConversationAnalysisClient
79-
from azure.ai.language.conversations.models import AnalyzeConversationOptions
79+
from azure.ai.language.conversations.models import ConversationAnalysisOptions
8080

8181
# get secrets
8282
conv_endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"]
@@ -85,7 +85,7 @@ conv_project = os.environ["AZURE_CONVERSATIONS_PROJECT"]
8585

8686
# prepare data
8787
query = "One california maki please."
88-
input = AnalyzeConversationOptions(
88+
input = ConversationAnalysisOptions(
8989
query=query
9090
)
9191

@@ -103,7 +103,7 @@ print("query: {}".format(result.query))
103103
print("project kind: {}\n".format(result.prediction.project_kind))
104104

105105
print("view top intent:")
106-
print("top intent: {}".format(result.prediction.top_intent))
106+
print("\ttop intent: {}".format(result.prediction.top_intent))
107107
print("\tcategory: {}".format(result.prediction.intents[0].category))
108108
print("\tconfidence score: {}\n".format(result.prediction.intents[0].confidence_score))
109109

@@ -114,26 +114,26 @@ for entity in result.prediction.entities:
114114
print("\tconfidence score: {}".format(entity.confidence_score))
115115
```
116116

117-
### Analyze conversation with a Workflow App
117+
### Analyze conversation with a Orchestration App
118118

119-
If you would like to pass the user utterance to your orchestrator (worflow) app, you can call the `client.analyze_conversations()` method with your workflow's project name. The orchestrator project simply orchestrates the submitted user utterance between your language apps (Luis, Deepstack, and Question Answering) to get the best response according to the user intent. See the next example:
119+
If you would like to pass the user utterance to your orchestrator (worflow) app, you can call the `client.analyze_conversations()` method with your orchestration's project name. The orchestrator project simply orchestrates the submitted user utterance between your language apps (Luis, Conversation, and Question Answering) to get the best response according to the user intent. See the next example:
120120

121121
```python
122122
# import libraries
123123
import os
124124
from azure.core.credentials import AzureKeyCredential
125125

126126
from azure.ai.language.conversations import ConversationAnalysisClient
127-
from azure.ai.language.conversations.models import AnalyzeConversationOptions
127+
from azure.ai.language.conversations.models import ConversationAnalysisOptions
128128

129129
# get secrets
130130
conv_endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"]
131131
conv_key = os.environ["AZURE_CONVERSATIONS_KEY"]
132-
workflow_project = os.environ["AZURE_CONVERSATIONS_WORKFLOW_PROJECT")
132+
orchestration_project = os.environ["AZURE_CONVERSATIONS_WORKFLOW_PROJECT")
133133

134134
# prepare data
135135
query = "How do you make sushi rice?",
136-
input = AnalyzeConversationOptions(
136+
input = ConversationAnalysisOptions(
137137
query=query
138138
)
139139

@@ -142,7 +142,7 @@ client = ConversationAnalysisClient(conv_endpoint, AzureKeyCredential(conv_key))
142142
with client:
143143
result = client.analyze_conversations(
144144
input,
145-
project_name=workflow_project,
145+
project_name=orchestration_project,
146146
deployment_name='production',
147147
)
148148

@@ -151,35 +151,35 @@ print("query: {}".format(result.query))
151151
print("project kind: {}\n".format(result.prediction.project_kind))
152152

153153
print("view top intent:")
154-
print("top intent: {}".format(result.prediction.top_intent))
154+
print("\ttop intent: {}".format(result.prediction.top_intent))
155155
print("\tcategory: {}".format(result.prediction.intents[0].category))
156156
print("\tconfidence score: {}\n".format(result.prediction.intents[0].confidence_score))
157157

158158
print("view Question Answering result:")
159159
print("\tresult: {}\n".format(result.prediction.intents[0].result))
160160
```
161161

162-
### Analyze conversation with a Workflow (Direct) App
162+
### Analyze conversation with a Orchestration (Direct) App
163163

164-
If you would like to use an orchestrator (workflow) app, and you want to call a specific one of your language apps directly, you can call the `client.analyze_conversations()` method with your workflow's project name and the diirect target name which corresponds to your one of you language apps as follows:
164+
If you would like to use an orchestrator (orchestration) app, and you want to call a specific one of your language apps directly, you can call the `client.analyze_conversations()` method with your orchestration's project name and the diirect target name which corresponds to your one of you language apps as follows:
165165

166166
```python
167167
# import libraries
168168
import os
169169
from azure.core.credentials import AzureKeyCredential
170170

171171
from azure.ai.language.conversations import ConversationAnalysisClient
172-
from azure.ai.language.conversations.models import AnalyzeConversationOptions
172+
from azure.ai.language.conversations.models import ConversationAnalysisOptions
173173

174174
# get secrets
175175
conv_endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"]
176176
conv_key = os.environ["AZURE_CONVERSATIONS_KEY"]
177-
workflow_project = os.environ["AZURE_CONVERSATIONS_WORKFLOW_PROJECT")
177+
orchestration_project = os.environ["AZURE_CONVERSATIONS_WORKFLOW_PROJECT")
178178

179179
# prepare data
180180
query = "How do you make sushi rice?",
181181
target_intent = "SushiMaking"
182-
input = AnalyzeConversationOptions(
182+
input = ConversationAnalysisOptions(
183183
query=query,
184184
direct_target=target_intent,
185185
parameters={
@@ -198,7 +198,7 @@ client = ConversationAnalysisClient(conv_endpoint, AzureKeyCredential(conv_key))
198198
with client:
199199
result = client.analyze_conversations(
200200
input,
201-
project_name=workflow_project,
201+
project_name=orchestration_project,
202202
deployment_name='production',
203203
)
204204

@@ -207,7 +207,7 @@ print("query: {}".format(result.query))
207207
print("project kind: {}\n".format(result.prediction.project_kind))
208208

209209
print("view top intent:")
210-
print("top intent: {}".format(result.prediction.top_intent))
210+
print("\ttop intent: {}".format(result.prediction.top_intent))
211211
print("\tcategory: {}".format(result.prediction.intents[0].category))
212212
print("\tconfidence score: {}\n".format(result.prediction.intents[0].confidence_score))
213213

sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __init__(
4747

4848
self.endpoint = endpoint
4949
self.credential = credential
50-
self.api_version = "2021-07-15-preview"
50+
self.api_version = "2021-11-01-preview"
5151
kwargs.setdefault('sdk_moniker', 'ai-language-conversations/{}'.format(VERSION))
5252
self._configure(**kwargs)
5353

sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_conversation_analysis_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from azure.core.rest import HttpRequest, HttpResponse
2525

2626
class ConversationAnalysisClient(ConversationAnalysisClientOperationsMixin):
27-
"""This API accepts a request and mediates among multiple language projects, such as LUIS Generally Available, Question Answering, LUIS Deepstack, and then calls the best candidate service to handle the request. At last, it returns a response with the candidate service's response as a payload.
27+
"""This API accepts a request and mediates among multiple language projects, such as LUIS Generally Available, Question Answering, Conversation, and then calls the best candidate service to handle the request. At last, it returns a response with the candidate service's response as a payload.
2828
2929
In some cases, this API needs to forward requests and responses between the caller and an upstream service.
3030

sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(
4141

4242
self.endpoint = endpoint
4343
self.credential = credential
44-
self.api_version = "2021-07-15-preview"
44+
self.api_version = "2021-11-01-preview"
4545
kwargs.setdefault('sdk_moniker', 'ai-language-conversations/{}'.format(VERSION))
4646
self._configure(**kwargs)
4747

sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_conversation_analysis_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from .operations import ConversationAnalysisClientOperationsMixin
2020

2121
class ConversationAnalysisClient(ConversationAnalysisClientOperationsMixin):
22-
"""This API accepts a request and mediates among multiple language projects, such as LUIS Generally Available, Question Answering, LUIS Deepstack, and then calls the best candidate service to handle the request. At last, it returns a response with the candidate service's response as a payload.
22+
"""This API accepts a request and mediates among multiple language projects, such as LUIS Generally Available, Question Answering, Conversation, and then calls the best candidate service to handle the request. At last, it returns a response with the candidate service's response as a payload.
2323
2424
In some cases, this API needs to forward requests and responses between the caller and an upstream service.
2525

sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/operations/_operations.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ class ConversationAnalysisClientOperationsMixin:
2626
@distributed_trace_async
2727
async def analyze_conversations(
2828
self,
29-
analyze_conversation_options: "_models.AnalyzeConversationOptions",
29+
conversation_analysis_options: "_models.ConversationAnalysisOptions",
3030
*,
3131
project_name: str,
3232
deployment_name: str,
3333
**kwargs: Any
3434
) -> "_models.AnalyzeConversationResult":
3535
"""Analyzes the input conversation utterance.
3636
37-
:param analyze_conversation_options: Post body of the request.
38-
:type analyze_conversation_options:
39-
~azure.ai.language.conversations.models.AnalyzeConversationOptions
37+
:param conversation_analysis_options: Post body of the request.
38+
:type conversation_analysis_options:
39+
~azure.ai.language.conversations.models.ConversationAnalysisOptions
4040
:keyword project_name: The name of the project to use.
4141
:paramtype project_name: str
4242
:keyword deployment_name: The name of the specific deployment of the project to use.
@@ -53,7 +53,7 @@ async def analyze_conversations(
5353

5454
content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]
5555

56-
json = self._serialize.body(analyze_conversation_options, 'AnalyzeConversationOptions')
56+
json = self._serialize.body(conversation_analysis_options, 'ConversationAnalysisOptions')
5757

5858
request = build_analyze_conversations_request(
5959
content_type=content_type,

sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/models/__init__.py

Lines changed: 48 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,89 +7,99 @@
77
# --------------------------------------------------------------------------
88

99
try:
10-
from ._models_py3 import AnalyzeConversationOptions
10+
from ._models_py3 import AnalysisParameters
1111
from ._models_py3 import AnalyzeConversationResult
12-
from ._models_py3 import AnalyzeParameters
12+
from ._models_py3 import AnswerSpan
1313
from ._models_py3 import BasePrediction
14-
from ._models_py3 import DSTargetIntentResult
15-
from ._models_py3 import DeepStackEntityResolution
16-
from ._models_py3 import DeepstackCallingOptions
17-
from ._models_py3 import DeepstackEntity
18-
from ._models_py3 import DeepstackIntent
19-
from ._models_py3 import DeepstackParameters
20-
from ._models_py3 import DeepstackPrediction
21-
from ._models_py3 import DeepstackResult
22-
from ._models_py3 import DictionaryNormalizedValueResolution
14+
from ._models_py3 import ConversationAnalysisOptions
15+
from ._models_py3 import ConversationCallingOptions
16+
from ._models_py3 import ConversationEntity
17+
from ._models_py3 import ConversationIntent
18+
from ._models_py3 import ConversationParameters
19+
from ._models_py3 import ConversationPrediction
20+
from ._models_py3 import ConversationResult
21+
from ._models_py3 import ConversationTargetIntentResult
2322
from ._models_py3 import Error
2423
from ._models_py3 import ErrorResponse
2524
from ._models_py3 import InnerErrorModel
25+
from ._models_py3 import KnowledgeBaseAnswer
26+
from ._models_py3 import KnowledgeBaseAnswerDialog
27+
from ._models_py3 import KnowledgeBaseAnswerPrompt
28+
from ._models_py3 import KnowledgeBaseAnswers
2629
from ._models_py3 import LUISCallingOptions
2730
from ._models_py3 import LUISParameters
2831
from ._models_py3 import LUISTargetIntentResult
32+
from ._models_py3 import NoneLinkedTargetIntentResult
33+
from ._models_py3 import OrchestratorPrediction
2934
from ._models_py3 import QuestionAnsweringParameters
3035
from ._models_py3 import QuestionAnsweringTargetIntentResult
3136
from ._models_py3 import TargetIntentResult
32-
from ._models_py3 import WorkflowPrediction
3337
except (SyntaxError, ImportError):
34-
from ._models import AnalyzeConversationOptions # type: ignore
38+
from ._models import AnalysisParameters # type: ignore
3539
from ._models import AnalyzeConversationResult # type: ignore
36-
from ._models import AnalyzeParameters # type: ignore
40+
from ._models import AnswerSpan # type: ignore
3741
from ._models import BasePrediction # type: ignore
38-
from ._models import DSTargetIntentResult # type: ignore
39-
from ._models import DeepStackEntityResolution # type: ignore
40-
from ._models import DeepstackCallingOptions # type: ignore
41-
from ._models import DeepstackEntity # type: ignore
42-
from ._models import DeepstackIntent # type: ignore
43-
from ._models import DeepstackParameters # type: ignore
44-
from ._models import DeepstackPrediction # type: ignore
45-
from ._models import DeepstackResult # type: ignore
46-
from ._models import DictionaryNormalizedValueResolution # type: ignore
42+
from ._models import ConversationAnalysisOptions # type: ignore
43+
from ._models import ConversationCallingOptions # type: ignore
44+
from ._models import ConversationEntity # type: ignore
45+
from ._models import ConversationIntent # type: ignore
46+
from ._models import ConversationParameters # type: ignore
47+
from ._models import ConversationPrediction # type: ignore
48+
from ._models import ConversationResult # type: ignore
49+
from ._models import ConversationTargetIntentResult # type: ignore
4750
from ._models import Error # type: ignore
4851
from ._models import ErrorResponse # type: ignore
4952
from ._models import InnerErrorModel # type: ignore
53+
from ._models import KnowledgeBaseAnswer # type: ignore
54+
from ._models import KnowledgeBaseAnswerDialog # type: ignore
55+
from ._models import KnowledgeBaseAnswerPrompt # type: ignore
56+
from ._models import KnowledgeBaseAnswers # type: ignore
5057
from ._models import LUISCallingOptions # type: ignore
5158
from ._models import LUISParameters # type: ignore
5259
from ._models import LUISTargetIntentResult # type: ignore
60+
from ._models import NoneLinkedTargetIntentResult # type: ignore
61+
from ._models import OrchestratorPrediction # type: ignore
5362
from ._models import QuestionAnsweringParameters # type: ignore
5463
from ._models import QuestionAnsweringTargetIntentResult # type: ignore
5564
from ._models import TargetIntentResult # type: ignore
56-
from ._models import WorkflowPrediction # type: ignore
5765

5866
from ._conversation_analysis_client_enums import (
5967
ErrorCode,
6068
InnerErrorCode,
6169
ProjectKind,
62-
ResolutionKind,
6370
TargetKind,
6471
)
6572

6673
__all__ = [
67-
'AnalyzeConversationOptions',
74+
'AnalysisParameters',
6875
'AnalyzeConversationResult',
69-
'AnalyzeParameters',
76+
'AnswerSpan',
7077
'BasePrediction',
71-
'DSTargetIntentResult',
72-
'DeepStackEntityResolution',
73-
'DeepstackCallingOptions',
74-
'DeepstackEntity',
75-
'DeepstackIntent',
76-
'DeepstackParameters',
77-
'DeepstackPrediction',
78-
'DeepstackResult',
79-
'DictionaryNormalizedValueResolution',
78+
'ConversationAnalysisOptions',
79+
'ConversationCallingOptions',
80+
'ConversationEntity',
81+
'ConversationIntent',
82+
'ConversationParameters',
83+
'ConversationPrediction',
84+
'ConversationResult',
85+
'ConversationTargetIntentResult',
8086
'Error',
8187
'ErrorResponse',
8288
'InnerErrorModel',
89+
'KnowledgeBaseAnswer',
90+
'KnowledgeBaseAnswerDialog',
91+
'KnowledgeBaseAnswerPrompt',
92+
'KnowledgeBaseAnswers',
8393
'LUISCallingOptions',
8494
'LUISParameters',
8595
'LUISTargetIntentResult',
96+
'NoneLinkedTargetIntentResult',
97+
'OrchestratorPrediction',
8698
'QuestionAnsweringParameters',
8799
'QuestionAnsweringTargetIntentResult',
88100
'TargetIntentResult',
89-
'WorkflowPrediction',
90101
'ErrorCode',
91102
'InnerErrorCode',
92103
'ProjectKind',
93-
'ResolutionKind',
94104
'TargetKind',
95105
]

sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/models/_conversation_analysis_client_enums.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ class ErrorCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
2020
UNAUTHORIZED = "Unauthorized"
2121
FORBIDDEN = "Forbidden"
2222
NOT_FOUND = "NotFound"
23+
PROJECT_NOT_FOUND = "ProjectNotFound"
24+
OPERATION_NOT_FOUND = "OperationNotFound"
25+
AZURE_COGNITIVE_SEARCH_NOT_FOUND = "AzureCognitiveSearchNotFound"
26+
AZURE_COGNITIVE_SEARCH_INDEX_NOT_FOUND = "AzureCognitiveSearchIndexNotFound"
2327
TOO_MANY_REQUESTS = "TooManyRequests"
28+
AZURE_COGNITIVE_SEARCH_THROTTLING = "AzureCognitiveSearchThrottling"
29+
AZURE_COGNITIVE_SEARCH_INDEX_LIMIT_REACHED = "AzureCognitiveSearchIndexLimitReached"
2430
INTERNAL_SERVER_ERROR = "InternalServerError"
2531
SERVICE_UNAVAILABLE = "ServiceUnavailable"
2632

@@ -42,17 +48,11 @@ class ProjectKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
4248
CONVERSATION = "conversation"
4349
WORKFLOW = "workflow"
4450

45-
class ResolutionKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
46-
"""The type of an entity resolution.
47-
"""
48-
49-
#: Dictionary normalized entities.
50-
DICTIONARY_NORMALIZED_VALUE = "DictionaryNormalizedValue"
51-
5251
class TargetKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
5352
"""The type of a target service.
5453
"""
5554

5655
LUIS = "luis"
57-
LUIS_DEEPSTACK = "luis_deepstack"
56+
CONVERSATION = "conversation"
5857
QUESTION_ANSWERING = "question_answering"
58+
NON_LINKED = "non_linked"

0 commit comments

Comments
 (0)