Skip to content

Commit 46e0750

Browse files
authored
Merge pull request #1049 from Pythagora-io/log
Log
2 parents 4bcf374 + 2984b3f commit 46e0750

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ After you have Python and (optionally) PostgreSQL installed, follow these steps:
107107

108108
1. `git clone https://github.com/Pythagora-io/gpt-pilot.git` (clone the repo)
109109
2. `cd gpt-pilot` (go to the repo folder)
110-
3. `python -m venv venv` (create a virtual environment)
110+
3. `python3 -m venv venv` (create a virtual environment)
111111
4. `source venv/bin/activate` (or on Windows `venv\Scripts\activate`) (activate the virtual environment)
112112
5. `pip install -r requirements.txt` (install the dependencies)
113113
6. `cp example-config.json config.json` (create `config.json` file)

core/llm/anthropic_client.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ def rate_limit_sleep(self, err: RateLimitError) -> Optional[datetime.timedelta]:
116116
except ValueError:
117117
return datetime.timedelta(seconds=5)
118118

119-
now = datetime.datetime.now(tz=zoneinfo.ZoneInfo("UTC"))
119+
try:
120+
now = datetime.datetime.now(tz=zoneinfo.ZoneInfo("UTC"))
121+
except zoneinfo.ZoneInfoNotFoundError:
122+
now = datetime.datetime.now(tz=datetime.timezone.utc)
123+
120124
return reset_time - now
121125

122126

core/llm/base.py

+1
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ async def __call__(
243243
# us confirm that we've breached the token limit, but Anthropic doesn't,
244244
# so we can't be certain that's the problem in Anthropic case.
245245
# Here we try to detect that and tell the user what happened.
246+
log.info(f"API status error: {err}")
246247
err_code = err.response.json().get("error", {}).get("code", "")
247248
if err_code in ("request_too_large", "context_length_exceeded", "string_above_max_length"):
248249
# Handle OpenAI and Groq token limit exceeded

0 commit comments

Comments
 (0)