graphlit-client 1.0.20250617002 → 1.0.20250620001

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.
@@ -22,7 +22,7 @@ function simplifySchemaForGroq(schema) {
22
22
  const simplified = {
23
23
  type: schema.type || "object",
24
24
  properties: {},
25
- required: schema.required || []
25
+ required: schema.required || [],
26
26
  };
27
27
  // Only keep basic properties and types
28
28
  if (schema.properties) {
@@ -1077,7 +1077,8 @@ onEvent, onComplete) {
1077
1077
  let groqTools = tools;
1078
1078
  if (tools && tools.length > 0) {
1079
1079
  // LLaMA 3.3 70B seems to have tool calling issues - disable tools for this model
1080
- if (modelName && (modelName.includes("llama-3.3") || modelName.includes("LLAMA_3_3"))) {
1080
+ if (modelName &&
1081
+ (modelName.includes("llama-3.3") || modelName.includes("LLAMA_3_3"))) {
1081
1082
  if (process.env.DEBUG_GRAPHLIT_SDK_STREAMING) {
1082
1083
  console.log(`⚠️ [Groq] Disabling tools for ${modelName} due to known compatibility issues`);
1083
1084
  }
@@ -1085,9 +1086,11 @@ onEvent, onComplete) {
1085
1086
  }
1086
1087
  else {
1087
1088
  // For other models, simplify complex schemas
1088
- groqTools = tools.map(tool => ({
1089
+ groqTools = tools.map((tool) => ({
1089
1090
  ...tool,
1090
- schema: tool.schema ? simplifySchemaForGroq(JSON.parse(tool.schema)) : tool.schema
1091
+ schema: tool.schema
1092
+ ? simplifySchemaForGroq(JSON.parse(tool.schema))
1093
+ : tool.schema,
1091
1094
  }));
1092
1095
  }
1093
1096
  }
@@ -1374,8 +1377,8 @@ onEvent, onComplete) {
1374
1377
  }
1375
1378
  // Cohere v7 expects a single message and optional chatHistory
1376
1379
  // Extract system messages for preamble and filter them out of history
1377
- const systemMessages = messages.filter(msg => msg.role === "SYSTEM");
1378
- const nonSystemMessages = messages.filter(msg => msg.role !== "SYSTEM");
1380
+ const systemMessages = messages.filter((msg) => msg.role === "SYSTEM");
1381
+ const nonSystemMessages = messages.filter((msg) => msg.role !== "SYSTEM");
1379
1382
  // Extract the last non-system message as the current message
1380
1383
  const lastMessage = nonSystemMessages[nonSystemMessages.length - 1];
1381
1384
  const chatHistory = nonSystemMessages.slice(0, -1);
@@ -1390,7 +1393,9 @@ onEvent, onComplete) {
1390
1393
  // Add system message as preamble if present
1391
1394
  if (systemMessages.length > 0) {
1392
1395
  // Combine all system messages into preamble
1393
- streamConfig.preamble = systemMessages.map(msg => msg.message).join("\n\n");
1396
+ streamConfig.preamble = systemMessages
1397
+ .map((msg) => msg.message)
1398
+ .join("\n\n");
1394
1399
  }
1395
1400
  // Add chat history if there are previous messages
1396
1401
  if (chatHistory.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphlit-client",
3
- "version": "1.0.20250617002",
3
+ "version": "1.0.20250620001",
4
4
  "description": "Graphlit API Client for TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/client.js",