Skip to content

Commit

Permalink
[FormRecognizer] Add telemetry header to track usage (#488)
Browse files Browse the repository at this point in the history
  • Loading branch information
toothache committed Jan 16, 2024
1 parent 5a0bbdc commit af9d06b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,8 @@ def __new__(cls, *args, **kwargs):
url = os.getenv("FORM_RECOGNIZER_ENDPOINT")
key = os.getenv("FORM_RECOGNIZER_KEY")
if url and key:
cls.instance = DocumentAnalysisClient(endpoint=url, credential=AzureKeyCredential(key))
cls.instance = DocumentAnalysisClient(
endpoint=url, credential=AzureKeyCredential(key), headers={"x-ms-useragent": "sample-app-aoai-chatgpt/1.0.0"})
else:
print("SingletonFormRecognizerClient: Skipping since credentials not provided. Assuming NO form recognizer extensions(like .pdf) in directory")
cls.instance = object() # dummy object
Expand All @@ -1040,4 +1041,4 @@ def __getstate__(self):

def __setstate__(self, state):
url, key = state
self.instance = DocumentAnalysisClient(endpoint=url, credential=AzureKeyCredential(key))
self.instance = DocumentAnalysisClient(endpoint=url, credential=AzureKeyCredential(key), headers={"x-ms-useragent": "sample-app-aoai-chatgpt/1.0.0"})

0 comments on commit af9d06b

Please sign in to comment.