You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
name: Feature request
about: Suggest an idea for this project
Sure, here's a rewritten version of your GitHub issue:
Implementation Details:
A Kernel is created from scratch for each incoming client request.
Several OpenAPI plugins are orchestrated by the Kernel.
The Kernel and OpenAPI plugins use different HttpClient instances due to varying endpoints, authentication methods, etc.
The backend is behind Azure API Management, which acts as a proxy and logs all outgoing requests to OpenAI and OpenAPI plugins.
Requirement:
I need to correlate all consecutive requests made by the Kernel by adding a header to the HTTP request containing a GUID. For example, if generating an answer requires two calls to OpenAI, both calls must include a header with the same value. Additionally, requests to the plugin must also include this header, as the plugin might need to propagate it for its own OpenAI calls, ensuring all related calls can be correlated.
Workaround:
The current workaround involves:
Adding the header during Kernel creation for OpenAI calls.
Storing the header value in Kernel Data.
Implementing a DelegatingHandler that reads the header value from Kernel Data and adds it to the request (following this approach).
Proposed Solution:
A potential solution could involve making the Kernel context available in the DelegatingHandler for both OpenAPI and OpenAI requests. In this way I can implement this logic in one place and make it available to all components. However, I am open to suggestions for a more elegant solution.
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
New Feature: add correlation Id header to Kernel http calls
.Net: New Feature: add correlation Id header to Kernel http calls
Nov 15, 2024
@dmytrostruk Let's start by creating a sample showing how to do this and we can then review to se does it make sense to add this as core functionality.
name: Feature request
about: Suggest an idea for this project
Sure, here's a rewritten version of your GitHub issue:
Implementation Details:
HttpClient
instances due to varying endpoints, authentication methods, etc.Requirement:
I need to correlate all consecutive requests made by the Kernel by adding a header to the HTTP request containing a GUID. For example, if generating an answer requires two calls to OpenAI, both calls must include a header with the same value. Additionally, requests to the plugin must also include this header, as the plugin might need to propagate it for its own OpenAI calls, ensuring all related calls can be correlated.
Workaround:
The current workaround involves:
DelegatingHandler
that reads the header value from Kernel Data and adds it to the request (following this approach).Proposed Solution:
A potential solution could involve making the Kernel context available in the
DelegatingHandler
for both OpenAPI and OpenAI requests. In this way I can implement this logic in one place and make it available to all components. However, I am open to suggestions for a more elegant solution.The text was updated successfully, but these errors were encountered: