-
Notifications
You must be signed in to change notification settings - Fork 904
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Draft][Tracing] Modify openai span names (#2424)
# Description Rename openai spans since openai.resources.chat.Completions.create is too long. This pull request primarily introduces changes to the tracing functionality in the `promptflow` application. The changes allow for more flexibility and control over the naming of traces, particularly for asynchronous and synchronous functions. The key changes can be grouped into two categories: modifications to the function definitions and adjustments to the function calls. Modifications to function definitions: * [`src/promptflow-tracing/promptflow/tracing/_trace.py`](diffhunk://#diff-580941184737186a94e3e9c06e467e86c06ce846d30ffa42c1c43b45812ddcdcL272-R276): Both the `_traced_async` and `_traced_sync` functions were modified to include an optional `name` parameter. This allows for custom naming of the traces. If no name is provided, the function's name is used as the trace name. [[1]](diffhunk://#diff-580941184737186a94e3e9c06e467e86c06ce846d30ffa42c1c43b45812ddcdcL272-R276) [[2]](diffhunk://#diff-580941184737186a94e3e9c06e467e86c06ce846d30ffa42c1c43b45812ddcdcL322-R334) Adjustments to function calls: * [`src/promptflow-tracing/promptflow/tracing/_integrations/_openai_injector.py`](diffhunk://#diff-01b30cb37ac2a91b223014785c6bc7efe007a66efcb97a0dbb36442a94c2054bL24-R33): Several function calls were adjusted to include the new `name` parameter. This includes the `inject_function_async`, `inject_function_sync`, `inject_async`, and `inject_sync` functions. The `name` parameter was also added to the tuples in the `_openai_api_list` function, which are used to generate the API and injector. [[1]](diffhunk://#diff-01b30cb37ac2a91b223014785c6bc7efe007a66efcb97a0dbb36442a94c2054bL24-R33) [[2]](diffhunk://#diff-01b30cb37ac2a91b223014785c6bc7efe007a66efcb97a0dbb36442a94c2054bL93-R103) [[3]](diffhunk://#diff-01b30cb37ac2a91b223014785c6bc7efe007a66efcb97a0dbb36442a94c2054bL112-R132) [[4]](diffhunk://#diff-01b30cb37ac2a91b223014785c6bc7efe007a66efcb97a0dbb36442a94c2054bL141-R146) [[5]](diffhunk://#diff-01b30cb37ac2a91b223014785c6bc7efe007a66efcb97a0dbb36442a94c2054bL179-R182) # All Promptflow Contribution checklist: - [ ] **The pull request does not introduce [breaking changes].** - [ ] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).** - [ ] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#suggested-workflow).** ## General Guidelines and Best Practices - [ ] Title of the pull request is clear and informative. - [ ] There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, [see this page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [ ] Pull request includes test coverage for the included changes. Co-authored-by: Heyi <heta@microsoft.com>
- Loading branch information
Showing
8 changed files
with
120 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.