Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions utils/call_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,26 @@ def call_llm(prompt: str, use_cache: bool = True) -> str:

# # Use Anthropic Claude 3.7 Sonnet Extended Thinking
# def call_llm(prompt, use_cache: bool = True):
# from anthropic import Anthropic
# from anthropic import Anthropic, RateLimitError
# import time
# client = Anthropic(api_key=os.environ.get("ANTHROPIC_API_KEY", "your-api-key"))
# response = client.messages.create(
# model="claude-3-7-sonnet-20250219",
# max_tokens=21000,
# thinking={
# "type": "enabled",
# "budget_tokens": 20000
# },
# messages=[
# {"role": "user", "content": prompt}
# ]
# )
# try:
# response = client.messages.create(
# model="claude-3-7-sonnet-20250219",
# max_tokens=21000,
# thinking={
# "type": "enabled",
# "budget_tokens": 20000
# },
# messages=[
# {"role": "user", "content": prompt}
# ]
# )
# except RateLimitError:
# for i in range(70):
# print(f"Rate limit exceeded. Waiting {70-i}s before retrying", end='\r', flush=True)
# time.sleep(1)
# return call_llm(prompt)
# return response.content[1].text

# # Use OpenAI o1
Expand Down