Skip to content

Latest commit

 

History

History
66 lines (43 loc) · 2.73 KB

llm-semantic-cache-store-policy.md

File metadata and controls

66 lines (43 loc) · 2.73 KB
title description services author ms.service ms.collection ms.custom ms.topic ms.date ms.author
Azure API Management policy reference - llm-semantic-cache-store
Reference for the llm-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
reference
12/13/2024
danlep

Cache responses to large language model API requests

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

The llm-semantic-cache-store policy caches responses to 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-llm-models]

Policy statement

<llm-semantic-cache-store duration="seconds"/>

Attributes

Attribute Description Required Default
duration Time-to-live of the cached entries, specified in seconds. Policy expressions are allowed. Yes N/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 llm-semantic-cache-lookup policy

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

Related policies

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