-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(analytics): edit the format of the ai analytics
This is a fixed of #12583 We need to refactor as many observability providers do not simplify ingest array. Here is a new nested format: Current model is: ```json "ai": { "mistral": { "request_total_tokens": 648, "number_of_instances": 1, "instances": [ { "meta": { "request_model": "mistral-tiny", "plugin_id": "1c783122-0223-4a03-9f1d-c71d2baab01e", "response_model": "mistral-tiny", "provider_name": "mistral" }, "usage": { "prompt_token": 392, "total_tokens": 648, "completion_token": 256 } } ], "request_prompt_tokens": 392, "request_completion_tokens": 256 }, "azure": { "request_total_tokens": 145, "number_of_instances": 1, "instances": [ { "meta": { "request_model": "gpt-35-turbo", "plugin_id": "5df193be-47a3-4f1b-8c37-37e31af0568b", "response_model": "gpt-35-turbo", "provider_name": "azure" }, "usage": { "prompt_token": 89, "total_tokens": 145, "completion_token": 56 } } ], "request_prompt_tokens": 89, "request_completion_tokens": 56 }, "cohere": { "request_total_tokens": 149, "number_of_instances": 1, "instances": [ { "meta": { "request_model": "command", "plugin_id": "30a63ab9-03c6-447a-9b25-195eb0acaeb2", "response_model": "command", "provider_name": "cohere" }, "usage": { "prompt_token": 78, "total_tokens": 149, "completion_token": 71 } } ], "request_prompt_tokens": 78, "request_completion_tokens": 71 } } ``` New model if using several plugins: ```json "ai": { "ai-request-transformer": { "meta": { "request_model": "gpt-35-turbo", "provider_name": "azure", "response_model": "gpt-35-turbo", "plugin_id": "5df193be-47a3-4f1b-8c37-37e31af0568b" }, "payload": {}, "usage": { "prompt_token": 89, "completion_token": 56, "total_tokens": 145 } }, "ai-response-transformer": { "meta": { "request_model": "mistral-tiny", "provider_name": "mistral", "response_model": "mistral-tiny", "plugin_id": "1c783122-0223-4a03-9f1d-c71d2baab01e" }, "payload": {}, "usage": { "prompt_token": 168, "completion_token": 180, "total_tokens": 348 } }, "ai-proxy": { "meta": { "request_model": "gpt-35-turbo", "provider_name": "azure", "response_model": "gpt-35-turbo", "plugin_id": "546c3856-24b3-469a-bd6c-f6083babd2cd" }, "payload": {}, "usage": { "prompt_token": 28, "completion_token": 14, "total_tokens": 42 } } }, ``` * fix analytics with new format * changelog * fix * fix json * fix test * fix test * fix test * fix(ai analytics): edit the format of the ai anayltics * fix(ai analytics): edit the format of the ai anayltics * fix: add testcase * fix: add testcase * fix: add testcase * fix lint * fix(ai-transformer): integration tests wrong response status --------- Co-authored-by: Jack Tysoe <[email protected]>
- Loading branch information
1 parent
6ff84c1
commit 87bdb50
Showing
7 changed files
with
206 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
message: Update telemetry collection for AI Plugins to allow multiple instances data to be set for the same request. | ||
message: Update telemetry collection for AI Plugins to allow multiple plugins data to be set for the same request. | ||
type: bugfix | ||
scope: Core |
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.
87bdb50
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bazel Build
Docker image available
kong/kong:87bdb50a825febac29c0ca59ff0584f606576d9d
Artifacts available https://github.com/Kong/kong/actions/runs/8805177122