@probelabs/probe 0.6.0-rc134 → 0.6.0-rc136

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.
@@ -1613,8 +1613,7 @@ When troubleshooting:
1613
1613
  // Build appropriate reminder message based on whether schema is provided
1614
1614
  let reminderContent;
1615
1615
  if (options.schema) { // Apply for ANY schema, not just JSON schemas
1616
- // When schema is provided, AI should either use tools OR provide natural response
1617
- // Schema formatting will happen automatically afterward
1616
+ // When schema is provided, AI must use attempt_completion to trigger schema formatting
1618
1617
  reminderContent = `Please use one of the available tools to help answer the question, or use attempt_completion if you have enough information to provide a final answer.
1619
1618
 
1620
1619
  Remember: Use proper XML format with BOTH opening and closing tags:
@@ -1623,16 +1622,14 @@ Remember: Use proper XML format with BOTH opening and closing tags:
1623
1622
  <parameter>value</parameter>
1624
1623
  </tool_name>
1625
1624
 
1626
- IMPORTANT: A schema was provided for the final output format. You have two options:
1625
+ IMPORTANT: A schema was provided for the final output format.
1627
1626
 
1628
- Option 1 - Use attempt_completion with your complete answer:
1627
+ You MUST use attempt_completion to provide your answer:
1629
1628
  <attempt_completion>
1630
- [Your complete answer here - will be automatically formatted to match the schema]
1629
+ [Your complete answer here - provide in natural language, it will be automatically formatted to match the schema]
1631
1630
  </attempt_completion>
1632
1631
 
1633
- Option 2 - Provide a natural response without any tool, and it will be automatically formatted.
1634
-
1635
- Do NOT try to format your response as JSON yourself - this will be done automatically.`;
1632
+ Your response will be automatically formatted to JSON. You can provide your answer in natural language or as JSON - either will work.`;
1636
1633
  } else {
1637
1634
  // Standard reminder without schema
1638
1635
  reminderContent = `Please use one of the available tools to help answer the question, or use attempt_completion if you have enough information to provide a final answer.
@@ -1928,8 +1925,9 @@ Convert your previous response content into actual JSON data that follows this s
1928
1925
  }
1929
1926
  } else if (reachedMaxIterations && options.schema && this.debug) {
1930
1927
  console.log('[DEBUG] Skipping schema formatting due to max iterations reached without completion');
1931
- } else if (completionAttempted && options.schema && !options._schemaFormatted) {
1928
+ } else if (completionAttempted && options.schema && !options._schemaFormatted && !options._skipValidation) {
1932
1929
  // For attempt_completion results with schema, still clean markdown if needed
1930
+ // Skip this validation if we're in a recursive correction call (_skipValidation flag)
1933
1931
  try {
1934
1932
  finalResult = cleanSchemaResponse(finalResult);
1935
1933
 
@@ -1995,9 +1993,10 @@ Convert your previous response content into actual JSON data that follows this s
1995
1993
  0
1996
1994
  );
1997
1995
 
1998
- finalResult = await this.answer(schemaDefinitionPrompt, [], {
1999
- ...options,
2000
- _schemaFormatted: true
1996
+ finalResult = await this.answer(schemaDefinitionPrompt, [], {
1997
+ ...options,
1998
+ _schemaFormatted: true,
1999
+ _skipValidation: true // Skip validation in recursive correction calls to prevent loops
2001
2000
  });
2002
2001
  finalResult = cleanSchemaResponse(finalResult);
2003
2002
  validation = validateJsonResponse(finalResult);
@@ -2040,9 +2039,10 @@ Convert your previous response content into actual JSON data that follows this s
2040
2039
  );
2041
2040
  }
2042
2041
 
2043
- finalResult = await this.answer(correctionPrompt, [], {
2044
- ...options,
2045
- _schemaFormatted: true
2042
+ finalResult = await this.answer(correctionPrompt, [], {
2043
+ ...options,
2044
+ _schemaFormatted: true,
2045
+ _skipValidation: true // Skip validation in recursive correction calls to prevent loops
2046
2046
  });
2047
2047
  finalResult = cleanSchemaResponse(finalResult);
2048
2048