From 8bf6bc23f610af7c2a8015950bb4625ac683e599 Mon Sep 17 00:00:00 2001 From: Daniel Morris Date: Wed, 8 May 2024 15:18:41 +0100 Subject: [PATCH] fix: Fix the format of the user-agent header --- .github/workflows/ci.yaml | 3 ++- anthropic.go | 4 ++-- version.go | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1757c98..fb9c6d2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -55,11 +55,12 @@ jobs: - name: Update the version number if: ${{ steps.release.outputs.prs_created == 'true' }} run: | + git config pull.ff only git checkout ${{ fromJSON(steps.release.outputs.pr).headBranchName }} git pull origin ${{ fromJSON(steps.release.outputs.pr).headBranchName }} version=$(jq -r '."."' .github/release-manifest.json) version=${version#v} - sed -i '/const semanticVersion = \"v[0-9]*\.[0-9]*\.[0-9]*\"/cconst semanticVersion = \"v$version\"' version.go + sed -i '/const semanticVersion = \"[0-9]*\.[0-9]*\.[0-9]*\"/cconst semanticVersion = \"$version\"' version.go git config --local user.name "David Letterman" git config --local user.email "48985810+david-letterman@users.noreply.github.com" git add version.go diff --git a/anthropic.go b/anthropic.go index 09e6895..5203dd2 100644 --- a/anthropic.go +++ b/anthropic.go @@ -15,7 +15,7 @@ import ( const ( defaultAPIVersion = "2023-06-01" defaultBaseURL = "https://api.anthropic.com/v1/" - defaultBaseUserAgent = "unfunco/anthropic-sdk-go" + defaultBaseUserAgent = "anthropic-sdk-go" ) // Client manages communication with the Anthropic REST API. @@ -77,7 +77,7 @@ func (c *Client) NewRequest(method, path string, body any) (*http.Request, error } req.Header.Set("anthropic-version", defaultAPIVersion) - req.Header.Set("user-agent", defaultBaseUserAgent+"@"+semanticVersion) + req.Header.Set("user-agent", defaultBaseUserAgent+"/"+semanticVersion) if body != nil { req.Header.Set("content-type", "application/json") diff --git a/version.go b/version.go index 8adcfc7..38ad355 100644 --- a/version.go +++ b/version.go @@ -2,4 +2,4 @@ package anthropic // semanticVersion does not need to be updated manually. // It is automatically updated by the release process. -const semanticVersion = "v0.1.0" +const semanticVersion = "0.1.0"