Skip to content

Commit 8136c74

Browse files
authored
Update endpoint and key verbage
1 parent 9ebf063 commit 8136c74

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

samples/knowledge/qna_maker_samples.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
from azure.cognitiveservices.knowledge.qnamaker.models import QnADTO, MetadataDTO, CreateKbDTO, OperationStateType, UpdateKbOperationDTO, UpdateKbOperationDTOAdd
66
from msrest.authentication import CognitiveServicesCredentials
77

8-
SUBSCRIPTION_KEY_ENV_NAME = "QNA_SUBSCRIPTION_KEY"
9-
QNA_LOCATION = os.environ.get("QNA_LOCATION", "westus")
8+
# Add your QnaMaker subscription key and endpoint to your environment variables.
9+
SUBSCRIPTION_KEY = os.environ['QNA_MAKER_SUBSCRIPTION_KEY']
10+
QNA_ENDPOINT = os.environ['QNA_MAKER_ENDPOINT']
1011

1112

1213
def knowledge_based_crud_sample(subscription_key):
@@ -56,8 +57,7 @@ def _monitor_operation(client, operation):
5657
operation.operation_id))
5758
return operation
5859

59-
client = QnAMakerClient(endpoint="https://{}.api.cognitive.microsoft.com".format(
60-
QNA_LOCATION), credentials=CognitiveServicesCredentials(subscription_key))
60+
client = QnAMakerClient(endpoint=QNA_ENDPOINT), credentials=CognitiveServicesCredentials(subscription_key))
6161

6262
# Create a KB
6363
print("Creating KB...")
@@ -98,4 +98,4 @@ def _monitor_operation(client, operation):
9898
import os.path
9999
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..")))
100100
from tools import execute_samples
101-
execute_samples(globals(), SUBSCRIPTION_KEY_ENV_NAME)
101+
execute_samples(globals(), SUBSCRIPTION_KEY)

0 commit comments

Comments
 (0)