Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log #1049

Merged
merged 2 commits into from
Jul 8, 2024
Merged

Log #1049

Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ After you have Python and (optionally) PostgreSQL installed, follow these steps:

1. `git clone https://github.com/Pythagora-io/gpt-pilot.git` (clone the repo)
2. `cd gpt-pilot` (go to the repo folder)
3. `python -m venv venv` (create a virtual environment)
3. `python3 -m venv venv` (create a virtual environment)
4. `source venv/bin/activate` (or on Windows `venv\Scripts\activate`) (activate the virtual environment)
5. `pip install -r requirements.txt` (install the dependencies)
6. `cp example-config.json config.json` (create `config.json` file)
Expand Down
6 changes: 5 additions & 1 deletion core/llm/anthropic_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ def rate_limit_sleep(self, err: RateLimitError) -> Optional[datetime.timedelta]:
except ValueError:
return datetime.timedelta(seconds=5)

now = datetime.datetime.now(tz=zoneinfo.ZoneInfo("UTC"))
try:
now = datetime.datetime.now(tz=zoneinfo.ZoneInfo("UTC"))
except zoneinfo.ZoneInfoNotFoundError:
now = datetime.datetime.now(tz=datetime.timezone.utc)

return reset_time - now


Expand Down
1 change: 1 addition & 0 deletions core/llm/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ async def __call__(
# us confirm that we've breached the token limit, but Anthropic doesn't,
# so we can't be certain that's the problem in Anthropic case.
# Here we try to detect that and tell the user what happened.
log.info(f"API status error: {err}")
err_code = err.response.json().get("error", {}).get("code", "")
if err_code in ("request_too_large", "context_length_exceeded", "string_above_max_length"):
# Handle OpenAI and Groq token limit exceeded
Expand Down
Loading