@metorial/anthropic 1.0.0-rc.5 → 1.0.0-rc.6

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.
Files changed (2) hide show
  1. package/README.md +68 -0
  2. package/package.json +6 -6
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # @metorial/anthropic
2
+
3
+ Anthropic provider integration for Metorial - enables using Metorial tools with Anthropic's NLP models.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @metorial/anthropic
9
+ # or
10
+ yarn add @metorial/anthropic
11
+ # or
12
+ pnpm add @metorial/anthropic
13
+ # or
14
+ bun add @metorial/anthropic
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```typescript
20
+ import { metorialAnthropic } from '@metorial/anthropic';
21
+ import { Metorial } from 'metorial';
22
+ import OpenAI from 'openai';
23
+
24
+ let metorial = new Metorial({
25
+ apiKey: 'your-metorial-api-key'
26
+ });
27
+
28
+ let anthropic = new OpenAI({
29
+ apiKey: 'your-anthropic-api-key',
30
+ baseURL: 'https://api.anthropic.com/v1'
31
+ });
32
+
33
+ await metorial.withProviderSession(
34
+ metorialAnthropic,
35
+ {
36
+ serverDeployments: ['your-server-deployment-id']
37
+ },
38
+ async session => {
39
+ let messages = [
40
+ {
41
+ role: 'user',
42
+ content:
43
+ 'Summarize the README.md file of the metorial/websocket-explorer repository on GitHub?'
44
+ }
45
+ ];
46
+
47
+ let response = await anthropic.chat.completions.create({
48
+ model: 'claude-3-5-sonnet-20241022',
49
+ messages,
50
+ tools: session.tools
51
+ });
52
+
53
+ let choice = response.choices[0]!;
54
+ let toolCalls = choice.message.tool_calls;
55
+
56
+ if (toolCalls && toolCalls.length > 0) {
57
+ let toolResponses = await session.callTools(toolCalls);
58
+ console.log('Tool responses:', toolResponses);
59
+ } else {
60
+ console.log(choice.message.content);
61
+ }
62
+ }
63
+ );
64
+ ```
65
+
66
+ ## License
67
+
68
+ MIT License - see [LICENSE](../../LICENSE) file for details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metorial/anthropic",
3
- "version": "1.0.0-rc.5",
3
+ "version": "1.0.0-rc.6",
4
4
  "author": "Tobias Herber",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,11 +25,11 @@
25
25
  "dist"
26
26
  ],
27
27
  "dependencies": {
28
- "@metorial/core": "^1.0.0-rc.5",
29
- "@metorial/mcp-sdk-utils": "^1.0.0-rc.5",
30
- "@metorial/mcp-session": "^1.0.0-rc.5",
31
- "@metorial/openai-compatible": "^1.0.0-rc.5",
32
- "@metorial/sdk": "^1.0.0-rc.5"
28
+ "@metorial/core": "^1.0.0-rc.6",
29
+ "@metorial/mcp-sdk-utils": "^1.0.0-rc.6",
30
+ "@metorial/mcp-session": "^1.0.0-rc.6",
31
+ "@metorial/openai-compatible": "^1.0.0-rc.6",
32
+ "@metorial/sdk": "^1.0.0-rc.6"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@anthropic-ai/sdk": "*"