I'm getting the error "No appropriate cache found for provided policy configuration. Policy execution will be skipped." . Semantic caching is not working for Azure OpenAI responses

Rohan Krishna Ullas 5 Reputation points Microsoft Employee
2024-07-26T13:00:24.7833333+00:00

Context: I'm trying to set up an APIM service which has semantic caching enabled for GPT requests so that the response times for same/similar questions are lesser but the caching implementation is not working even though I am able to see the responses from the GPT models.

I have followed the steps from https://learn.microsoft.com/en-us/azure/api-management/azure-openai-enable-semantic-caching and re-checked multiple times to ensure that I haven't missed any step. Ideally, for the same request to the same GPT model sent again before the cache expiration time should return responses in much lesser time. This is done by policies configured on the API(https://learn.microsoft.com/en-us/azure/api-management/azure-openai-semantic-cache-lookup-policy and https://learn.microsoft.com/en-us/azure/api-management/azure-openai-semantic-cache-store-policy). Both my GPT3.5 Turbo and Embeddings model work when tested from Test section of APIM but from trace I see this error signifying that caching is not working.
User's image

Any help would be greatly appreciated!

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,175 questions
Azure Cache for Redis
Azure Cache for Redis
An Azure service that provides access to a secure, dedicated Redis cache, managed by Microsoft.
259 questions
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,231 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rohan Krishna Ullas 5 Reputation points Microsoft Employee
    2024-07-30T08:54:46.8666667+00:00

    I was able to fix the issue which was preventing caching. There were 2 issues preventing caching:

    The cache was not set to 'Default'. I had previously added my Redis Cache from a region by selecting a region from the dropdown 'Use from' and then selecting the resource from the 'Cache instance' dropdown. The 'Use from' value has to be instead selected as 'Default' and the 'Cache instance' should be kept to 'Custom' value and the connection string has to be manually filled in (of the format "<endpoint-url-of-cache>,password=<access-key>,ssl=True,abortConnect=False" )enter image description here

    The custom url in the backend for embeddings API was missing 'embeddings-deployment/embeddings' in the custom url enter image description here

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.