From e7eb495a3ae5587dc28ddb56ddc822b5095c0fb1 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Wed, 25 Oct 2023 11:26:25 -0700 Subject: [PATCH] (docs) proxy add info on testing caching --- docs/my-website/docs/simple_proxy.md | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/docs/my-website/docs/simple_proxy.md b/docs/my-website/docs/simple_proxy.md index d09140e16..f51b6f237 100644 --- a/docs/my-website/docs/simple_proxy.md +++ b/docs/my-website/docs/simple_proxy.md @@ -172,9 +172,7 @@ On a successfull deploy https://dashboard.render.com/ should display the followi ## Advanced ### Caching - Completion() and Embedding() Responses -#### Caching on Redis -In order to enable Redis caching: -- Add the following credentials to your server environment - litellm will begin caching your responses +Enable caching by adding the following credentials to your server environment ``` REDIS_HOST = "" # REDIS_HOST='redis-18841.c274.us-east-1-3.ec2.cloud.redislabs.com' @@ -182,6 +180,28 @@ In order to enable Redis caching: REDIS_PASSWORD = "" # REDIS_PASSWORD='liteLlmIsAmazing' ``` +#### Test Caching +Send the same request twice: +```shell +curl http://0.0.0.0:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -d '{ + "model": "gpt-3.5-turbo", + "messages": [{"role": "user", "content": "write a poem about litellm!"}], + "temperature": 0.7 + }' + +curl http://0.0.0.0:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -d '{ + "model": "gpt-3.5-turbo", + "messages": [{"role": "user", "content": "write a poem about litellm!"}], + "temperature": 0.7 + }' +``` + +#### Control caching per completion request +