Skip to content

Latest commit

 

History

History
67 lines (44 loc) · 2.83 KB

azure-openai-semantic-cache-store-policy.md

File metadata and controls

67 lines (44 loc) · 2.83 KB
titledescriptionservicesauthorms.servicems.collectionms.customms.topicms.datems.author
Azure API Management policy reference - azure-openai-semantic-cache-store
Reference for the azure-openai-semantic-cache-store policy available for use in Azure API Management. Provides policy usage, settings, and examples.
api-management
dlepow
azure-api-management
ce-skilling-ai-copilot
build-2024
reference
12/13/2024
danlep

Cache responses to Azure OpenAI API requests

[!INCLUDE api-management-availability-all-tiers]

The azure-openai-semantic-cache-store policy caches responses to Azure OpenAI Chat Completion API requests to a configured external cache. Response caching reduces bandwidth and processing requirements imposed on the backend Azure OpenAI API and lowers latency perceived by API consumers.

Note

[!INCLUDE api-management-policy-generic-alert]

[!INCLUDE api-management-azure-openai-models]

Policy statement

<azure-openai-semantic-cache-storeduration="seconds"/>

Attributes

AttributeDescriptionRequiredDefault
durationTime-to-live of the cached entries, specified in seconds. Policy expressions are allowed.YesN/A

Usage

Usage notes

  • This policy can only be used once in a policy section.
  • If the cache lookup fails, the API call that uses the cache-related operation doesn't raise an error, and the cache operation completes successfully.

Examples

Example with corresponding azure-openai-semantic-cache-lookup policy

[!INCLUDE api-management-semantic-cache-example]

Related policies

[!INCLUDE api-management-policy-ref-next-steps]

close