@stratix/ai-anthropic 0.4.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/LICENSE +21 -0
- package/README.md +151 -0
- package/dist/AnthropicProvider.d.ts +46 -0
- package/dist/AnthropicProvider.d.ts.map +1 -0
- package/dist/AnthropicProvider.js +171 -0
- package/dist/AnthropicProvider.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 P. Andrés Carvajal
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# @stratix/ai-anthropic
|
|
2
|
+
|
|
3
|
+
Anthropic Claude LLM provider for Stratix AI agents.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @stratix/ai-anthropic
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- Support for Claude 3 Opus, Sonnet, Haiku, and Claude 3.5 Sonnet
|
|
14
|
+
- Tool use (function calling) support
|
|
15
|
+
- Streaming responses
|
|
16
|
+
- Automatic cost calculation based on token usage
|
|
17
|
+
- System message support
|
|
18
|
+
- Proper message role handling (system messages separated from conversation)
|
|
19
|
+
|
|
20
|
+
## Supported Models
|
|
21
|
+
|
|
22
|
+
- `claude-3-5-sonnet-20241022` - Latest Claude 3.5 Sonnet (most capable)
|
|
23
|
+
- `claude-3-opus-20240229` - Claude 3 Opus (highest intelligence)
|
|
24
|
+
- `claude-3-sonnet-20240229` - Claude 3 Sonnet (balanced performance)
|
|
25
|
+
- `claude-3-haiku-20240307` - Claude 3 Haiku (fastest and most cost-effective)
|
|
26
|
+
|
|
27
|
+
## Quick Example
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { AnthropicProvider } from '@stratix/ai-anthropic';
|
|
31
|
+
|
|
32
|
+
const provider = new AnthropicProvider({
|
|
33
|
+
apiKey: process.env.ANTHROPIC_API_KEY!,
|
|
34
|
+
baseURL: 'https://api.anthropic.com', // Optional
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Chat completion
|
|
38
|
+
const response = await provider.chat({
|
|
39
|
+
model: 'claude-3-5-sonnet-20241022',
|
|
40
|
+
messages: [
|
|
41
|
+
{ role: 'system', content: 'You are a helpful assistant.', timestamp: new Date() },
|
|
42
|
+
{ role: 'user', content: 'Hello!', timestamp: new Date() }
|
|
43
|
+
],
|
|
44
|
+
temperature: 0.7,
|
|
45
|
+
maxTokens: 1024
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
console.log(response.content);
|
|
49
|
+
console.log('Cost:', provider.calculateCost('claude-3-5-sonnet-20241022', response.usage));
|
|
50
|
+
|
|
51
|
+
// Streaming chat
|
|
52
|
+
for await (const chunk of provider.streamChat({
|
|
53
|
+
model: 'claude-3-5-sonnet-20241022',
|
|
54
|
+
messages: [
|
|
55
|
+
{ role: 'user', content: 'Tell me a story', timestamp: new Date() }
|
|
56
|
+
]
|
|
57
|
+
})) {
|
|
58
|
+
process.stdout.write(chunk.content);
|
|
59
|
+
if (chunk.isComplete) {
|
|
60
|
+
console.log('\nStream completed');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Tool Use (Function Calling)
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
const response = await provider.chat({
|
|
69
|
+
model: 'claude-3-5-sonnet-20241022',
|
|
70
|
+
messages: [
|
|
71
|
+
{ role: 'user', content: 'What is the weather in NYC?', timestamp: new Date() }
|
|
72
|
+
],
|
|
73
|
+
tools: [
|
|
74
|
+
{
|
|
75
|
+
name: 'get_weather',
|
|
76
|
+
description: 'Get the current weather in a location',
|
|
77
|
+
parameters: {
|
|
78
|
+
type: 'object',
|
|
79
|
+
properties: {
|
|
80
|
+
location: { type: 'string', description: 'The city name' }
|
|
81
|
+
},
|
|
82
|
+
required: ['location']
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
if (response.toolCalls) {
|
|
89
|
+
console.log('Tool call:', response.toolCalls[0].name);
|
|
90
|
+
console.log('Arguments:', response.toolCalls[0].arguments);
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## System Messages
|
|
95
|
+
|
|
96
|
+
The provider automatically handles system messages correctly:
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
const response = await provider.chat({
|
|
100
|
+
model: 'claude-3-5-sonnet-20241022',
|
|
101
|
+
messages: [
|
|
102
|
+
{ role: 'system', content: 'You are an expert in TypeScript.', timestamp: new Date() },
|
|
103
|
+
{ role: 'system', content: 'Always provide code examples.', timestamp: new Date() },
|
|
104
|
+
{ role: 'user', content: 'How do I create a class?', timestamp: new Date() }
|
|
105
|
+
]
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// System messages are automatically combined and sent as the system parameter
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Configuration
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
interface AnthropicProviderConfig {
|
|
115
|
+
apiKey: string; // Required: Anthropic API key
|
|
116
|
+
baseURL?: string; // Optional: Custom API base URL
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Cost Calculation
|
|
121
|
+
|
|
122
|
+
The provider automatically tracks token usage and can calculate costs:
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
const response = await provider.chat({...});
|
|
126
|
+
|
|
127
|
+
const cost = provider.calculateCost('claude-3-5-sonnet-20241022', response.usage);
|
|
128
|
+
console.log(`Cost: $${cost.toFixed(4)}`);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Pricing is based on 2025 rates and included in the provider.
|
|
132
|
+
|
|
133
|
+
## Embeddings
|
|
134
|
+
|
|
135
|
+
Note: Anthropic does not provide embedding models. The `embeddings()` method will throw an error. Use OpenAI or another provider for embeddings:
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
try {
|
|
139
|
+
await provider.embeddings({...});
|
|
140
|
+
} catch (error) {
|
|
141
|
+
console.error('Anthropic does not support embeddings');
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Exports
|
|
146
|
+
|
|
147
|
+
- `AnthropicProvider` - Main provider class implementing `LLMProvider` interface
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
MIT
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { LLMProvider, ChatParams, ChatResponse, ChatChunk, EmbeddingParams, EmbeddingResponse } from '@stratix/core';
|
|
2
|
+
import type { TokenUsage } from '@stratix/core';
|
|
3
|
+
/**
|
|
4
|
+
* Anthropic provider implementation for Stratix AI Agents.
|
|
5
|
+
*
|
|
6
|
+
* Supports Claude 3 models (Opus, Sonnet, Haiku) with tool use.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const provider = new AnthropicProvider({
|
|
11
|
+
* apiKey: process.env.ANTHROPIC_API_KEY!
|
|
12
|
+
* });
|
|
13
|
+
*
|
|
14
|
+
* const response = await provider.chat({
|
|
15
|
+
* model: 'claude-3-sonnet-20240229',
|
|
16
|
+
* messages: [
|
|
17
|
+
* { role: 'user', content: 'Hello!', timestamp: new Date() }
|
|
18
|
+
* ],
|
|
19
|
+
* temperature: 0.7
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class AnthropicProvider implements LLMProvider {
|
|
24
|
+
readonly name = "anthropic";
|
|
25
|
+
readonly models: string[];
|
|
26
|
+
private client;
|
|
27
|
+
constructor(config: {
|
|
28
|
+
apiKey: string;
|
|
29
|
+
baseURL?: string;
|
|
30
|
+
});
|
|
31
|
+
chat(params: ChatParams): Promise<ChatResponse>;
|
|
32
|
+
streamChat(params: ChatParams): AsyncIterable<ChatChunk>;
|
|
33
|
+
embeddings(_params: EmbeddingParams): Promise<EmbeddingResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* Calculates the cost of a chat completion based on token usage
|
|
36
|
+
*
|
|
37
|
+
* @param model - The model used
|
|
38
|
+
* @param usage - Token usage information
|
|
39
|
+
* @returns Cost in USD
|
|
40
|
+
*/
|
|
41
|
+
calculateCost(model: string, usage: TokenUsage): number;
|
|
42
|
+
private convertMessages;
|
|
43
|
+
private convertTools;
|
|
44
|
+
private mapStopReason;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=AnthropicProvider.d.ts.map
|
|
@@ -0,0 +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;AAYxE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,iBAAkB,YAAW,WAAW;IACnD,QAAQ,CAAC,IAAI,eAAe;IAC5B,QAAQ,CAAC,MAAM,WAKb;IAEF,OAAO,CAAC,MAAM,CAAY;gBAEd,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAOlD,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;IAyC9C,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC;IAqC/D,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQhE;;;;;;OAMG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM;IAavD,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,aAAa;CAgBtB"}
|
|
@@ -0,0 +1,171 @@
|
|
|
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
|
+
/**
|
|
12
|
+
* Anthropic provider implementation for Stratix AI Agents.
|
|
13
|
+
*
|
|
14
|
+
* Supports Claude 3 models (Opus, Sonnet, Haiku) with tool use.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const provider = new AnthropicProvider({
|
|
19
|
+
* apiKey: process.env.ANTHROPIC_API_KEY!
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* const response = await provider.chat({
|
|
23
|
+
* model: 'claude-3-sonnet-20240229',
|
|
24
|
+
* messages: [
|
|
25
|
+
* { role: 'user', content: 'Hello!', timestamp: new Date() }
|
|
26
|
+
* ],
|
|
27
|
+
* temperature: 0.7
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export class AnthropicProvider {
|
|
32
|
+
name = 'anthropic';
|
|
33
|
+
models = [
|
|
34
|
+
'claude-3-opus-20240229',
|
|
35
|
+
'claude-3-sonnet-20240229',
|
|
36
|
+
'claude-3-haiku-20240307',
|
|
37
|
+
'claude-3-5-sonnet-20241022',
|
|
38
|
+
];
|
|
39
|
+
client;
|
|
40
|
+
constructor(config) {
|
|
41
|
+
this.client = new Anthropic({
|
|
42
|
+
apiKey: config.apiKey,
|
|
43
|
+
baseURL: config.baseURL,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
async chat(params) {
|
|
47
|
+
const { system, messages } = this.convertMessages(params.messages);
|
|
48
|
+
const response = await this.client.messages.create({
|
|
49
|
+
model: params.model,
|
|
50
|
+
max_tokens: params.maxTokens || 4096,
|
|
51
|
+
temperature: params.temperature ?? 0.7,
|
|
52
|
+
system,
|
|
53
|
+
messages,
|
|
54
|
+
tools: params.tools ? this.convertTools(params.tools) : undefined,
|
|
55
|
+
});
|
|
56
|
+
let content = '';
|
|
57
|
+
let toolCalls;
|
|
58
|
+
for (const block of response.content) {
|
|
59
|
+
if (block.type === 'text') {
|
|
60
|
+
content += block.text;
|
|
61
|
+
}
|
|
62
|
+
else if (block.type === 'tool_use') {
|
|
63
|
+
if (!toolCalls)
|
|
64
|
+
toolCalls = [];
|
|
65
|
+
toolCalls.push({
|
|
66
|
+
name: block.name,
|
|
67
|
+
arguments: block.input,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const usage = {
|
|
72
|
+
promptTokens: response.usage.input_tokens,
|
|
73
|
+
completionTokens: response.usage.output_tokens,
|
|
74
|
+
totalTokens: response.usage.input_tokens + response.usage.output_tokens,
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
content,
|
|
78
|
+
toolCalls,
|
|
79
|
+
usage,
|
|
80
|
+
finishReason: this.mapStopReason(response.stop_reason),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
async *streamChat(params) {
|
|
84
|
+
const { system, messages } = this.convertMessages(params.messages);
|
|
85
|
+
const stream = this.client.messages.stream({
|
|
86
|
+
model: params.model,
|
|
87
|
+
max_tokens: params.maxTokens || 4096,
|
|
88
|
+
temperature: params.temperature ?? 0.7,
|
|
89
|
+
system,
|
|
90
|
+
messages,
|
|
91
|
+
tools: params.tools ? this.convertTools(params.tools) : undefined,
|
|
92
|
+
});
|
|
93
|
+
for await (const chunk of stream) {
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment
|
|
95
|
+
const anyChunk = chunk;
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
97
|
+
if (
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
99
|
+
anyChunk.type === 'content_block_delta' &&
|
|
100
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
101
|
+
anyChunk.delta?.type === 'text_delta') {
|
|
102
|
+
yield {
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
104
|
+
content: anyChunk.delta.text,
|
|
105
|
+
isComplete: false,
|
|
106
|
+
};
|
|
107
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
108
|
+
}
|
|
109
|
+
else if (anyChunk.type === 'message_stop') {
|
|
110
|
+
yield {
|
|
111
|
+
content: '',
|
|
112
|
+
isComplete: true,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
embeddings(_params) {
|
|
118
|
+
return Promise.reject(new Error('Anthropic does not support embeddings. Use OpenAI or another provider for embeddings.'));
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Calculates the cost of a chat completion based on token usage
|
|
122
|
+
*
|
|
123
|
+
* @param model - The model used
|
|
124
|
+
* @param usage - Token usage information
|
|
125
|
+
* @returns Cost in USD
|
|
126
|
+
*/
|
|
127
|
+
calculateCost(model, usage) {
|
|
128
|
+
const pricing = MODEL_PRICING[model];
|
|
129
|
+
if (!pricing) {
|
|
130
|
+
console.warn(`No pricing information for model: ${model}`);
|
|
131
|
+
return 0;
|
|
132
|
+
}
|
|
133
|
+
const inputCost = (usage.promptTokens / 1_000_000) * pricing.input;
|
|
134
|
+
const outputCost = (usage.completionTokens / 1_000_000) * pricing.output;
|
|
135
|
+
return inputCost + outputCost;
|
|
136
|
+
}
|
|
137
|
+
convertMessages(messages) {
|
|
138
|
+
const systemMessages = messages.filter((m) => m.role === 'system');
|
|
139
|
+
const conversationMessages = messages.filter((m) => m.role !== 'system');
|
|
140
|
+
const system = systemMessages.length > 0 ? systemMessages.map((m) => m.content).join('\n\n') : undefined;
|
|
141
|
+
const anthropicMessages = conversationMessages.map((msg) => ({
|
|
142
|
+
role: msg.role === 'assistant' ? 'assistant' : 'user',
|
|
143
|
+
content: msg.content,
|
|
144
|
+
}));
|
|
145
|
+
return { system, messages: anthropicMessages };
|
|
146
|
+
}
|
|
147
|
+
convertTools(tools
|
|
148
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
149
|
+
) {
|
|
150
|
+
return tools.map((tool) => ({
|
|
151
|
+
name: tool.name,
|
|
152
|
+
description: tool.description,
|
|
153
|
+
input_schema: tool.parameters,
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
mapStopReason(reason) {
|
|
157
|
+
switch (reason) {
|
|
158
|
+
case 'end_turn':
|
|
159
|
+
return 'stop';
|
|
160
|
+
case 'max_tokens':
|
|
161
|
+
return 'length';
|
|
162
|
+
case 'tool_use':
|
|
163
|
+
return 'tool_calls';
|
|
164
|
+
case 'stop_sequence':
|
|
165
|
+
return 'stop';
|
|
166
|
+
default:
|
|
167
|
+
return 'stop';
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=AnthropicProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnthropicProvider.js","sourceRoot":"","sources":["../src/AnthropicProvider.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAW1C;;GAEG;AACH,MAAM,aAAa,GAAG;IACpB,wBAAwB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;IACvD,0BAA0B,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;IACxD,yBAAyB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;IACxD,4BAA4B,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;CAC3D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,iBAAiB;IACnB,IAAI,GAAG,WAAW,CAAC;IACnB,MAAM,GAAG;QAChB,wBAAwB;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CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAE5F,MAAM,iBAAiB,GAA6B,oBAAoB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACrF,IAAI,EAAE,GAAG,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
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stratix/ai-anthropic",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Stratix AI Agents - Anthropic Provider",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"keywords": [
|
|
18
|
+
"ai",
|
|
19
|
+
"anthropic",
|
|
20
|
+
"claude",
|
|
21
|
+
"claude-ai",
|
|
22
|
+
"llm",
|
|
23
|
+
"provider",
|
|
24
|
+
"ai-agents",
|
|
25
|
+
"typescript"
|
|
26
|
+
],
|
|
27
|
+
"author": "P. Andrés Carvajal <causticrez@gmail.com>",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@anthropic-ai/sdk": "^0.35.0",
|
|
34
|
+
"@stratix/core": "0.4.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^20.0.0",
|
|
38
|
+
"eslint": "^8.0.0",
|
|
39
|
+
"typescript": "^5.3.0",
|
|
40
|
+
"vitest": "^1.0.0"
|
|
41
|
+
},
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "https://github.com/stratix-dev/stratix.git",
|
|
45
|
+
"directory": "packages/plugins/ai/anthropic"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://github.com/stratix-dev/stratix#readme",
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/stratix-dev/stratix/issues"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=18.0.0"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "tsc",
|
|
56
|
+
"test": "vitest run",
|
|
57
|
+
"test:watch": "vitest",
|
|
58
|
+
"typecheck": "tsc --noEmit",
|
|
59
|
+
"lint": "eslint src --ignore-pattern '**/*.test.ts' --ignore-pattern '**/__tests__/**'",
|
|
60
|
+
"clean": "rm -rf dist"
|
|
61
|
+
}
|
|
62
|
+
}
|