Background and motivation
For our work on GraphRag internally, we normally use the model-name as part of our cache key in our Python-based codebases since different models will yield dramatically different results.
It appears that there's already a mechanism where the DistributedCachingChatClient and DistributedCachingEmbeddingGenerator can be configured by users: via the configure argument within UseDistributedCache. So this can just be a property on the client classes that's visible to developers.
API Proposal (Microsoft.Extensions.AI)
class Test {
public void test() {
string modelName = "gpt-4o";
ChatClientBuilder builder = createChatClientBuilder()
.UseDistributedCache(configure: options =>
{
options.AdditionalCacheKeys = [modelName]
});
}
}
API Usage
See example above
Alternative Designs
No response
Risks
No response