| 1 |
from __future__ import annotations |
| 2 |
|
| 3 |
import httpx2 |
| 4 |
|
| 5 |
RAW_RESPONSE_HEADER = "X-Stainless-Raw-Response" |
| 6 |
OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to" |
| 7 |
|
| 8 |
# default timeout is 10 minutes |
| 9 |
DEFAULT_TIMEOUT = httpx2.Timeout(timeout=10 * 60, connect=5.0) |
| 10 |
DEFAULT_MAX_RETRIES = 2 |
| 11 |
DEFAULT_CONNECTION_LIMITS = httpx2.Limits(max_connections=1000, max_keepalive_connections=100) |
| 12 |
|
| 13 |
INITIAL_RETRY_DELAY = 0.5 |
| 14 |
MAX_RETRY_DELAY = 8.0 |
| 15 |
|
| 16 |
# (discriminator key, discriminator value, file key): a matching object's file is read and sent as base64 |
| 17 |
FILE_INPUT_MARKERS: tuple[tuple[str, str, str], ...] = (("type", "base64", "data"),) |
| 18 |
|
| 19 |
MODEL_NONSTREAMING_TOKENS = { |
| 20 |
"claude-opus-4-20250514": 8_192, |
| 21 |
"claude-opus-4-0": 8_192, |
| 22 |
"claude-4-opus-20250514": 8_192, |
| 23 |
"anthropic.claude-opus-4-20250514-v1:0": 8_192, |
| 24 |
"claude-opus-4@20250514": 8_192, |
| 25 |
"anthropic.claude-opus-4-1-20250805-v1:0": 8192, |
| 26 |
"claude-opus-4-1@20250805": 8192, |
| 27 |
} |