@haikit/anthropic 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +3 -1
package/README.md
CHANGED
|
@@ -4,9 +4,13 @@ Model adapter for Claude.
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
import { anthropic } from "@haikit/anthropic";
|
|
7
|
-
createHai({ model: anthropic({ model: "claude-
|
|
7
|
+
createHai({ model: anthropic({ model: "claude-haiku-5-5", effort: "medium" }), … });
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
+
With no `model`, it uses `claude-haiku-5-5`, the fastest and cheapest Claude
|
|
11
|
+
model; pass any other model ID, such as `claude-sonnet-5-5`, to change it.
|
|
12
|
+
`effort` defaults to `medium`.
|
|
13
|
+
|
|
10
14
|
Note it imports only `@haikit/core`, never `@haikit/server`. Adapters implement an
|
|
11
15
|
interface the contract layer declares — that is what keeps the runtime
|
|
12
16
|
swappable, and what lets an app ship its own adapter without forking anything
|
package/dist/index.d.ts
CHANGED
|
@@ -12,8 +12,10 @@ import type { ModelAdapter } from "@haikit/core";
|
|
|
12
12
|
* *different request* minutes later. An in-process iterator cannot cross that.
|
|
13
13
|
*/
|
|
14
14
|
export interface AnthropicOptions {
|
|
15
|
+
/** Any Claude model ID. Defaults to `claude-haiku-5-5`, the fastest and cheapest. */
|
|
15
16
|
model?: string;
|
|
16
17
|
maxTokens?: number;
|
|
18
|
+
/** Defaults to `medium`. */
|
|
17
19
|
effort?: "low" | "medium" | "high" | "xhigh" | "max";
|
|
18
20
|
apiKey?: string;
|
|
19
21
|
}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAA+B,MAAM,cAAc,CAAC;AAE9E;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,YAAY,CAuCtE"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAA+B,MAAM,cAAc,CAAC;AAE9E;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,YAAY,CAuCtE"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuBA,MAAM,UAAU,SAAS,CAAC,UAA4B,EAAE;IACtD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,kBAAkB,CAAC;IAClD,IAAI,MAAM,GAAQ,IAAI,CAAC;IAEvB,OAAO;QACL,EAAE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AI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;oBAC9E,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBACxC,CAAC;YACH,CAAC;YAED,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;YAC1C,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC;QACpE,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haikit/anthropic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Claude model adapter for haikit. Imports only @haikit/core, never the server runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"haikit",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@anthropic-ai/sdk": "^0.70.0",
|
|
38
|
-
"@haikit/core": "0.
|
|
38
|
+
"@haikit/core": "0.10.0"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
package/src/index.ts
CHANGED
|
@@ -13,14 +13,16 @@ import type { ModelAdapter, ModelRequest, ModelResponse } from "@haikit/core";
|
|
|
13
13
|
* *different request* minutes later. An in-process iterator cannot cross that.
|
|
14
14
|
*/
|
|
15
15
|
export interface AnthropicOptions {
|
|
16
|
+
/** Any Claude model ID. Defaults to `claude-haiku-5-5`, the fastest and cheapest. */
|
|
16
17
|
model?: string;
|
|
17
18
|
maxTokens?: number;
|
|
19
|
+
/** Defaults to `medium`. */
|
|
18
20
|
effort?: "low" | "medium" | "high" | "xhigh" | "max";
|
|
19
21
|
apiKey?: string;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export function anthropic(options: AnthropicOptions = {}): ModelAdapter {
|
|
23
|
-
const model = options.model ?? "claude-
|
|
25
|
+
const model = options.model ?? "claude-haiku-5-5";
|
|
24
26
|
let client: any = null;
|
|
25
27
|
|
|
26
28
|
return {
|