Skip to content

armgit / storm

Public Imported from GitHub
0

An LLM-powered knowledge curation system that researches a topic and generates a full-length report with citations.

Fix the Python complain when `anthropic` is not installed.

shaoyijia463634e640e5
diff --git a/src/lm.py b/src/lm.py
index 600002f..60dff4d 100644
--- a/src/lm.py
+++ b/src/lm.py
@@ -13,9 +13,9 @@ from dsp.modules.hf_client import send_hfvllm_request_v00, send_hftgi_request_v0
from transformers import AutoTokenizer
try:
- import anthropic
+ from anthropic import RateLimitError
except ImportError:
- pass
+ RateLimitError = None
class OpenAIModel(dspy.OpenAI):
@@ -193,7 +193,7 @@ class ClaudeModel(dspy.dsp.modules.lm.LM):
@backoff.on_exception(
backoff.expo,
- (anthropic.RateLimitError,),
+ (RateLimitError,),
max_time=1000,
max_tries=8,
on_backoff=backoff_hdlr,