@ax-llm/ax 11.0.54 → 11.0.56
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 +163 -91
- package/index.cjs.map +1 -1
- package/index.d.cts +1 -9
- package/index.d.ts +1 -9
- package/index.js +163 -91
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.cts
CHANGED
|
@@ -2255,9 +2255,7 @@ type AxGenDeltaOut<OUT extends AxGenOut> = {
|
|
|
2255
2255
|
delta: Partial<OUT>;
|
|
2256
2256
|
};
|
|
2257
2257
|
type AxGenStreamingOut<OUT extends AxGenOut> = AsyncGenerator<AxGenDeltaOut<OUT>, void | OUT, unknown>;
|
|
2258
|
-
type AxSetExamplesOptions = {
|
|
2259
|
-
optionalOutputFields?: string[];
|
|
2260
|
-
};
|
|
2258
|
+
type AxSetExamplesOptions = {};
|
|
2261
2259
|
interface AxTunable {
|
|
2262
2260
|
setExamples: (examples: Readonly<AxProgramExamples>, options?: Readonly<AxSetExamplesOptions>) => void;
|
|
2263
2261
|
setId: (id: string) => void;
|
|
@@ -2366,8 +2364,6 @@ type Writeable<T> = {
|
|
|
2366
2364
|
interface AxPromptTemplateOptions {
|
|
2367
2365
|
functions?: Readonly<AxInputFunctionType>;
|
|
2368
2366
|
thoughtFieldName?: string;
|
|
2369
|
-
strictExamples?: boolean;
|
|
2370
|
-
optionalOutputFields?: string[];
|
|
2371
2367
|
}
|
|
2372
2368
|
type AxChatRequestChatPrompt = Writeable<AxChatRequest['chatPrompt'][0]>;
|
|
2373
2369
|
type ChatRequestUserMessage = Exclude<Extract<AxChatRequestChatPrompt, {
|
|
@@ -2380,8 +2376,6 @@ declare class AxPromptTemplate {
|
|
|
2380
2376
|
private task;
|
|
2381
2377
|
private readonly thoughtFieldName;
|
|
2382
2378
|
private readonly functions?;
|
|
2383
|
-
private readonly strictExamples;
|
|
2384
|
-
private readonly optionalOutputFields;
|
|
2385
2379
|
constructor(sig: Readonly<AxSignature>, options?: Readonly<AxPromptTemplateOptions>, fieldTemplates?: Record<string, AxFieldTemplateFn>);
|
|
2386
2380
|
render: <T extends AxGenIn>(values: T | ReadonlyArray<AxMessage>, // Allow T (AxGenIn) or array of AxMessages
|
|
2387
2381
|
{ examples, demos, }: Readonly<{
|
|
@@ -2421,8 +2415,6 @@ interface AxGenOptions {
|
|
|
2421
2415
|
stream?: boolean;
|
|
2422
2416
|
description?: string;
|
|
2423
2417
|
thoughtFieldName?: string;
|
|
2424
|
-
strictExamples?: boolean;
|
|
2425
|
-
optionalOutputFields?: string[];
|
|
2426
2418
|
functions?: AxInputFunctionType;
|
|
2427
2419
|
functionCall?: AxChatRequest['functionCall'];
|
|
2428
2420
|
stopFunction?: string;
|
package/index.d.ts
CHANGED
|
@@ -2255,9 +2255,7 @@ type AxGenDeltaOut<OUT extends AxGenOut> = {
|
|
|
2255
2255
|
delta: Partial<OUT>;
|
|
2256
2256
|
};
|
|
2257
2257
|
type AxGenStreamingOut<OUT extends AxGenOut> = AsyncGenerator<AxGenDeltaOut<OUT>, void | OUT, unknown>;
|
|
2258
|
-
type AxSetExamplesOptions = {
|
|
2259
|
-
optionalOutputFields?: string[];
|
|
2260
|
-
};
|
|
2258
|
+
type AxSetExamplesOptions = {};
|
|
2261
2259
|
interface AxTunable {
|
|
2262
2260
|
setExamples: (examples: Readonly<AxProgramExamples>, options?: Readonly<AxSetExamplesOptions>) => void;
|
|
2263
2261
|
setId: (id: string) => void;
|
|
@@ -2366,8 +2364,6 @@ type Writeable<T> = {
|
|
|
2366
2364
|
interface AxPromptTemplateOptions {
|
|
2367
2365
|
functions?: Readonly<AxInputFunctionType>;
|
|
2368
2366
|
thoughtFieldName?: string;
|
|
2369
|
-
strictExamples?: boolean;
|
|
2370
|
-
optionalOutputFields?: string[];
|
|
2371
2367
|
}
|
|
2372
2368
|
type AxChatRequestChatPrompt = Writeable<AxChatRequest['chatPrompt'][0]>;
|
|
2373
2369
|
type ChatRequestUserMessage = Exclude<Extract<AxChatRequestChatPrompt, {
|
|
@@ -2380,8 +2376,6 @@ declare class AxPromptTemplate {
|
|
|
2380
2376
|
private task;
|
|
2381
2377
|
private readonly thoughtFieldName;
|
|
2382
2378
|
private readonly functions?;
|
|
2383
|
-
private readonly strictExamples;
|
|
2384
|
-
private readonly optionalOutputFields;
|
|
2385
2379
|
constructor(sig: Readonly<AxSignature>, options?: Readonly<AxPromptTemplateOptions>, fieldTemplates?: Record<string, AxFieldTemplateFn>);
|
|
2386
2380
|
render: <T extends AxGenIn>(values: T | ReadonlyArray<AxMessage>, // Allow T (AxGenIn) or array of AxMessages
|
|
2387
2381
|
{ examples, demos, }: Readonly<{
|
|
@@ -2421,8 +2415,6 @@ interface AxGenOptions {
|
|
|
2421
2415
|
stream?: boolean;
|
|
2422
2416
|
description?: string;
|
|
2423
2417
|
thoughtFieldName?: string;
|
|
2424
|
-
strictExamples?: boolean;
|
|
2425
|
-
optionalOutputFields?: string[];
|
|
2426
2418
|
functions?: AxInputFunctionType;
|
|
2427
2419
|
functionCall?: AxChatRequest['functionCall'];
|
|
2428
2420
|
stopFunction?: string;
|
package/index.js
CHANGED
|
@@ -5817,15 +5817,11 @@ var AxPromptTemplate = class {
|
|
|
5817
5817
|
task;
|
|
5818
5818
|
thoughtFieldName;
|
|
5819
5819
|
functions;
|
|
5820
|
-
strictExamples;
|
|
5821
|
-
optionalOutputFields;
|
|
5822
5820
|
constructor(sig, options, fieldTemplates) {
|
|
5823
5821
|
this.sig = sig;
|
|
5824
5822
|
this.fieldTemplates = fieldTemplates;
|
|
5825
5823
|
this.thoughtFieldName = options?.thoughtFieldName ?? "thought";
|
|
5826
5824
|
this.functions = options?.functions;
|
|
5827
|
-
this.strictExamples = options?.strictExamples ?? false;
|
|
5828
|
-
this.optionalOutputFields = options?.optionalOutputFields ?? [];
|
|
5829
5825
|
const task = [];
|
|
5830
5826
|
const inArgs = renderDescFields(this.sig.getInputFields());
|
|
5831
5827
|
const outArgs = renderDescFields(this.sig.getOutputFields());
|
|
@@ -5995,33 +5991,22 @@ ${outputFields}`);
|
|
|
5995
5991
|
};
|
|
5996
5992
|
renderExamples = (data) => {
|
|
5997
5993
|
const list = [];
|
|
5998
|
-
const
|
|
5999
|
-
isExample: true
|
|
6000
|
-
strictExamples: this.strictExamples,
|
|
6001
|
-
optionalOutputFields: this.optionalOutputFields,
|
|
6002
|
-
isInputField: true
|
|
6003
|
-
};
|
|
6004
|
-
const outputExampleContext = {
|
|
6005
|
-
isExample: true,
|
|
6006
|
-
strictExamples: this.strictExamples,
|
|
6007
|
-
optionalOutputFields: this.optionalOutputFields,
|
|
6008
|
-
isInputField: false
|
|
5994
|
+
const exampleContext = {
|
|
5995
|
+
isExample: true
|
|
6009
5996
|
};
|
|
6010
5997
|
for (const [index, item] of data.entries()) {
|
|
6011
|
-
const renderedInputItem = this.sig.getInputFields().map(
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
)
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
}
|
|
6024
|
-
}
|
|
5998
|
+
const renderedInputItem = this.sig.getInputFields().map(
|
|
5999
|
+
(field) => this.renderInField(field, item, {
|
|
6000
|
+
...exampleContext,
|
|
6001
|
+
isInputField: true
|
|
6002
|
+
})
|
|
6003
|
+
).filter((v) => v !== void 0).flat();
|
|
6004
|
+
const renderedOutputItem = this.sig.getOutputFields().map(
|
|
6005
|
+
(field) => this.renderInField(field, item, {
|
|
6006
|
+
...exampleContext,
|
|
6007
|
+
isInputField: false
|
|
6008
|
+
})
|
|
6009
|
+
).filter((v) => v !== void 0).flat();
|
|
6025
6010
|
const renderedItem = [...renderedInputItem, ...renderedOutputItem];
|
|
6026
6011
|
if (index > 0 && renderedItem.length > 0 && renderedItem[0]?.type === "text") {
|
|
6027
6012
|
list.push({ type: "text", text: "---\n\n" });
|
|
@@ -6042,20 +6027,19 @@ ${outputFields}`);
|
|
|
6042
6027
|
const list = [];
|
|
6043
6028
|
const inputFields = this.sig.getInputFields();
|
|
6044
6029
|
const outputFields = this.sig.getOutputFields();
|
|
6030
|
+
const demoContext = {
|
|
6031
|
+
isExample: true
|
|
6032
|
+
};
|
|
6045
6033
|
for (const item of data) {
|
|
6046
6034
|
const inputRenderedItems = inputFields.map(
|
|
6047
6035
|
(field) => this.renderInField(field, item, {
|
|
6048
|
-
|
|
6049
|
-
strictExamples: this.strictExamples,
|
|
6050
|
-
optionalOutputFields: this.optionalOutputFields,
|
|
6036
|
+
...demoContext,
|
|
6051
6037
|
isInputField: true
|
|
6052
6038
|
})
|
|
6053
6039
|
).filter((v) => v !== void 0).flat();
|
|
6054
6040
|
const outputRenderedItems = outputFields.map(
|
|
6055
6041
|
(field) => this.renderInField(field, item, {
|
|
6056
|
-
|
|
6057
|
-
strictExamples: this.strictExamples,
|
|
6058
|
-
optionalOutputFields: this.optionalOutputFields,
|
|
6042
|
+
...demoContext,
|
|
6059
6043
|
isInputField: false
|
|
6060
6044
|
})
|
|
6061
6045
|
).filter((v) => v !== void 0).flat();
|
|
@@ -6271,24 +6255,9 @@ var isEmptyValue = (field, value, context3) => {
|
|
|
6271
6255
|
}
|
|
6272
6256
|
if (!value || (Array.isArray(value) || typeof value === "string") && value.length === 0) {
|
|
6273
6257
|
if (context3?.isExample) {
|
|
6274
|
-
|
|
6275
|
-
if (isInputField) {
|
|
6276
|
-
if (!context3?.strictExamples) {
|
|
6277
|
-
return true;
|
|
6278
|
-
} else {
|
|
6279
|
-
if (field.isOptional || field.isInternal) {
|
|
6280
|
-
return true;
|
|
6281
|
-
}
|
|
6282
|
-
throw new Error(`Value for input field '${field.name}' is required.`);
|
|
6283
|
-
}
|
|
6284
|
-
} else {
|
|
6285
|
-
if (field.isOptional || field.isInternal || context3?.optionalOutputFields?.includes(field.name)) {
|
|
6286
|
-
return true;
|
|
6287
|
-
}
|
|
6288
|
-
throw new Error(`Value for output field '${field.name}' is required.`);
|
|
6289
|
-
}
|
|
6258
|
+
return true;
|
|
6290
6259
|
}
|
|
6291
|
-
if (field.isOptional || field.isInternal
|
|
6260
|
+
if (field.isOptional || field.isInternal) {
|
|
6292
6261
|
return true;
|
|
6293
6262
|
}
|
|
6294
6263
|
const fieldType = context3?.isInputField !== false ? "input" : "output";
|
|
@@ -6761,6 +6730,9 @@ function getFieldProcessingMessage(field, resultText) {
|
|
|
6761
6730
|
var validateJSONSchema = (schema) => {
|
|
6762
6731
|
const errors = [];
|
|
6763
6732
|
const validateSchemaObject = (schema2, path = "") => {
|
|
6733
|
+
if (!schema2 || typeof schema2 !== "object") {
|
|
6734
|
+
return;
|
|
6735
|
+
}
|
|
6764
6736
|
const validTypes = [
|
|
6765
6737
|
"array",
|
|
6766
6738
|
"integer",
|
|
@@ -6770,38 +6742,155 @@ var validateJSONSchema = (schema) => {
|
|
|
6770
6742
|
"null",
|
|
6771
6743
|
"object"
|
|
6772
6744
|
];
|
|
6745
|
+
if (schema2.anyOf && Array.isArray(schema2.anyOf)) {
|
|
6746
|
+
if (schema2.anyOf.length === 0) {
|
|
6747
|
+
errors.push({
|
|
6748
|
+
path: path || "root",
|
|
6749
|
+
issue: "anyOf array is empty",
|
|
6750
|
+
fix: "Add at least one schema to the anyOf array",
|
|
6751
|
+
example: 'anyOf: [{ type: "string" }, { type: "null" }]'
|
|
6752
|
+
});
|
|
6753
|
+
}
|
|
6754
|
+
schema2.anyOf.forEach((subSchema, index) => {
|
|
6755
|
+
validateSchemaObject(subSchema, `${path}anyOf[${index}].`);
|
|
6756
|
+
});
|
|
6757
|
+
return;
|
|
6758
|
+
}
|
|
6759
|
+
if (schema2.oneOf && Array.isArray(schema2.oneOf)) {
|
|
6760
|
+
if (schema2.oneOf.length === 0) {
|
|
6761
|
+
errors.push({
|
|
6762
|
+
path: path || "root",
|
|
6763
|
+
issue: "oneOf array is empty",
|
|
6764
|
+
fix: "Add at least one schema to the oneOf array",
|
|
6765
|
+
example: 'oneOf: [{ type: "string" }, { type: "number" }]'
|
|
6766
|
+
});
|
|
6767
|
+
}
|
|
6768
|
+
schema2.oneOf.forEach((subSchema, index) => {
|
|
6769
|
+
validateSchemaObject(subSchema, `${path}oneOf[${index}].`);
|
|
6770
|
+
});
|
|
6771
|
+
return;
|
|
6772
|
+
}
|
|
6773
|
+
if (schema2.allOf && Array.isArray(schema2.allOf)) {
|
|
6774
|
+
if (schema2.allOf.length === 0) {
|
|
6775
|
+
errors.push({
|
|
6776
|
+
path: path || "root",
|
|
6777
|
+
issue: "allOf array is empty",
|
|
6778
|
+
fix: "Add at least one schema to the allOf array",
|
|
6779
|
+
example: 'allOf: [{ type: "object" }, { properties: { name: { type: "string" } } }]'
|
|
6780
|
+
});
|
|
6781
|
+
}
|
|
6782
|
+
schema2.allOf.forEach((subSchema, index) => {
|
|
6783
|
+
validateSchemaObject(subSchema, `${path}allOf[${index}].`);
|
|
6784
|
+
});
|
|
6785
|
+
return;
|
|
6786
|
+
}
|
|
6787
|
+
if (!schema2.type) {
|
|
6788
|
+
return;
|
|
6789
|
+
}
|
|
6773
6790
|
if (!validTypes.includes(schema2.type)) {
|
|
6774
|
-
errors.push(
|
|
6791
|
+
errors.push({
|
|
6792
|
+
path: path || "root",
|
|
6793
|
+
issue: `Invalid type '${schema2.type}'`,
|
|
6794
|
+
fix: `Change type to one of: ${validTypes.join(", ")}`,
|
|
6795
|
+
example: `{ type: "string" } or { type: "object" }`
|
|
6796
|
+
});
|
|
6775
6797
|
return;
|
|
6776
6798
|
}
|
|
6777
|
-
if (schema2.type === "object"
|
|
6778
|
-
if (
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6799
|
+
if (schema2.type === "object") {
|
|
6800
|
+
if (schema2.properties) {
|
|
6801
|
+
if (typeof schema2.properties !== "object" || Array.isArray(schema2.properties)) {
|
|
6802
|
+
errors.push({
|
|
6803
|
+
path: path || "root",
|
|
6804
|
+
issue: "properties must be an object, not an array or primitive",
|
|
6805
|
+
fix: "Change properties to be an object with property names as keys",
|
|
6806
|
+
example: 'properties: { name: { type: "string" }, age: { type: "number" } }'
|
|
6807
|
+
});
|
|
6808
|
+
} else {
|
|
6809
|
+
for (const key in schema2.properties) {
|
|
6810
|
+
const value = schema2.properties[key];
|
|
6811
|
+
if (value === void 0 || value === null) {
|
|
6812
|
+
continue;
|
|
6813
|
+
}
|
|
6814
|
+
if (typeof value !== "object") {
|
|
6815
|
+
errors.push({
|
|
6816
|
+
path: `${path}${key}`,
|
|
6817
|
+
issue: `Property schema must be an object, got ${typeof value}`,
|
|
6818
|
+
fix: "Define the property as a proper schema object",
|
|
6819
|
+
example: `${key}: { type: "string", description: "..." }`
|
|
6820
|
+
});
|
|
6821
|
+
continue;
|
|
6822
|
+
}
|
|
6823
|
+
validateSchemaObject(value, `${path}${key}.`);
|
|
6786
6824
|
}
|
|
6787
|
-
validateSchemaObject(value, `${path}${key}.`);
|
|
6788
6825
|
}
|
|
6789
6826
|
}
|
|
6790
|
-
if (schema2.required
|
|
6791
|
-
|
|
6827
|
+
if (schema2.required) {
|
|
6828
|
+
if (!Array.isArray(schema2.required)) {
|
|
6829
|
+
errors.push({
|
|
6830
|
+
path: path || "root",
|
|
6831
|
+
issue: `'required' must be an array, got ${typeof schema2.required}`,
|
|
6832
|
+
fix: "Change required to be an array of property names",
|
|
6833
|
+
example: 'required: ["name", "email"] instead of required: "name,email"'
|
|
6834
|
+
});
|
|
6835
|
+
} else if (schema2.required.length === 0) {
|
|
6836
|
+
} else {
|
|
6837
|
+
if (schema2.properties) {
|
|
6838
|
+
for (const requiredProp of schema2.required) {
|
|
6839
|
+
if (typeof requiredProp !== "string") {
|
|
6840
|
+
errors.push({
|
|
6841
|
+
path: `${path}required`,
|
|
6842
|
+
issue: `Required property names must be strings, got ${typeof requiredProp}`,
|
|
6843
|
+
fix: "Ensure all items in required array are strings",
|
|
6844
|
+
example: 'required: ["name", "email"] not required: [123, "email"]'
|
|
6845
|
+
});
|
|
6846
|
+
} else if (!(requiredProp in schema2.properties)) {
|
|
6847
|
+
errors.push({
|
|
6848
|
+
path: `${path}required`,
|
|
6849
|
+
issue: `Required property '${requiredProp}' is not defined in properties`,
|
|
6850
|
+
fix: `Either add '${requiredProp}' to properties or remove it from required`,
|
|
6851
|
+
example: `properties: { ${requiredProp}: { type: "string" } }`
|
|
6852
|
+
});
|
|
6853
|
+
}
|
|
6854
|
+
}
|
|
6855
|
+
}
|
|
6856
|
+
}
|
|
6792
6857
|
}
|
|
6793
6858
|
}
|
|
6794
|
-
if (schema2.type === "array"
|
|
6795
|
-
if (
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6859
|
+
if (schema2.type === "array") {
|
|
6860
|
+
if (schema2.items) {
|
|
6861
|
+
if (typeof schema2.items !== "object") {
|
|
6862
|
+
errors.push({
|
|
6863
|
+
path: `${path}items`,
|
|
6864
|
+
issue: `Array items schema must be an object, got ${typeof schema2.items}`,
|
|
6865
|
+
fix: "Define items as a proper schema object",
|
|
6866
|
+
example: 'items: { type: "string" } or items: { type: "object", properties: {...} }'
|
|
6867
|
+
});
|
|
6868
|
+
} else {
|
|
6869
|
+
validateSchemaObject(schema2.items, `${path}items.`);
|
|
6870
|
+
}
|
|
6799
6871
|
}
|
|
6800
6872
|
}
|
|
6801
6873
|
};
|
|
6802
6874
|
validateSchemaObject(schema);
|
|
6803
6875
|
if (errors.length > 0) {
|
|
6804
|
-
|
|
6876
|
+
const errorMessage = [
|
|
6877
|
+
"JSON Schema validation failed:",
|
|
6878
|
+
"",
|
|
6879
|
+
...errors.map((error, index) => {
|
|
6880
|
+
const parts = [
|
|
6881
|
+
`${index + 1}. Path: ${error.path}`,
|
|
6882
|
+
` Issue: ${error.issue}`,
|
|
6883
|
+
` Fix: ${error.fix}`
|
|
6884
|
+
];
|
|
6885
|
+
if (error.example) {
|
|
6886
|
+
parts.push(` Example: ${error.example}`);
|
|
6887
|
+
}
|
|
6888
|
+
return parts.join("\n");
|
|
6889
|
+
}),
|
|
6890
|
+
"",
|
|
6891
|
+
"Please fix these issues and try again."
|
|
6892
|
+
].join("\n");
|
|
6893
|
+
throw new Error(errorMessage);
|
|
6805
6894
|
}
|
|
6806
6895
|
};
|
|
6807
6896
|
|
|
@@ -7619,7 +7708,7 @@ var AxProgramWithSignature = class {
|
|
|
7619
7708
|
const res = {};
|
|
7620
7709
|
for (const f of fields) {
|
|
7621
7710
|
const value = e[f.name];
|
|
7622
|
-
if (value) {
|
|
7711
|
+
if (value !== void 0) {
|
|
7623
7712
|
validateValue(f, value);
|
|
7624
7713
|
res[f.name] = value;
|
|
7625
7714
|
}
|
|
@@ -7752,9 +7841,7 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
7752
7841
|
this.thoughtFieldName = options?.thoughtFieldName ?? "thought";
|
|
7753
7842
|
const promptTemplateOptions = {
|
|
7754
7843
|
functions: options?.functions,
|
|
7755
|
-
thoughtFieldName: this.thoughtFieldName
|
|
7756
|
-
strictExamples: options?.strictExamples,
|
|
7757
|
-
optionalOutputFields: options?.optionalOutputFields
|
|
7844
|
+
thoughtFieldName: this.thoughtFieldName
|
|
7758
7845
|
};
|
|
7759
7846
|
this.promptTemplate = new (options?.promptTemplate ?? AxPromptTemplate)(
|
|
7760
7847
|
this.signature,
|
|
@@ -8118,9 +8205,7 @@ Content: ${result.content}`
|
|
|
8118
8205
|
const promptTemplateClass = this.options?.promptTemplate ?? AxPromptTemplate;
|
|
8119
8206
|
const currentPromptTemplateOptions = {
|
|
8120
8207
|
functions: options.functions,
|
|
8121
|
-
thoughtFieldName: this.thoughtFieldName
|
|
8122
|
-
strictExamples: this.options?.strictExamples,
|
|
8123
|
-
optionalOutputFields: this.options?.optionalOutputFields
|
|
8208
|
+
thoughtFieldName: this.thoughtFieldName
|
|
8124
8209
|
};
|
|
8125
8210
|
this.promptTemplate = new promptTemplateClass(
|
|
8126
8211
|
this.signature,
|
|
@@ -8308,19 +8393,6 @@ Content: ${result.content}`
|
|
|
8308
8393
|
}
|
|
8309
8394
|
setExamples(examples, options) {
|
|
8310
8395
|
super.setExamples(examples, options);
|
|
8311
|
-
if (options?.optionalOutputFields) {
|
|
8312
|
-
const promptTemplateClass = this.options?.promptTemplate ?? AxPromptTemplate;
|
|
8313
|
-
const currentPromptTemplateOptions = {
|
|
8314
|
-
functions: this.functions,
|
|
8315
|
-
thoughtFieldName: this.thoughtFieldName,
|
|
8316
|
-
strictExamples: this.options?.strictExamples,
|
|
8317
|
-
optionalOutputFields: options.optionalOutputFields
|
|
8318
|
-
};
|
|
8319
|
-
this.promptTemplate = new promptTemplateClass(
|
|
8320
|
-
this.signature,
|
|
8321
|
-
currentPromptTemplateOptions
|
|
8322
|
-
);
|
|
8323
|
-
}
|
|
8324
8396
|
}
|
|
8325
8397
|
};
|
|
8326
8398
|
var AxGenerateError = class extends Error {
|