Skip to content

Commit c1da8ff

Browse files
committed
Make chromadb_rm compatible with openai 0.28
1 parent 1a2ef18 commit c1da8ff

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

dspy/retrieve/chromadb_rm.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
import backoff
99
from dsp.utils import dotdict
1010

11+
try:
12+
import openai.error
13+
ERRORS = (openai.error.RateLimitError, openai.error.ServiceUnavailableError, openai.error.APIError)
14+
except Exception:
15+
ERRORS = (openai.RateLimitError, openai.APIError)
16+
1117
try:
1218
import chromadb
1319
from chromadb.config import Settings
@@ -108,7 +114,7 @@ def _init_chromadb(
108114

109115
@backoff.on_exception(
110116
backoff.expo,
111-
(openai.RateLimitError),
117+
ERRORS,
112118
max_time=15,
113119
)
114120
def _get_embeddings(self, queries: List[str]) -> List[List[float]]:

0 commit comments

Comments
 (0)