mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 09:44:59 +00:00
updated tests, disabled send cache
This commit is contained in:
parent
7eab7b54b8
commit
7924900bc4
2 changed files with 32 additions and 28 deletions
|
@ -4,7 +4,8 @@ import json
|
|||
import backoff
|
||||
import openai
|
||||
import requests
|
||||
from diskcache import Cache
|
||||
|
||||
# from diskcache import Cache
|
||||
from openai.error import (
|
||||
APIConnectionError,
|
||||
APIError,
|
||||
|
@ -14,7 +15,8 @@ from openai.error import (
|
|||
)
|
||||
|
||||
CACHE_PATH = "~/.aider.send.cache.v1"
|
||||
CACHE = Cache(CACHE_PATH)
|
||||
CACHE = None
|
||||
# CACHE = Cache(CACHE_PATH)
|
||||
|
||||
|
||||
@backoff.on_exception(
|
||||
|
@ -53,12 +55,12 @@ def send_with_retries(model, messages, functions, stream):
|
|||
# Generate SHA1 hash of kwargs and append it to chat_completion_call_hashes
|
||||
hash_object = hashlib.sha1(key)
|
||||
|
||||
if not stream and key in CACHE:
|
||||
if not stream and CACHE is not None and key in CACHE:
|
||||
return hash_object, CACHE[key]
|
||||
|
||||
res = openai.ChatCompletion.create(**kwargs)
|
||||
|
||||
if not stream:
|
||||
if not stream and CACHE is not None:
|
||||
CACHE[key] = res
|
||||
|
||||
return hash_object, res
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue