|
1 | 1 | """LLM client for Anthropic models.""" |
2 | 2 |
|
3 | 3 | import json |
| 4 | +import logging |
4 | 5 | import os |
5 | 6 | import random |
6 | 7 | import time |
7 | 8 | from dataclasses import dataclass |
8 | 9 | from typing import Any, Tuple, cast |
9 | | -from dataclasses_json import DataClassJsonMixin |
| 10 | + |
10 | 11 | import anthropic |
11 | 12 | import openai |
12 | 13 | from anthropic import ( |
|
24 | 25 | from anthropic._exceptions import ( |
25 | 26 | OverloadedError as AnthropicOverloadedError, # pyright: ignore[reportPrivateImportUsage] |
26 | 27 | ) |
| 28 | +from anthropic.types import ( |
| 29 | + RedactedThinkingBlock as AnthropicRedactedThinkingBlock, |
| 30 | +) |
27 | 31 | from anthropic.types import ( |
28 | 32 | TextBlock as AnthropicTextBlock, |
| 33 | +) |
| 34 | +from anthropic.types import ( |
29 | 35 | ThinkingBlock as AnthropicThinkingBlock, |
30 | | - RedactedThinkingBlock as AnthropicRedactedThinkingBlock, |
31 | 36 | ) |
32 | 37 | from anthropic.types import ToolParam as AnthropicToolParam |
33 | 38 | from anthropic.types import ( |
|
41 | 46 | ToolChoiceToolChoiceAuto, |
42 | 47 | ToolChoiceToolChoiceTool, |
43 | 48 | ) |
44 | | - |
| 49 | +from dataclasses_json import DataClassJsonMixin |
45 | 50 | from openai import ( |
46 | 51 | APIConnectionError as OpenAI_APIConnectionError, |
47 | 52 | ) |
|
55 | 60 | NOT_GIVEN as OpenAI_NOT_GIVEN, # pyright: ignore[reportPrivateImportUsage] |
56 | 61 | ) |
57 | 62 |
|
58 | | -import logging |
59 | | - |
60 | 63 | logging.getLogger("httpx").setLevel(logging.WARNING) |
61 | 64 |
|
62 | 65 |
|
@@ -170,7 +173,7 @@ class AnthropicDirectClient(LLMClient): |
170 | 173 |
|
171 | 174 | def __init__( |
172 | 175 | self, |
173 | | - model_name="claude-3-7-sonnet-20250219", |
| 176 | + model_name="claude-sonnet-4-20250514", |
174 | 177 | max_retries=2, |
175 | 178 | use_caching=True, |
176 | 179 | use_low_qos_server: bool = False, |
|
0 commit comments