Skip to content

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

Merged
ahau-square merged 4 commits intomainfrom
ahau/usage-optional
Jan 30, 2025
Merged

fix: more graceful handling of missing usage in response#907
ahau-square merged 4 commits intomainfrom
ahau/usage-optional

Conversation

@ahau-square
Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

salman1993 commented Jan 29, 2025

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

Copy link
Copy Markdown
Contributor

@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
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)
  ...
@yingjiehe-xyz yingjiehe-xyz deleted the ahau/usage-optional branch February 5, 2025 21:10
cbruyndoncx pushed a commit to cbruyndoncx/goose that referenced this pull request Jul 20, 2025
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