Skip to content

Commit 30792da

Browse files
committed
Replaced failed Anthropic backoff with manually set delays
1 parent ec35e77 commit 30792da

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "seidr"
3-
version = "3.3.1"
3+
version = "3.4.0"
44
description = "Synthesize Execute Instruct Debug Rank"
55
authors = ["Vadim Liventsev <v.liventsev@tue.nl>", "Anastasia Grishina <anastasiia@simula.no>"]
66
license = "MIT"

seidr/dev.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from programlib import Program, Language
44
from typing import Callable, Optional, Iterable, Tuple, List, Generator
55
import random
6+
import time
67

78
from seidr.llm import explore_llm, default_batch_size
89
from seidr.eval import Evaluation
@@ -124,7 +125,8 @@ def __init__(self,
124125
log_llm_call: Callable = lambda **kwargs: print(kwargs),
125126
max_programs: Optional[int] = None,
126127
batch_size: Optional[int] = None,
127-
ollama_url: Optional[str] = None) -> None:
128+
ollama_url: Optional[str] = None,
129+
delay: int = 0) -> None:
128130
self.task_name = task_name
129131
self.task_description = task_description
130132
self.critics = critics
@@ -141,6 +143,7 @@ def __init__(self,
141143
self.log_llm_call = log_llm_call
142144
self.max_programs = max_programs
143145
self.ollama_url = ollama_url
146+
self.delay = delay
144147

145148
if not batch_size:
146149
batch_size = default_batch_size(model_name)
@@ -283,4 +286,6 @@ def have_kids(
283286
if self.max_programs is not None and (idx == self.max_programs - 1):
284287
break
285288

289+
time.sleep(self.delay)
290+
286291
return best_code

seidr/llm.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,10 @@ def create_chain(
8181
openai_organization=os.getenv("OPENAI_ORG")
8282
)
8383
elif api == ChatAnthropic:
84-
import anthropic._constants
85-
anthropic._constants.MAX_RETRY_DELAY = 24 * 60 * 60
86-
8784
chat_model = ChatAnthropic(
8885
model_name=model_name,
8986
temperature=temperature,
90-
anthropic_api_key=os.getenv('ANTHROPIC_API_KEY'),
91-
max_retries=20
87+
anthropic_api_key=os.getenv('ANTHROPIC_API_KEY')
9288
)
9389
elif api == ChatOllama:
9490
chat_model = ChatOllama(

0 commit comments

Comments
 (0)