docs update

This commit is contained in:
ishaan-jaff 2023-08-26 16:39:53 -07:00
parent 5fb8675cf8
commit 02accce48e

View file

@ -3,18 +3,31 @@
GPTCache is a Library for Creating Semantic Cache for LLM Queries GPTCache is a Library for Creating Semantic Cache for LLM Queries
GPTCache Docs: https://gptcache.readthedocs.io/en/latest/index.html# GPTCache Docs: https://gptcache.readthedocs.io/en/latest/index.html#
GPTCache Github: https://github.com/zilliztech/GPTCache GPTCache Github: https://github.com/zilliztech/GPTCache
## Usage ## Usage
### Install GPTCache ### Install GPTCache
```
pip install gptcache pip install gptcache
```
### Using GPT Cache with Litellm Completion() ### Using GPT Cache with Litellm Completion()
#### Using GPTCache
In order to use GPTCache the following lines are used to instantiat it
```python ```python
from gptcache import cache from gptcache import cache
from litellm.cache import completion # set API keys in .env / os.environ
cache.init()
cache.set_openai_key()
```
#### Full Code using GPTCache and LiteLLM
```python
from gptcache import cache
from litellm.cache import completion # import completion from litellm.cache
import time import time
# Set your .env keys # Set your .env keys