From 814927a957ffc5192f9f19968d3ad3508afea1a6 Mon Sep 17 00:00:00 2001 From: Jenan Date: Thu, 1 Jun 2023 16:32:41 -0700 Subject: [PATCH] Add pinned server version, fix sdk version header, bump local version. --- package.json | 2 +- src/index.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index e8b09eac..567be09a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@anthropic-ai/sdk", - "version": "0.4.3", + "version": "0.4.4", "description": "Library for accessing the Anthropic API", "repository": "https://github.com/anthropics/anthropic-sdk-typescript", "license": "MIT", diff --git a/src/index.ts b/src/index.ts index c74dfebb..3ca19b5c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,7 +18,8 @@ export type OnUpdate = (completion: CompletionResponse) => void | Promise; export const HUMAN_PROMPT = "\n\nHuman:"; export const AI_PROMPT = "\n\nAssistant:"; -const CLIENT_ID = "anthropic-typescript/0.4.3"; +const ANTHROPIC_SDK = "anthropic-typescript/0.4.4"; +const ANTHROPIC_VERSION = "2023-01-01"; const DEFAULT_API_URL = "https://api.anthropic.com"; enum Event { @@ -52,7 +53,8 @@ export class Client { headers: { Accept: "application/json", "Content-Type": "application/json", - Client: CLIENT_ID, + "Anthropic-SDK": ANTHROPIC_SDK, + "Anthropic-Version": ANTHROPIC_VERSION, "X-API-Key": this.apiKey, }, body: JSON.stringify({ ...params, stream: false }), @@ -95,7 +97,8 @@ export class Client { headers: { Accept: "application/json", "Content-Type": "application/json", - Client: CLIENT_ID, + "Anthropic-SDK": ANTHROPIC_SDK, + "Anthropic-Version": ANTHROPIC_VERSION, "X-API-Key": this.apiKey, }, body: JSON.stringify({ ...params, stream: true }),