GPTCache#

gptcache.Cache#

Initialize GPTCache.

Example

from gptcache import cache
from gptcache.adapter import openai

cache.init()
cache.set_openai_key()

gptcache.Config#

Pass configuration.

param log_time_func

optional, customized log time function

param similarity_threshold

a threshold ranged from 0 to 1 to filter search results with similarity score higher than the threshold. When it is 0, there is no hits. When it is 1, all search results will be returned as hits.

type similarity_threshold

float

Example

from gptcache import Config

configs = Config(similarity_threshold=0.6)