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

fix: more graceful handling of missing usage in response #907

Merged
merged 4 commits into from
Jan 30, 2025

Conversation

ahau-square
Copy link
Collaborator

There seems to be a transient issue with usage failing to be returned on OpenRouter with the Anthropic model: #899 (comment)

According to their documentation, usage should always be returned for non-streaming calls, but that appears not to be the case. This PR allows more graceful failing and returning default usage with None fields in case that happens. It also does the same for the other providers so that getting the 'usage' won't cause a completion to fail.

@salman1993
Copy link
Collaborator

salman1993 commented Jan 29, 2025

lgtm! for anthropic and google, we can add the logging too

Copy link
Collaborator

@salman1993 salman1993 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we make the PR title conventional commit fix: ..

@ahau-square ahau-square changed the title [fix] more graceful handling of missing usage in response fix: more graceful handling of missing usage in response Jan 29, 2025
@ahau-square ahau-square merged commit 6051021 into main Jan 30, 2025
4 checks passed
salman1993 added a commit that referenced this pull request Jan 30, 2025
* origin/main:
  fix: clarify linux cli install only (#927)
  feat: update ui for ollama host (#912)
  feat: add CONFIGURE=false option in install script (#920)
  fix: truncation agent token calculations (#915)
  fix: request payload for o1 models (#921)
  Update SupportedEnvironments.js so others don't get confused on why they can not open the macos app on x86 (#888)
  fix: improve configure process with error message (#919)
  docs: Goose on Windows via WSL (#901)
  fix: more graceful handling of missing usage in provider response (#907)
  feat: rm uv.lock cause it points to square artifactory (#917)
  feat: Update issue templates for bug report for goose (#913)
  fix: post endpoint url on sse endpoint event (#900)
michaelneale added a commit that referenced this pull request Jan 31, 2025
* main: (28 commits)
  ci: per semver build metadata should be after + (#971)
  fix: temp fix to make CI workflow pass (#970)
  chore: bump patch version to 1.0.3 (#967)
  fix: load shell automatically from env for GUI (#948)
  fix: update versions in release and canary workflows (#911)
  docs: fix typo, name (#963)
  docs: typo fix (#961)
  chore: remove gpt-3.5-turbo UI suggestion, as it is deprecated (#959)
  chore: remove o1-mini suggestion from UI add model view (#957)
  fix: missing field in request (#956)
  docs: update provider docs, fix rate limit link (#943)
  fix: clarify linux cli install only (#927)
  feat: update ui for ollama host (#912)
  feat: add CONFIGURE=false option in install script (#920)
  fix: truncation agent token calculations (#915)
  fix: request payload for o1 models (#921)
  Update SupportedEnvironments.js so others don't get confused on why they can not open the macos app on x86 (#888)
  fix: improve configure process with error message (#919)
  docs: Goose on Windows via WSL (#901)
  fix: more graceful handling of missing usage in provider response (#907)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants