Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[.NET] Return ChatCompletions instead of ChatResponseMessage for token usage. #2545

Merged

Conversation

DavidLuong98
Copy link
Member

Why are these changes needed?

ChatCompletions should be returned instead of ChatResponseMessage so consumers can monitor the token usage.

Related issue number

Closes #2535

Checks

Copy link

gitguardian bot commented Apr 30, 2024

⚠️ GitGuardian has uncovered 40 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
10404693 Triggered Generic High Entropy Secret b0f1693 test/oai/test_utils.py View secret
10404693 Triggered Generic High Entropy Secret 3f7c648 test/oai/test_utils.py View secret
10404693 Triggered Generic High Entropy Secret 58e27f2 test/oai/test_utils.py View secret
10404693 Triggered Generic High Entropy Secret 4d24b68 test/oai/test_utils.py View secret
10404693 Triggered Generic High Entropy Secret 5903c9c test/oai/test_utils.py View secret
10404662 Triggered Generic CLI Secret d58f2c8 .github/workflows/dotnet-release.yml View secret
10404694 Triggered Generic High Entropy Secret 4d24b68 test/oai/test_utils.py View secret
10404694 Triggered Generic High Entropy Secret 58e27f2 test/oai/test_utils.py View secret
10404694 Triggered Generic High Entropy Secret 3f7c648 test/oai/test_utils.py View secret
10404694 Triggered Generic High Entropy Secret b0f1693 test/oai/test_utils.py View secret
10404694 Triggered Generic High Entropy Secret 5903c9c test/oai/test_utils.py View secret
10404695 Triggered Generic High Entropy Secret 5903c9c test/oai/test_utils.py View secret
10404695 Triggered Generic High Entropy Secret 58e27f2 test/oai/test_utils.py View secret
10404695 Triggered Generic High Entropy Secret 3f7c648 test/oai/test_utils.py View secret
10404695 Triggered Generic High Entropy Secret 4d24b68 test/oai/test_utils.py View secret
10404695 Triggered Generic High Entropy Secret b0f1693 test/oai/test_utils.py View secret
10404696 Triggered Generic High Entropy Secret 4d24b68 test/oai/test_utils.py View secret
10404696 Triggered Generic High Entropy Secret 5903c9c test/oai/test_utils.py View secret
10404696 Triggered Generic High Entropy Secret 58e27f2 test/oai/test_utils.py View secret
10404696 Triggered Generic High Entropy Secret 3f7c648 test/oai/test_utils.py View secret
10404696 Triggered Generic High Entropy Secret b0f1693 test/oai/test_utils.py View secret
10404662 Triggered Generic CLI Secret 43892f0 .github/workflows/dotnet-build.yml View secret
10404662 Triggered Generic CLI Secret 01b15c4 .github/workflows/dotnet-build.yml View secret
10404662 Triggered Generic CLI Secret 43892f0 .github/workflows/dotnet-build.yml View secret
10404662 Triggered Generic CLI Secret 4bb63f5 .github/workflows/dotnet-build.yml View secret
10404662 Triggered Generic CLI Secret aa96c44 .github/workflows/dotnet-build.yml View secret
10404662 Triggered Generic CLI Secret 43892f0 .github/workflows/dotnet-build.yml View secret
10404662 Triggered Generic CLI Secret 01b15c4 .github/workflows/dotnet-build.yml View secret
10404662 Triggered Generic CLI Secret 01b15c4 .github/workflows/dotnet-build.yml View secret
10404662 Triggered Generic CLI Secret 2cf0768 .github/workflows/dotnet-build.yml View secret
10404662 Triggered Generic CLI Secret aa96c44 .github/workflows/dotnet-build.yml View secret
10404662 Triggered Generic CLI Secret 2cf0768 .github/workflows/dotnet-build.yml View secret
10404662 Triggered Generic CLI Secret 1ca29af .github/workflows/dotnet-build.yml View secret
10404662 Triggered Generic CLI Secret 4bb63f5 .github/workflows/dotnet-build.yml View secret
10404662 Triggered Generic CLI Secret 4bb63f5 .github/workflows/dotnet-build.yml View secret
10404662 Triggered Generic CLI Secret 43892f0 .github/workflows/dotnet-build.yml View secret
10404662 Triggered Generic CLI Secret 01b15c4 .github/workflows/dotnet-build.yml View secret
10404662 Triggered Generic CLI Secret 4bb63f5 .github/workflows/dotnet-build.yml View secret
10404662 Triggered Generic CLI Secret 1ca29af .github/workflows/dotnet-build.yml View secret
10404662 Triggered Generic CLI Secret 0369ec7 .github/workflows/dotnet-release.yml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@DavidLuong98 DavidLuong98 changed the title Return ChatCompletions instead of ChatResponseMessage for token usage. [.NET] Return ChatCompletions instead of ChatResponseMessage for token usage. Apr 30, 2024
auto-merge was automatically disabled May 1, 2024 23:11

Head branch was pushed to by a user without write access

@LittleLittleCloud LittleLittleCloud added this pull request to the merge queue May 1, 2024
@LittleLittleCloud LittleLittleCloud removed this pull request from the merge queue due to a manual request May 2, 2024
@LittleLittleCloud LittleLittleCloud added this pull request to the merge queue May 2, 2024
Merged via the queue into microsoft:main with commit 3e69357 May 2, 2024
32 of 33 checks passed
jayralencar pushed a commit to jayralencar/autogen that referenced this pull request May 28, 2024
…n usage. (microsoft#2545)

* update

* update

* update

* update

* update

* add sample project

* revert notebook change back

* update

* update interactive version

* add nuget package

* refactor Message

* update example

* add azure nightly build pipeline

* Set up CI with Azure Pipelines

[skip ci]

* Update nightly-build.yml for Azure Pipelines

* add dotnet interactive package

* add dotnet interactive package

* update pipeline

* add nuget feed back

* remove dotnet-tool feed

* remove dotnet-tool feed comment

* update pipeline

* update build name

* Update nightly-build.yml

* Delete .github/workflows/dotnet-ci.yml

* update

* add working_dir to use step

* add initateChat api

* update oai package

* Update dotnet-build.yml

* Update dotnet-run-openai-test-and-notebooks.yml

* update build workflow

* update build workflow

* update nuget feed

* update nuget feed

* update aoai and sk version

* Update InteractiveService.cs

* add support for GPT 4V

* add DalleAndGPT4V example

* update example

* add user proxy agent

* add readme

* bump version

* update example

* add dotnet interactive hook

* update

* udpate tests

* add website

* update index.md

* add docs

* update doc

* move sk dependency out of core package

* udpate doc

* Update Use-function-call.md

* add type safe function call document

* update doc

* update doc

* add dock

* Update Use-function-call.md

* add GenerateReplyOptions

* remove IChatLLM

* update version

* update doc

* update website

* add sample

* fix link

* add middleware agent

* clean up doc

* bump version

* update doc

* update

* add Other Language

* remove warnings

* add sign.props

* add sign step

* fix pipelien

* auth

* real sign

* disable PR trigger

* update

* disable PR trigger

* use microbuild machine

* update build pipeline to add publish to internal feed

* add internal feed

* fix build pipeline

* add dotnet prefix

* update ci

* add build number

* update run number

* update source

* update token

* update

* remove adding source

* add publish to github package

* try again

* try again

* ask for write pacakge

* disable package when branch is not main

* update

* implement streaming agent

* add test for streaming function call

* update

* fix microsoft#1588

* enable PR check for dotnet branch

* add website readme

* only publish to dotnet feed when pushing to dotnet branch

* remove openai-test-and-notebooks workflow

* update readme

* update readme

* update workflow

* update getting-start

* upgrade test and sample proejct to use .net 8

* fix global.json format && make loadFromConfig API internal only before implementing

* update

* add support for LM studio

* add doc

* Update README.md

* add push and workflow_dispatch trigger

* disable PR for main

* add dotnet env

* Update Installation.md

* add nuget

* refer to newtonsoft 13

* update branch to dotnet in docfx

* Update Installation.md

* pull out HumanInputMiddleware and FunctionCallMiddleware

* fix tests

* add link to sample folder

* refactor message

* refactor over IMessage

* add more tests

* add more test

* fix build error

* rename header

* add semantic kernel project

* update sk example

* update dotnet version

* add LMStudio function call example

* rename LLaMAFunctin

* remove dotnet run openai test and notebook workflow

* add FunctionContract and test

* update doc

* add documents

* add workflow

* update

* update sample

* fix warning in test

* reult length can be less then maximumOutputToKeep (microsoft#1804)

* merge with main

* add option to retrieve inner agent and middlewares from MiddlewareAgent

* update doc

* adjust namespace

* update readme

* fix test

* use IMessage

* more updates

* update

* fix test

* add comments

* use FunctionContract to replace FunctionDefinition

* move AutoGen contrac to AutoGen.Core

* update installation

* refactor streamingAgent by adding StreamingMessage type

* update sample

* update samples

* update

* update

* add test

* fix test

* bump version

* add openaichat test

* update

* Update Example03_Agent_FunctionCall.cs

* [.Net] improve docs (microsoft#1862)

* add doc

* add doc

* add doc

* add doc

* add doc

* add doc

* update

* fix test error

* fix some error

* fix test

* fix test

* add more tests

* edits

---------

Co-authored-by: ekzhu <ekzhu@users.noreply.github.com>

* [.Net] Add fill form example (microsoft#1911)

* add form filler example

* update

* fix ci error

* [.Net] Add using AutoGen.Core in source generator (microsoft#1983)

* fix using namespace bug in source generator

* remove using in sourcegenerator test

* disable PR test

* Add .idea to .gitignore (microsoft#1988)

* [.Net] publish to nuget.org feed (microsoft#1987)

* publish to nuget

* update ci

* update dotnet-release

* update release pipeline

* add source

* remove empty symbol package

* update pipeline

* remove tag

* update installation guide

* [.Net] Rename some classes && APIs based on doc review (microsoft#1980)

* rename sequential group chat to round robin group chat

* rename to sendInstruction

* rename workflow to graph

* rename some api

* bump version

* move Graph to GroupChat folder

* rename fill application example

* [.Net] Improve package description (microsoft#2161)

* add discord link and update package description

* Update getting-start.md

* [.Net] Fix document comment from the most recent AutoGen.Net engineer sync (microsoft#2231)

* update

* rename RegisterPrintMessageHook to RegisterPrintMessage

* update website

* update update.md

* fix link error

* [.Net] Enable JsonMode and deterministic output in AutoGen.OpenAI OpenAIChatAgent (microsoft#2347)

* update openai version && add sample for json output

* add example in web

* update update.md

* update image url

* [.Net] Add AutoGen.Mistral package (microsoft#2330)

* add mstral client

* enable streaming support

* add mistralClientAgent

* add test for function call

* add extension

* add support for toolcall and toolcall result message

* add support for aggregate message

* implement streaming function call

* track (microsoft#2471)

* [.Net] add mistral example (microsoft#2482)

* update existing examples to use messageCOnnector

* add overview

* add function call document

* add example 14

* add mistral token count usage example

* update version

* Update dotnet-release.yml (microsoft#2488)

* update

* revert gitattributes

* Return ChatCompletions instead of ChatResponseMessage for token usage.

---------

Co-authored-by: XiaoYun Zhang <xiaoyuz@microsoft.com>
Co-authored-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com>
Co-authored-by: mhensen <mh@webvize.nl>
Co-authored-by: ekzhu <ekzhu@users.noreply.github.com>
Co-authored-by: Krzysztof Kasprowicz <60486987+Krzysztof318@users.noreply.github.com>
Co-authored-by: luongdavid <luongdavid@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request][.Net]: Count token usage for OpenAIClientAgent
4 participants