@ax-llm/ax 11.0.13 → 11.0.14

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/index.cjs CHANGED
@@ -4826,12 +4826,12 @@ var AxProgram = class {
4826
4826
 
4827
4827
  // dsp/prompt.ts
4828
4828
  var functionCallInstructions = `
4829
- ### Function Call Instructions
4829
+ ## Function Call Instructions
4830
4830
  - Complete the task, using the functions defined earlier in this prompt.
4831
4831
  - Call functions step-by-step, using the output of one function as input to the next.
4832
4832
  - Use the function results to generate the output fields.`;
4833
4833
  var formattingRules = `
4834
- ### Output Formatting Rules
4834
+ ## Output Formatting Rules
4835
4835
  - Output must strictly follow the defined plain-text \`key: value\` field format.
4836
4836
  - Each output key, value must strictly adhere to the specified output field formatting rules.
4837
4837
  - No preamble, postscript, or supplementary information.
@@ -4857,14 +4857,14 @@ var AxPromptTemplate = class {
4857
4857
  (fn) => `- \`${fn.name}\`: ${capitalizeFirstLetter(fn.description)}.`
4858
4858
  ).join("\n");
4859
4859
  if (funcList && funcList.length > 0) {
4860
- task.push(`### Available Functions
4860
+ task.push(`## Available Functions
4861
4861
  ${funcList}`);
4862
4862
  }
4863
4863
  const inputFields = this.renderFields(this.sig.getInputFields());
4864
- task.push(`### Input Fields
4864
+ task.push(`## Input Fields
4865
4865
  ${inputFields}`);
4866
4866
  const outputFields = this.renderFields(this.sig.getOutputFields());
4867
- task.push(`### Output Fields
4867
+ task.push(`## Output Fields
4868
4868
  ${outputFields}`);
4869
4869
  if (funcList && funcList.length > 0) {
4870
4870
  task.push(functionCallInstructions.trim());
@@ -5220,8 +5220,8 @@ var ValidationError = class extends Error {
5220
5220
  getFixingInstructions = () => {
5221
5221
  return this.fields.map((field) => ({
5222
5222
  name: "outputError",
5223
- title: "Errors In Output Fields",
5224
- description: `Please fix and return the field \`${field.title}\` of type \`${toFieldType(field.type)}\`, ${this.message}.`
5223
+ title: "Output Correction Required",
5224
+ description: `The section labeled '${field.title}' either was not generated by the LLM or does not match the expected format of '${toFieldType(field.type)}'. ${this.message} Please revise your response to ensure it conforms to the specified format.`
5225
5225
  }));
5226
5226
  };
5227
5227
  };
@@ -5818,7 +5818,7 @@ var AxGen = class extends AxProgramWithSignature {
5818
5818
  mem,
5819
5819
  options
5820
5820
  }) {
5821
- const { sessionId, traceId, model, functions } = options ?? {};
5821
+ const { sessionId, traceId, model, functions, earlyFail } = options ?? {};
5822
5822
  const usageInfo = {
5823
5823
  ai: ai.getName(),
5824
5824
  model: ai.getModelInfo().name
@@ -5837,7 +5837,8 @@ var AxGen = class extends AxProgramWithSignature {
5837
5837
  mem,
5838
5838
  traceId,
5839
5839
  sessionId,
5840
- functions
5840
+ functions,
5841
+ earlyFail
5841
5842
  });
5842
5843
  } else {
5843
5844
  yield await this.processResponse({
@@ -5860,9 +5861,10 @@ var AxGen = class extends AxProgramWithSignature {
5860
5861
  mem,
5861
5862
  sessionId,
5862
5863
  traceId,
5863
- functions
5864
+ functions,
5865
+ earlyFail
5864
5866
  }) {
5865
- const streamingValidation = ai.getFeatures().functionCot !== true;
5867
+ const streamingValidation = earlyFail ?? ai.getFeatures().functionCot !== true;
5866
5868
  const functionCalls = [];
5867
5869
  const values = {};
5868
5870
  const xstate = {