@arcote.tech/arc-ai-claude 0.7.12 → 0.7.13
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/package.json +2 -2
- package/src/index.ts +14 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcote.tech/arc-ai-claude",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.13",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Claude (Anthropic) adapter for Arc AI framework",
|
|
7
7
|
"main": "./src/index.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type-check": "tsc --noEmit"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"@arcote.tech/arc-ai": "^0.7.
|
|
13
|
+
"@arcote.tech/arc-ai": "^0.7.13",
|
|
14
14
|
"typescript": "^5.0.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
package/src/index.ts
CHANGED
|
@@ -22,6 +22,18 @@ export interface ClaudeConfig {
|
|
|
22
22
|
export function claude(config: ClaudeConfig): LLMProvider {
|
|
23
23
|
const apiVersion = config.apiVersion ?? "2023-06-01";
|
|
24
24
|
|
|
25
|
+
let filesWarned = false;
|
|
26
|
+
function warnIfFiles(request: CompletionRequest): void {
|
|
27
|
+
if (!request.files || request.files.length === 0) return;
|
|
28
|
+
if (filesWarned) return;
|
|
29
|
+
filesWarned = true;
|
|
30
|
+
console.warn(
|
|
31
|
+
"[arc-ai-claude] request.files is set but Claude adapter does not yet " +
|
|
32
|
+
"support file attachments — pliki będą zignorowane. Użyj OpenAI " +
|
|
33
|
+
"providera dla flow który wymaga file context.",
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
25
37
|
function translateTools(
|
|
26
38
|
tools: CompletionRequest["tools"],
|
|
27
39
|
): unknown[] | undefined {
|
|
@@ -126,6 +138,7 @@ export function claude(config: ClaudeConfig): LLMProvider {
|
|
|
126
138
|
async function complete(
|
|
127
139
|
request: CompletionRequest,
|
|
128
140
|
): Promise<CompletionResult> {
|
|
141
|
+
warnIfFiles(request);
|
|
129
142
|
const body = buildBody(request, false);
|
|
130
143
|
|
|
131
144
|
const response = await fetch("https://api.anthropic.com/v1/messages", {
|
|
@@ -179,6 +192,7 @@ export function claude(config: ClaudeConfig): LLMProvider {
|
|
|
179
192
|
request: CompletionRequest,
|
|
180
193
|
onChunk: (chunk: StreamChunk) => void,
|
|
181
194
|
): Promise<CompletionResult> {
|
|
195
|
+
warnIfFiles(request);
|
|
182
196
|
const body = buildBody(request, true);
|
|
183
197
|
|
|
184
198
|
const response = await fetch("https://api.anthropic.com/v1/messages", {
|