graphlit-client 1.0.20250611017 → 1.0.20250611018
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/dist/client.js +30 -30
- package/package.json +1 -1
package/dist/client.js
CHANGED
@@ -18,51 +18,43 @@ let Anthropic;
|
|
18
18
|
let GoogleGenerativeAI;
|
19
19
|
try {
|
20
20
|
OpenAI = optionalRequire("openai").default || optionalRequire("openai");
|
21
|
+
if (process.env.DEBUG_GRAPHLIT_STREAMING) {
|
22
|
+
console.log("[SDK Loading] OpenAI SDK loaded successfully");
|
23
|
+
}
|
21
24
|
}
|
22
25
|
catch (e) {
|
23
26
|
// OpenAI not installed
|
27
|
+
if (process.env.DEBUG_GRAPHLIT_STREAMING) {
|
28
|
+
console.log("[SDK Loading] OpenAI SDK not found:", e.message);
|
29
|
+
}
|
24
30
|
}
|
25
31
|
try {
|
26
32
|
Anthropic =
|
27
33
|
optionalRequire("@anthropic-ai/sdk").default ||
|
28
34
|
optionalRequire("@anthropic-ai/sdk");
|
35
|
+
if (process.env.DEBUG_GRAPHLIT_STREAMING) {
|
36
|
+
console.log("[SDK Loading] Anthropic SDK loaded successfully");
|
37
|
+
}
|
29
38
|
}
|
30
39
|
catch (e) {
|
31
40
|
// Anthropic SDK not installed
|
41
|
+
if (process.env.DEBUG_GRAPHLIT_STREAMING) {
|
42
|
+
console.log("[SDK Loading] Anthropic SDK not found:", e.message);
|
43
|
+
}
|
32
44
|
}
|
33
45
|
try {
|
34
46
|
GoogleGenerativeAI = optionalRequire("@google/generative-ai").GoogleGenerativeAI;
|
47
|
+
if (process.env.DEBUG_GRAPHLIT_STREAMING) {
|
48
|
+
console.log("[SDK Loading] Google Generative AI SDK loaded successfully");
|
49
|
+
}
|
35
50
|
}
|
36
51
|
catch (e) {
|
37
52
|
// Google Generative AI not installed
|
53
|
+
if (process.env.DEBUG_GRAPHLIT_STREAMING) {
|
54
|
+
console.log("[SDK Loading] Google Generative AI SDK not found:", e.message);
|
55
|
+
}
|
38
56
|
}
|
39
57
|
const DEFAULT_MAX_TOOL_ROUNDS = 1000;
|
40
|
-
// Provider categorization for streaming capabilities
|
41
|
-
const STREAMING_PROVIDERS = {
|
42
|
-
// Native streaming with dedicated SDKs
|
43
|
-
NATIVE: [
|
44
|
-
Types.ModelServiceTypes.OpenAi,
|
45
|
-
Types.ModelServiceTypes.Anthropic,
|
46
|
-
Types.ModelServiceTypes.Google,
|
47
|
-
],
|
48
|
-
// OpenAI-compatible streaming (use OpenAI SDK)
|
49
|
-
OPENAI_COMPATIBLE: [
|
50
|
-
Types.ModelServiceTypes.Groq,
|
51
|
-
Types.ModelServiceTypes.Cerebras,
|
52
|
-
Types.ModelServiceTypes.Mistral,
|
53
|
-
Types.ModelServiceTypes.Deepseek,
|
54
|
-
],
|
55
|
-
// May require fallback simulation
|
56
|
-
FALLBACK_CANDIDATES: [
|
57
|
-
Types.ModelServiceTypes.AzureAi,
|
58
|
-
Types.ModelServiceTypes.AzureOpenAi,
|
59
|
-
Types.ModelServiceTypes.Cohere,
|
60
|
-
Types.ModelServiceTypes.Bedrock,
|
61
|
-
Types.ModelServiceTypes.Jina,
|
62
|
-
Types.ModelServiceTypes.Replicate,
|
63
|
-
Types.ModelServiceTypes.Voyage,
|
64
|
-
],
|
65
|
-
};
|
66
58
|
// Define the Graphlit class
|
67
59
|
class Graphlit {
|
68
60
|
client;
|
@@ -1424,20 +1416,28 @@ class Graphlit {
|
|
1424
1416
|
// If we have a full specification, check its service type
|
1425
1417
|
if (specification) {
|
1426
1418
|
const serviceType = specification.serviceType;
|
1419
|
+
if (process.env.DEBUG_GRAPHLIT_STREAMING) {
|
1420
|
+
console.log("[supportsStreaming] Checking support for:", {
|
1421
|
+
serviceType,
|
1422
|
+
hasOpenAI: OpenAI !== undefined,
|
1423
|
+
hasAnthropic: Anthropic !== undefined,
|
1424
|
+
hasGoogle: GoogleGenerativeAI !== undefined,
|
1425
|
+
});
|
1426
|
+
}
|
1427
1427
|
switch (serviceType) {
|
1428
1428
|
case Types.ModelServiceTypes.OpenAi:
|
1429
|
-
return
|
1429
|
+
return OpenAI !== undefined;
|
1430
1430
|
case Types.ModelServiceTypes.Anthropic:
|
1431
|
-
return
|
1431
|
+
return Anthropic !== undefined;
|
1432
1432
|
case Types.ModelServiceTypes.Google:
|
1433
|
-
return
|
1433
|
+
return GoogleGenerativeAI !== undefined;
|
1434
1434
|
default:
|
1435
1435
|
return false;
|
1436
1436
|
}
|
1437
1437
|
}
|
1438
1438
|
// If we have no specification, check if OpenAI client is available
|
1439
1439
|
// We default to OpenAI GPT-4o if no specification provider.
|
1440
|
-
const hasOpenAI =
|
1440
|
+
const hasOpenAI = OpenAI !== undefined;
|
1441
1441
|
return hasOpenAI;
|
1442
1442
|
}
|
1443
1443
|
/**
|