@stratix/ai-anthropic 0.7.6 → 0.8.1
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 +14 -43
- package/dist/AnthropicProvider.d.ts +54 -40
- package/dist/AnthropicProvider.d.ts.map +1 -1
- package/dist/AnthropicProvider.js +44 -53
- package/dist/AnthropicProvider.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,78 +3,49 @@
|
|
|
3
3
|
|
|
4
4
|
# @stratix/ai-anthropic
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
**Anthropic Claude LLM provider for Stratix AI agents**
|
|
7
7
|
|
|
8
8
|
[](https://www.npmjs.com/package/@stratix/ai-anthropic)
|
|
9
9
|
[](https://opensource.org/licenses/MIT)
|
|
10
|
-
[](https://stratix-dev.github.io/stratix/docs/providers/providers-overview)
|
|
11
10
|
|
|
12
|
-
[Documentation](https://stratix-dev.github.io/
|
|
11
|
+
[Documentation](https://stratix-dev.github.io/docs/)
|
|
13
12
|
|
|
14
13
|
</div>
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
> Part of **[Stratix Framework](https://stratix-dev.github.io/stratix/)** - A TypeScript framework for building scalable applications with Domain-Driven Design, Hexagonal Architecture, and CQRS patterns.
|
|
15
|
+
> Part of **[Stratix Framework](https://stratix-dev.github.io/docs/)** - A TypeScript framework for building scalable applications with Domain-Driven Design, Hexagonal Architecture, and CQRS patterns.
|
|
18
16
|
>
|
|
19
|
-
> **New to Stratix?** Start with the [Getting Started Guide](https://stratix-dev.github.io/stratix/docs/getting-started/quick-start)
|
|
20
17
|
|
|
18
|
+
## ⚠️ Pre-Release Warning
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
**This is a pre-release version of @stratix/ai-anthropic.**
|
|
21
|
+
|
|
22
|
+
This package is under active development and should be considered unstable. The API may change significantly between versions without prior notice. Features may be added, modified, or removed entirely. This package may also be deprecated or discontinued in future releases.
|
|
23
|
+
|
|
24
|
+
**Stable versions will be available starting from version 1.0.0.** Not recommended for production use. Use at your own risk.
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
## About This Package
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
`@stratix/ai-anthropic` This provider enables Stratix AI agents to use Anthropic's Claude models (Opus, Sonnet, Haiku) for chat completion, streaming, and tool calling.
|
|
27
29
|
|
|
28
|
-
This provider enables Stratix AI agents to use Anthropic's Claude models (Opus, Sonnet, Haiku) for chat completion, streaming, and tool calling.
|
|
29
30
|
|
|
30
31
|
## About Stratix
|
|
31
32
|
|
|
32
33
|
Stratix is an AI-first TypeScript framework combining Domain-Driven Design, Hexagonal Architecture, and CQRS. It provides production-ready patterns for building scalable, maintainable applications with AI agents as first-class citizens.
|
|
33
34
|
|
|
34
35
|
**Key Resources:**
|
|
35
|
-
- [Documentation](https://stratix-dev.github.io/
|
|
36
|
-
- [Quick Start](https://stratix-dev.github.io/stratix/docs/getting-started/quick-start)
|
|
36
|
+
- [Documentation](https://stratix-dev.github.io/docs/)
|
|
37
37
|
- [Report Issues](https://github.com/stratix-dev/stratix/issues)
|
|
38
38
|
|
|
39
39
|
## Installation
|
|
40
40
|
|
|
41
41
|
**Prerequisites:**
|
|
42
42
|
- Node.js 18.0.0 or higher
|
|
43
|
-
- `@stratix/core` and `@stratix/runtime` installed
|
|
44
|
-
- Basic understanding of [Stratix architecture](https://stratix-dev.github.io/stratix/docs/core-concepts/architecture-overview)
|
|
45
|
-
|
|
46
|
-
**Recommended:** Use the Stratix CLI
|
|
47
|
-
```bash
|
|
48
|
-
stratix add anthropic
|
|
49
|
-
```
|
|
50
43
|
|
|
51
|
-
**
|
|
44
|
+
**Installation:**
|
|
52
45
|
```bash
|
|
53
46
|
npm install @stratix/ai-anthropic
|
|
54
47
|
```
|
|
55
48
|
|
|
56
|
-
## Related Packages
|
|
57
|
-
|
|
58
|
-
**Essential:**
|
|
59
|
-
- [`@stratix/core`](https://www.npmjs.com/package/@stratix/core) - Core primitives and abstractions
|
|
60
|
-
- [`@stratix/runtime`](https://www.npmjs.com/package/@stratix/runtime) - Application runtime and plugin system
|
|
61
|
-
- [`@stratix/cli`](https://www.npmjs.com/package/@stratix/cli) - Code generation and scaffolding
|
|
62
|
-
|
|
63
|
-
[View all providers](https://stratix-dev.github.io/stratix/docs/providers/ai-providers)
|
|
64
|
-
|
|
65
|
-
## Documentation
|
|
66
|
-
|
|
67
|
-
- [Getting Started](https://stratix-dev.github.io/stratix/docs/getting-started/quick-start)
|
|
68
|
-
- [Core Concepts](https://stratix-dev.github.io/stratix/docs/core-concepts/architecture-overview)
|
|
69
|
-
- [AI Providers](https://stratix-dev.github.io/stratix/docs/providers/ai-providers)
|
|
70
|
-
- [Providers Overview](https://stratix-dev.github.io/stratix/docs/providers/providers-overview)
|
|
71
|
-
- [Complete Documentation](https://stratix-dev.github.io/stratix/)
|
|
72
|
-
|
|
73
|
-
## Support
|
|
74
|
-
|
|
75
|
-
- [GitHub Issues](https://github.com/stratix-dev/stratix/issues) - Report bugs and request features
|
|
76
|
-
- [Documentation](https://stratix-dev.github.io/stratix/) - Comprehensive guides and tutorials
|
|
77
|
-
|
|
78
49
|
## License
|
|
79
50
|
|
|
80
51
|
MIT - See [LICENSE](https://github.com/stratix-dev/stratix/blob/main/LICENSE) for details.
|
|
@@ -83,4 +54,4 @@ MIT - See [LICENSE](https://github.com/stratix-dev/stratix/blob/main/LICENSE) fo
|
|
|
83
54
|
|
|
84
55
|
**[Stratix Framework](https://stratix-dev.github.io/stratix/)** - Build better software with proven patterns
|
|
85
56
|
|
|
86
|
-
</div>
|
|
57
|
+
</div>
|
|
@@ -1,81 +1,95 @@
|
|
|
1
1
|
import type { LLMProvider, ChatParams, ChatResponse, ChatChunk, EmbeddingParams, EmbeddingResponse } from '@stratix/core';
|
|
2
2
|
import type { TokenUsage } from '@stratix/core';
|
|
3
|
+
/**
|
|
4
|
+
* Model configuration with optional pricing information
|
|
5
|
+
*/
|
|
6
|
+
export interface ModelConfig {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly pricing?: {
|
|
9
|
+
readonly input: number;
|
|
10
|
+
readonly output: number;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Configuration for AnthropicProvider
|
|
15
|
+
*/
|
|
16
|
+
export interface AnthropicConfig {
|
|
17
|
+
readonly apiKey: string;
|
|
18
|
+
readonly baseURL?: string;
|
|
19
|
+
readonly models: ModelConfig[];
|
|
20
|
+
}
|
|
3
21
|
/**
|
|
4
22
|
* Anthropic provider implementation for Stratix AI Agents.
|
|
5
23
|
*
|
|
24
|
+
* Requires explicit model configuration - no defaults provided.
|
|
6
25
|
* Supports Claude 3 models (Opus, Sonnet, Haiku) with tool use and streaming.
|
|
7
26
|
* Note: Anthropic does not support embeddings.
|
|
8
27
|
*
|
|
9
|
-
* @example
|
|
28
|
+
* @example Using predefined model constants
|
|
10
29
|
* ```typescript
|
|
30
|
+
* import { AnthropicProvider } from '@stratix/ai-anthropic';
|
|
31
|
+
*
|
|
11
32
|
* const provider = new AnthropicProvider({
|
|
12
|
-
* apiKey: process.env.ANTHROPIC_API_KEY
|
|
33
|
+
* apiKey: process.env.ANTHROPIC_API_KEY!,
|
|
34
|
+
* models: [
|
|
35
|
+
* { name: 'claude-sonnet-4-5-20250929', pricing: { input: 3.0, output: 15.0 } },
|
|
36
|
+
* { name: 'claude-opus-4-5-20251101', pricing: { input: 5.0, output: 25.0 } }
|
|
37
|
+
* ]
|
|
13
38
|
* });
|
|
14
39
|
*
|
|
15
40
|
* const response = await provider.chat({
|
|
16
|
-
* model: 'claude-
|
|
17
|
-
* messages: [
|
|
18
|
-
* { role: 'user', content: 'Hello!', timestamp: new Date() }
|
|
19
|
-
* ],
|
|
20
|
-
* temperature: 0.7
|
|
41
|
+
* model: 'claude-sonnet-4-5-20250929',
|
|
42
|
+
* messages: [{ role: 'user', content: 'Hello!', timestamp: new Date() }]
|
|
21
43
|
* });
|
|
22
44
|
* ```
|
|
23
45
|
*
|
|
24
|
-
* @example
|
|
46
|
+
* @example Custom models with updated pricing
|
|
25
47
|
* ```typescript
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* }
|
|
30
|
-
*
|
|
31
|
-
*
|
|
48
|
+
* const provider = new AnthropicProvider({
|
|
49
|
+
* apiKey: process.env.ANTHROPIC_API_KEY!,
|
|
50
|
+
* models: [
|
|
51
|
+
* { name: 'claude-sonnet-4-5-20250929', pricing: { input: 3.5, output: 17.5 } },
|
|
52
|
+
* { name: 'claude-opus-4-5-20251101', pricing: { input: 25.0, output: 125.0 } }
|
|
53
|
+
* ]
|
|
54
|
+
* });
|
|
32
55
|
* ```
|
|
33
56
|
*
|
|
34
|
-
* @example
|
|
57
|
+
* @example Without pricing (calculateCost returns 0)
|
|
35
58
|
* ```typescript
|
|
36
|
-
* const
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* description: 'Get weather for a location',
|
|
42
|
-
* parameters: {
|
|
43
|
-
* type: 'object',
|
|
44
|
-
* properties: { city: { type: 'string' } },
|
|
45
|
-
* required: ['city']
|
|
46
|
-
* }
|
|
47
|
-
* }]
|
|
59
|
+
* const provider = new AnthropicProvider({
|
|
60
|
+
* apiKey: process.env.ANTHROPIC_API_KEY!,
|
|
61
|
+
* models: [
|
|
62
|
+
* { name: 'claude-sonnet-4-5-20250929' }
|
|
63
|
+
* ]
|
|
48
64
|
* });
|
|
49
65
|
* ```
|
|
50
66
|
*
|
|
51
|
-
* @example
|
|
67
|
+
* @example Streaming
|
|
52
68
|
* ```typescript
|
|
53
|
-
* const
|
|
69
|
+
* for await (const chunk of provider.streamChat({
|
|
54
70
|
* model: 'claude-3-5-sonnet-20241022',
|
|
55
|
-
* messages: [
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* });
|
|
71
|
+
* messages: [{ role: 'user', content: 'Write a story', timestamp: new Date() }]
|
|
72
|
+
* })) {
|
|
73
|
+
* process.stdout.write(chunk.content);
|
|
74
|
+
* }
|
|
60
75
|
* ```
|
|
61
76
|
*/
|
|
62
77
|
export declare class AnthropicProvider implements LLMProvider {
|
|
63
78
|
readonly name = "anthropic";
|
|
64
79
|
readonly models: string[];
|
|
65
80
|
private client;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
baseURL?: string;
|
|
69
|
-
});
|
|
81
|
+
private pricing;
|
|
82
|
+
constructor(config: AnthropicConfig);
|
|
70
83
|
chat(params: ChatParams): Promise<ChatResponse>;
|
|
71
84
|
streamChat(params: ChatParams): AsyncIterable<ChatChunk>;
|
|
72
85
|
embeddings(_params: EmbeddingParams): Promise<EmbeddingResponse>;
|
|
73
86
|
/**
|
|
74
|
-
* Calculates the cost of a chat completion based on token usage
|
|
87
|
+
* Calculates the cost of a chat completion based on token usage.
|
|
88
|
+
* Returns 0 if no pricing information is available for the model.
|
|
75
89
|
*
|
|
76
90
|
* @param model - The model used
|
|
77
91
|
* @param usage - Token usage information
|
|
78
|
-
* @returns Cost in USD
|
|
92
|
+
* @returns Cost in USD, or 0 if pricing not configured
|
|
79
93
|
*/
|
|
80
94
|
calculateCost(model: string, usage: TokenUsage): number;
|
|
81
95
|
private convertMessages;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnthropicProvider.d.ts","sourceRoot":"","sources":["../src/AnthropicProvider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,SAAS,EACT,eAAe,EACf,iBAAiB,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAgB,UAAU,EAAY,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"AnthropicProvider.d.ts","sourceRoot":"","sources":["../src/AnthropicProvider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,U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|
|
|
1
1
|
import Anthropic from '@anthropic-ai/sdk';
|
|
2
|
-
/**
|
|
3
|
-
* Pricing per 1M tokens for Anthropic models (as of 2025)
|
|
4
|
-
*/
|
|
5
|
-
const MODEL_PRICING = {
|
|
6
|
-
'claude-3-opus-20240229': { input: 15.0, output: 75.0 },
|
|
7
|
-
'claude-3-sonnet-20240229': { input: 3.0, output: 15.0 },
|
|
8
|
-
'claude-3-haiku-20240307': { input: 0.25, output: 1.25 },
|
|
9
|
-
'claude-3-5-sonnet-20241022': { input: 3.0, output: 15.0 },
|
|
10
|
-
};
|
|
11
2
|
/**
|
|
12
3
|
* Anthropic provider implementation for Stratix AI Agents.
|
|
13
4
|
*
|
|
5
|
+
* Requires explicit model configuration - no defaults provided.
|
|
14
6
|
* Supports Claude 3 models (Opus, Sonnet, Haiku) with tool use and streaming.
|
|
15
7
|
* Note: Anthropic does not support embeddings.
|
|
16
8
|
*
|
|
17
|
-
* @example
|
|
9
|
+
* @example Using predefined model constants
|
|
18
10
|
* ```typescript
|
|
11
|
+
* import { AnthropicProvider } from '@stratix/ai-anthropic';
|
|
12
|
+
*
|
|
19
13
|
* const provider = new AnthropicProvider({
|
|
20
|
-
* apiKey: process.env.ANTHROPIC_API_KEY
|
|
14
|
+
* apiKey: process.env.ANTHROPIC_API_KEY!,
|
|
15
|
+
* models: [
|
|
16
|
+
* { name: 'claude-sonnet-4-5-20250929', pricing: { input: 3.0, output: 15.0 } },
|
|
17
|
+
* { name: 'claude-opus-4-5-20251101', pricing: { input: 5.0, output: 25.0 } }
|
|
18
|
+
* ]
|
|
21
19
|
* });
|
|
22
20
|
*
|
|
23
21
|
* const response = await provider.chat({
|
|
24
|
-
* model: 'claude-
|
|
25
|
-
* messages: [
|
|
26
|
-
* { role: 'user', content: 'Hello!', timestamp: new Date() }
|
|
27
|
-
* ],
|
|
28
|
-
* temperature: 0.7
|
|
22
|
+
* model: 'claude-sonnet-4-5-20250929',
|
|
23
|
+
* messages: [{ role: 'user', content: 'Hello!', timestamp: new Date() }]
|
|
29
24
|
* });
|
|
30
25
|
* ```
|
|
31
26
|
*
|
|
32
|
-
* @example
|
|
27
|
+
* @example Custom models with updated pricing
|
|
33
28
|
* ```typescript
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* }
|
|
38
|
-
*
|
|
39
|
-
*
|
|
29
|
+
* const provider = new AnthropicProvider({
|
|
30
|
+
* apiKey: process.env.ANTHROPIC_API_KEY!,
|
|
31
|
+
* models: [
|
|
32
|
+
* { name: 'claude-sonnet-4-5-20250929', pricing: { input: 3.5, output: 17.5 } },
|
|
33
|
+
* { name: 'claude-opus-4-5-20251101', pricing: { input: 25.0, output: 125.0 } }
|
|
34
|
+
* ]
|
|
35
|
+
* });
|
|
40
36
|
* ```
|
|
41
37
|
*
|
|
42
|
-
* @example
|
|
38
|
+
* @example Without pricing (calculateCost returns 0)
|
|
43
39
|
* ```typescript
|
|
44
|
-
* const
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* description: 'Get weather for a location',
|
|
50
|
-
* parameters: {
|
|
51
|
-
* type: 'object',
|
|
52
|
-
* properties: { city: { type: 'string' } },
|
|
53
|
-
* required: ['city']
|
|
54
|
-
* }
|
|
55
|
-
* }]
|
|
40
|
+
* const provider = new AnthropicProvider({
|
|
41
|
+
* apiKey: process.env.ANTHROPIC_API_KEY!,
|
|
42
|
+
* models: [
|
|
43
|
+
* { name: 'claude-sonnet-4-5-20250929' }
|
|
44
|
+
* ]
|
|
56
45
|
* });
|
|
57
46
|
* ```
|
|
58
47
|
*
|
|
59
|
-
* @example
|
|
48
|
+
* @example Streaming
|
|
60
49
|
* ```typescript
|
|
61
|
-
* const
|
|
50
|
+
* for await (const chunk of provider.streamChat({
|
|
62
51
|
* model: 'claude-3-5-sonnet-20241022',
|
|
63
|
-
* messages: [
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* });
|
|
52
|
+
* messages: [{ role: 'user', content: 'Write a story', timestamp: new Date() }]
|
|
53
|
+
* })) {
|
|
54
|
+
* process.stdout.write(chunk.content);
|
|
55
|
+
* }
|
|
68
56
|
* ```
|
|
69
57
|
*/
|
|
70
58
|
export class AnthropicProvider {
|
|
71
59
|
name = 'anthropic';
|
|
72
|
-
models
|
|
73
|
-
'claude-3-opus-20240229',
|
|
74
|
-
'claude-3-sonnet-20240229',
|
|
75
|
-
'claude-3-haiku-20240307',
|
|
76
|
-
'claude-3-5-sonnet-20241022',
|
|
77
|
-
];
|
|
60
|
+
models;
|
|
78
61
|
client;
|
|
62
|
+
pricing;
|
|
79
63
|
constructor(config) {
|
|
64
|
+
if (!config.models || config.models.length === 0) {
|
|
65
|
+
throw new Error('AnthropicProvider requires at least one model to be configured');
|
|
66
|
+
}
|
|
67
|
+
this.models = config.models.map((m) => m.name);
|
|
68
|
+
this.pricing = new Map(config.models
|
|
69
|
+
.filter((m) => m.pricing !== undefined)
|
|
70
|
+
.map((m) => [m.name, m.pricing]));
|
|
80
71
|
this.client = new Anthropic({
|
|
81
72
|
apiKey: config.apiKey,
|
|
82
73
|
baseURL: config.baseURL,
|
|
@@ -157,16 +148,16 @@ export class AnthropicProvider {
|
|
|
157
148
|
return Promise.reject(new Error('Anthropic does not support embeddings. Use OpenAI or another provider for embeddings.'));
|
|
158
149
|
}
|
|
159
150
|
/**
|
|
160
|
-
* Calculates the cost of a chat completion based on token usage
|
|
151
|
+
* Calculates the cost of a chat completion based on token usage.
|
|
152
|
+
* Returns 0 if no pricing information is available for the model.
|
|
161
153
|
*
|
|
162
154
|
* @param model - The model used
|
|
163
155
|
* @param usage - Token usage information
|
|
164
|
-
* @returns Cost in USD
|
|
156
|
+
* @returns Cost in USD, or 0 if pricing not configured
|
|
165
157
|
*/
|
|
166
158
|
calculateCost(model, usage) {
|
|
167
|
-
const pricing =
|
|
159
|
+
const pricing = this.pricing.get(model);
|
|
168
160
|
if (!pricing) {
|
|
169
|
-
console.warn(`No pricing information for model: ${model}`);
|
|
170
161
|
return 0;
|
|
171
162
|
}
|
|
172
163
|
const inputCost = (usage.promptTokens / 1_000_000) * pricing.input;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnthropicProvider.js","sourceRoot":"","sources":["../src/AnthropicProvider.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"AnthropicProvider.js","sourceRoot":"","sources":["../src/AnthropicProvider.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAgC1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAM,OAAO,iBAAiB;IACnB,IAAI,GAAG,WAAW,CAAC;IACnB,MAAM,CAAW;IAElB,MAAM,CAAY;IAClB,OAAO,CAAiD;IAEhE,YAAY,MAAuB;QACjC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACjD,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;QACpF,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,CACpB,MAAM,CAAC,MAAM;aACV,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,SAAS,CAAC;aACtC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAQ,CAAC,CAAC,CACpC,CAAC;QAEF,IAAI,CAAC,MAAM,GAAG,IAAI,SAAS,CAAC;YAC1B,MAAM,EAAE,MAAM,CAAC,MAA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AAG,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM;YACrD,OAAO,EAAE,GAAG,CAAC,OAAO;SACrB,CAAC,CAAC,CAAC;QAEJ,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IACjD,CAAC;IAEO,YAAY,CAClB,KAAwF;IACxF,8DAA8D;;QAE9D,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC1B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,YAAY,EAAE,IAAI,CAAC,UAAU;SAC9B,CAAC,CAAC,CAAC;IACN,CAAC;IAEO,aAAa,CACnB,MAAqB;QAErB,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,UAAU;gBACb,OAAO,MAAM,CAAC;YAChB,KAAK,YAAY;gBACf,OAAO,QAAQ,CAAC;YAClB,KAAK,UAAU;gBACb,OAAO,YAAY,CAAC;YACtB,KAAK,eAAe;gBAClB,OAAO,MAAM,CAAC;YAChB;gBACE,OAAO,MAAM,CAAC;QAClB,CAAC;IACH,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
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,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stratix/ai-anthropic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Stratix AI Agents - Anthropic Provider",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@anthropic-ai/sdk": "^0.35.0",
|
|
42
|
-
"@stratix/core": "^0.
|
|
42
|
+
"@stratix/core": "^0.8.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^20.0.0",
|