github anthropics/anthropic-sdk-go v2.18.0

54 minutes ago

Features

  • api: add the beta analytics list of projects in the new projects experience
  • api: add the organization_url_fetch_disabled error code

Bug Fixes

  • client: keep a base URL's password out of the URL parse error

  • client: name the host, not the URL, when a connection fails

    The returned error now wraps the *url.Error, so the type assertion err.(*url.Error) no longer matches. errors.As, errors.Is and err.(net.Error) work as before.

  • client: return the network error when a JSONL stream drops mid-line

    Err() on a JSONL stream, such as the results of a Message Batch, returned a JSON syntax error when the connection dropped in the middle of a line. It now returns the error of the failed read, such as io.ErrUnexpectedEOF. A last line that the drop left without its newline is no longer yielded.

  • client: use the API's error message, not the whole response body, as the error message

  • config: keep a base URL's password out of the token endpoint error

  • tools: give the model the API error's own message when a tool result is refused

    When the API refuses a tool's result with a 400 or a 413, the session tool runner's error result is now The API refused the result of tool '<name>': followed by the error's Error() text. It was the status and error.message, or the status's standard text.

  • tools: refuse a replace_all edit whose result is over the file size limit

    This applies to a replace_all edit of two or more matches. The limit is MaxFileBytes, 256 KiB by default, and the file is left unchanged.

Performance Improvements

  • client: cache struct field lookups when decoding responses
  • client: speed up decoding of response objects
  • streaming: return a one-block session preview's text without copying it
  • tools: read only tool and status events from a session's history

Chores

  • docs: clarify what a federation rule's match must contain
  • docs: update example request bodies
  • docs: use example.com in example email addresses
  • internal: add this repository's review rules
  • internal: rename the message thread helper's files

Documentation

  • api: clarify that max_tokens applies to each model call
  • api: clarify when SCIM-provisioned RBAC groups can be changed
  • api: say to retry storage_not_ready in a minute

Don't miss a new anthropic-sdk-go release

NewReleases is sending notifications on new releases.