Skip to content

Commit

Permalink
Python: Add user agent to OpenAI and OpenAPI headers (#3488)
Browse files Browse the repository at this point in the history
### Motivation and Context

Replaces: #3074

This PR adds the User-Agent header "Semantic Kernel" to calls made to
OpenAI/Azure OpenAI and OpenAPI calls.

### Description

* Addition of telemetry.py file containing telemetry constants
* ability to disable Azure/OpenAI telemetry with an environment variable
called AZURE_TELEMETRY_DISABLED

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄

---------

Co-authored-by: Devis Lucato <[email protected]>
  • Loading branch information
markwallace-microsoft and dluc authored Nov 14, 2023
1 parent 24e2419 commit 6f7cd6a
Show file tree
Hide file tree
Showing 11 changed files with 350 additions and 29 deletions.
7 changes: 7 additions & 0 deletions python/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"littlefoxteam.vscode-python-test-adapter"
]
}
16 changes: 16 additions & 0 deletions python/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
}
]
}
6 changes: 6 additions & 0 deletions python/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"pythonTestExplorer.testFramework": "pytest",
"pythonTestExplorer.pytestPath": "poetry",
"pythonTestExplorer.pytestArguments": [
"run",
"pytest"
],
}
Loading

0 comments on commit 6f7cd6a

Please sign in to comment.