@ax-llm/ax 11.0.13 → 11.0.15
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 +15 -11
- package/index.cjs.map +1 -1
- package/index.d.cts +2 -0
- package/index.d.ts +2 -0
- package/index.js +15 -11
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -4460,6 +4460,8 @@ var validateValue = (field, value) => {
|
|
|
4460
4460
|
return val instanceof Date || typeof val === "string";
|
|
4461
4461
|
case "datetime":
|
|
4462
4462
|
return val instanceof Date || typeof val === "string";
|
|
4463
|
+
case "json":
|
|
4464
|
+
return typeof val === "object" || typeof val === "string";
|
|
4463
4465
|
default:
|
|
4464
4466
|
return false;
|
|
4465
4467
|
}
|
|
@@ -4826,12 +4828,12 @@ var AxProgram = class {
|
|
|
4826
4828
|
|
|
4827
4829
|
// dsp/prompt.ts
|
|
4828
4830
|
var functionCallInstructions = `
|
|
4829
|
-
|
|
4831
|
+
## Function Call Instructions
|
|
4830
4832
|
- Complete the task, using the functions defined earlier in this prompt.
|
|
4831
4833
|
- Call functions step-by-step, using the output of one function as input to the next.
|
|
4832
4834
|
- Use the function results to generate the output fields.`;
|
|
4833
4835
|
var formattingRules = `
|
|
4834
|
-
|
|
4836
|
+
## Output Formatting Rules
|
|
4835
4837
|
- Output must strictly follow the defined plain-text \`key: value\` field format.
|
|
4836
4838
|
- Each output key, value must strictly adhere to the specified output field formatting rules.
|
|
4837
4839
|
- No preamble, postscript, or supplementary information.
|
|
@@ -4857,14 +4859,14 @@ var AxPromptTemplate = class {
|
|
|
4857
4859
|
(fn) => `- \`${fn.name}\`: ${capitalizeFirstLetter(fn.description)}.`
|
|
4858
4860
|
).join("\n");
|
|
4859
4861
|
if (funcList && funcList.length > 0) {
|
|
4860
|
-
task.push(
|
|
4862
|
+
task.push(`## Available Functions
|
|
4861
4863
|
${funcList}`);
|
|
4862
4864
|
}
|
|
4863
4865
|
const inputFields = this.renderFields(this.sig.getInputFields());
|
|
4864
|
-
task.push(
|
|
4866
|
+
task.push(`## Input Fields
|
|
4865
4867
|
${inputFields}`);
|
|
4866
4868
|
const outputFields = this.renderFields(this.sig.getOutputFields());
|
|
4867
|
-
task.push(
|
|
4869
|
+
task.push(`## Output Fields
|
|
4868
4870
|
${outputFields}`);
|
|
4869
4871
|
if (funcList && funcList.length > 0) {
|
|
4870
4872
|
task.push(functionCallInstructions.trim());
|
|
@@ -5220,8 +5222,8 @@ var ValidationError = class extends Error {
|
|
|
5220
5222
|
getFixingInstructions = () => {
|
|
5221
5223
|
return this.fields.map((field) => ({
|
|
5222
5224
|
name: "outputError",
|
|
5223
|
-
title: "
|
|
5224
|
-
description: `
|
|
5225
|
+
title: "Output Correction Required",
|
|
5226
|
+
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
5227
|
}));
|
|
5226
5228
|
};
|
|
5227
5229
|
};
|
|
@@ -5818,7 +5820,7 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
5818
5820
|
mem,
|
|
5819
5821
|
options
|
|
5820
5822
|
}) {
|
|
5821
|
-
const { sessionId, traceId, model, functions } = options ?? {};
|
|
5823
|
+
const { sessionId, traceId, model, functions, earlyFail } = options ?? {};
|
|
5822
5824
|
const usageInfo = {
|
|
5823
5825
|
ai: ai.getName(),
|
|
5824
5826
|
model: ai.getModelInfo().name
|
|
@@ -5837,7 +5839,8 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
5837
5839
|
mem,
|
|
5838
5840
|
traceId,
|
|
5839
5841
|
sessionId,
|
|
5840
|
-
functions
|
|
5842
|
+
functions,
|
|
5843
|
+
earlyFail
|
|
5841
5844
|
});
|
|
5842
5845
|
} else {
|
|
5843
5846
|
yield await this.processResponse({
|
|
@@ -5860,9 +5863,10 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
5860
5863
|
mem,
|
|
5861
5864
|
sessionId,
|
|
5862
5865
|
traceId,
|
|
5863
|
-
functions
|
|
5866
|
+
functions,
|
|
5867
|
+
earlyFail
|
|
5864
5868
|
}) {
|
|
5865
|
-
const streamingValidation = ai.getFeatures().functionCot !== true;
|
|
5869
|
+
const streamingValidation = earlyFail ?? ai.getFeatures().functionCot !== true;
|
|
5866
5870
|
const functionCalls = [];
|
|
5867
5871
|
const values = {};
|
|
5868
5872
|
const xstate = {
|