langchain 0.0.147 → 0.0.148

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.
Files changed (110) hide show
  1. package/chat_models/googlevertexai/web.cjs +1 -0
  2. package/chat_models/googlevertexai/web.d.ts +1 -0
  3. package/chat_models/googlevertexai/web.js +1 -0
  4. package/chat_models/googlevertexai.cjs +1 -1
  5. package/chat_models/googlevertexai.d.ts +1 -1
  6. package/chat_models/googlevertexai.js +1 -1
  7. package/dist/chains/constitutional_ai/constitutional_principle.cjs +272 -1
  8. package/dist/chains/constitutional_ai/constitutional_principle.js +272 -1
  9. package/dist/chat_models/{googlevertexai.cjs → googlevertexai/common.cjs} +14 -26
  10. package/dist/chat_models/{googlevertexai.d.ts → googlevertexai/common.d.ts} +13 -22
  11. package/dist/chat_models/{googlevertexai.js → googlevertexai/common.js} +12 -24
  12. package/dist/chat_models/googlevertexai/index.cjs +36 -0
  13. package/dist/chat_models/googlevertexai/index.d.ts +21 -0
  14. package/dist/chat_models/googlevertexai/index.js +31 -0
  15. package/dist/chat_models/googlevertexai/web.cjs +33 -0
  16. package/dist/chat_models/googlevertexai/web.d.ts +19 -0
  17. package/dist/chat_models/googlevertexai/web.js +28 -0
  18. package/dist/document_loaders/web/notionapi.cjs +93 -70
  19. package/dist/document_loaders/web/notionapi.d.ts +33 -1
  20. package/dist/document_loaders/web/notionapi.js +89 -71
  21. package/dist/embeddings/googlevertexai.cjs +5 -1
  22. package/dist/embeddings/googlevertexai.d.ts +2 -1
  23. package/dist/embeddings/googlevertexai.js +5 -1
  24. package/dist/evaluation/agents/index.cjs +17 -0
  25. package/dist/evaluation/agents/index.d.ts +1 -0
  26. package/dist/evaluation/agents/index.js +1 -0
  27. package/dist/evaluation/agents/prompt.cjs +132 -0
  28. package/dist/evaluation/agents/prompt.d.ts +6 -0
  29. package/dist/evaluation/agents/prompt.js +129 -0
  30. package/dist/evaluation/agents/trajectory.cjs +189 -0
  31. package/dist/evaluation/agents/trajectory.d.ts +54 -0
  32. package/dist/evaluation/agents/trajectory.js +184 -0
  33. package/dist/evaluation/base.cjs +274 -0
  34. package/dist/evaluation/base.d.ts +232 -0
  35. package/dist/evaluation/base.js +263 -0
  36. package/dist/evaluation/comparison/index.cjs +17 -0
  37. package/dist/evaluation/comparison/index.d.ts +1 -0
  38. package/dist/evaluation/comparison/index.js +1 -0
  39. package/dist/evaluation/comparison/pairwise.cjs +244 -0
  40. package/dist/evaluation/comparison/pairwise.d.ts +50 -0
  41. package/dist/evaluation/comparison/pairwise.js +238 -0
  42. package/dist/evaluation/comparison/prompt.cjs +74 -0
  43. package/dist/evaluation/comparison/prompt.d.ts +21 -0
  44. package/dist/evaluation/comparison/prompt.js +71 -0
  45. package/dist/evaluation/criteria/criteria.cjs +259 -0
  46. package/dist/evaluation/criteria/criteria.d.ts +73 -0
  47. package/dist/evaluation/criteria/criteria.js +253 -0
  48. package/dist/evaluation/criteria/index.cjs +17 -0
  49. package/dist/evaluation/criteria/index.d.ts +1 -0
  50. package/dist/evaluation/criteria/index.js +1 -0
  51. package/dist/evaluation/criteria/prompt.cjs +36 -0
  52. package/dist/evaluation/criteria/prompt.d.ts +12 -0
  53. package/dist/evaluation/criteria/prompt.js +33 -0
  54. package/dist/evaluation/embedding_distance/base.cjs +163 -0
  55. package/dist/evaluation/embedding_distance/base.d.ts +78 -0
  56. package/dist/evaluation/embedding_distance/base.js +156 -0
  57. package/dist/evaluation/embedding_distance/index.cjs +17 -0
  58. package/dist/evaluation/embedding_distance/index.d.ts +1 -0
  59. package/dist/evaluation/embedding_distance/index.js +1 -0
  60. package/dist/evaluation/index.cjs +6 -0
  61. package/dist/evaluation/index.d.ts +6 -0
  62. package/dist/evaluation/index.js +6 -0
  63. package/dist/evaluation/loader.cjs +60 -0
  64. package/dist/evaluation/loader.d.ts +27 -0
  65. package/dist/evaluation/loader.js +56 -0
  66. package/dist/evaluation/types.cjs +2 -0
  67. package/dist/evaluation/types.d.ts +35 -0
  68. package/dist/evaluation/types.js +1 -0
  69. package/dist/experimental/multimodal_embeddings/googlevertexai.cjs +5 -1
  70. package/dist/experimental/multimodal_embeddings/googlevertexai.d.ts +2 -1
  71. package/dist/experimental/multimodal_embeddings/googlevertexai.js +5 -1
  72. package/dist/llms/{googlevertexai.js → googlevertexai/common.cjs} +21 -17
  73. package/dist/llms/{googlevertexai.d.ts → googlevertexai/common.d.ts} +13 -23
  74. package/dist/llms/{googlevertexai.cjs → googlevertexai/common.js} +17 -21
  75. package/dist/llms/googlevertexai/index.cjs +34 -0
  76. package/dist/llms/googlevertexai/index.d.ts +26 -0
  77. package/dist/llms/googlevertexai/index.js +30 -0
  78. package/dist/llms/googlevertexai/web.cjs +31 -0
  79. package/dist/llms/googlevertexai/web.d.ts +24 -0
  80. package/dist/llms/googlevertexai/web.js +27 -0
  81. package/dist/load/import_constants.cjs +2 -0
  82. package/dist/load/import_constants.js +2 -0
  83. package/dist/load/import_map.cjs +2 -1
  84. package/dist/load/import_map.d.ts +1 -0
  85. package/dist/load/import_map.js +1 -0
  86. package/dist/load/serializable.cjs +23 -4
  87. package/dist/load/serializable.js +23 -4
  88. package/dist/retrievers/multi_query.cjs +140 -0
  89. package/dist/retrievers/multi_query.d.ts +33 -0
  90. package/dist/retrievers/multi_query.js +136 -0
  91. package/dist/types/googlevertexai-types.d.ts +11 -4
  92. package/dist/util/googlevertexai-connection.cjs +14 -15
  93. package/dist/util/googlevertexai-connection.d.ts +7 -7
  94. package/dist/util/googlevertexai-connection.js +14 -15
  95. package/dist/util/googlevertexai-webauth.cjs +56 -0
  96. package/dist/util/googlevertexai-webauth.d.ts +25 -0
  97. package/dist/util/googlevertexai-webauth.js +52 -0
  98. package/dist/vectorstores/googlevertexai.cjs +9 -8
  99. package/dist/vectorstores/googlevertexai.d.ts +8 -7
  100. package/dist/vectorstores/googlevertexai.js +9 -8
  101. package/llms/googlevertexai/web.cjs +1 -0
  102. package/llms/googlevertexai/web.d.ts +1 -0
  103. package/llms/googlevertexai/web.js +1 -0
  104. package/llms/googlevertexai.cjs +1 -1
  105. package/llms/googlevertexai.d.ts +1 -1
  106. package/llms/googlevertexai.js +1 -1
  107. package/package.json +32 -3
  108. package/retrievers/multi_query.cjs +1 -0
  109. package/retrievers/multi_query.d.ts +1 -0
  110. package/retrievers/multi_query.js +1 -0
@@ -0,0 +1,232 @@
1
+ import { BaseChain, LLMChain, LLMChainInput } from "../chains/index.js";
2
+ import { AgentStep, ChainValues } from "../schema/index.js";
3
+ import { BaseLanguageModel } from "../base_language/index.js";
4
+ import { Callbacks } from "../callbacks/index.js";
5
+ import { BaseCallbackConfig } from "../callbacks/manager.js";
6
+ /**
7
+ * Base input for evaluators.
8
+ */
9
+ export interface LLMEvalChainInput<T extends EvalOutputType = EvalOutputType, L extends BaseLanguageModel = BaseLanguageModel> extends LLMChainInput<T, L> {
10
+ }
11
+ /**
12
+ * Compare two sets for equality
13
+ *
14
+ * @param xs
15
+ * @param ys
16
+ */
17
+ export declare const eqSet: (xs: Set<string>, ys: Set<string>) => boolean;
18
+ /**
19
+ * The type of the output of an evaluation evaluator.
20
+ */
21
+ export type EvalOutputType = Record<string, string | number | boolean>;
22
+ /**
23
+ * Base llm chain class for evaluators.
24
+ */
25
+ export declare abstract class LLMEvalChain<T extends EvalOutputType = EvalOutputType, L extends BaseLanguageModel = BaseLanguageModel> extends LLMChain<T, L> {
26
+ requiresInput?: boolean;
27
+ requiresReference?: boolean;
28
+ skipInputWarning?: string;
29
+ skipReferenceWarning?: string;
30
+ /**
31
+ * Check if the evaluation arguments are valid.
32
+ * @param reference The reference label.
33
+ * @param input The input string.
34
+ * @throws {Error} If the evaluator requires an input string but none is provided, or if the evaluator requires a reference label but none is provided.
35
+ */
36
+ checkEvaluationArgs(reference?: string, input?: string): void;
37
+ }
38
+ /**
39
+ * Base chain class for evaluators.
40
+ */
41
+ export declare abstract class EvalChain<RunInput extends ChainValues = ChainValues, RunOutput extends ChainValues = ChainValues> extends BaseChain<RunInput, RunOutput> {
42
+ requiresInput?: boolean;
43
+ requiresReference?: boolean;
44
+ skipInputWarning?: string;
45
+ skipReferenceWarning?: string;
46
+ /**
47
+ * Check if the evaluation arguments are valid.
48
+ * @param reference The reference label.
49
+ * @param input The input string.
50
+ * @throws {Error} If the evaluator requires an input string but none is provided, or if the evaluator requires a reference label but none is provided.
51
+ */
52
+ checkEvaluationArgs(reference?: string, input?: string): void;
53
+ }
54
+ /**
55
+ * @field prediction The output string from the model.
56
+ * @field reference The expected output / reference string.
57
+ * @field input The input string.
58
+ */
59
+ export interface StringEvaluatorArgs {
60
+ prediction: string;
61
+ reference?: string;
62
+ input?: string;
63
+ }
64
+ /**
65
+ * @field prediction The output string from the first model.
66
+ * @field predictionB The output string from the second model.
67
+ */
68
+ export interface PairwiseStringEvaluatorArgs {
69
+ prediction: string;
70
+ predictionB: string;
71
+ }
72
+ /**
73
+ * @field The input string.
74
+ * @field prediction The output string from the first model.
75
+ * @field predictionB The output string from the second model.
76
+ * @field reference The expected output / reference string.
77
+ */
78
+ export interface LLMPairwiseStringEvaluatorArgs {
79
+ input: string;
80
+ prediction: string;
81
+ predictionB: string;
82
+ reference?: string;
83
+ }
84
+ /**
85
+ * Args for AgentTrajectoryEvaluator
86
+ * @field input The input to the agent.
87
+ * @field prediction The final predicted response.
88
+ * @field reference The reference answer.
89
+ * @field agentTrajectory The intermediate steps forming the agent trajectory.
90
+ */
91
+ export interface LLMTrajectoryEvaluatorArgs {
92
+ input: string;
93
+ prediction: string;
94
+ reference?: string;
95
+ agentTrajectory: AgentStep[];
96
+ }
97
+ /**
98
+ * Grade, tag, or otherwise evaluate predictions relative to their inputs
99
+ * and/or reference labels
100
+ */
101
+ export declare abstract class LLMStringEvaluator<T extends EvalOutputType = EvalOutputType, L extends BaseLanguageModel = BaseLanguageModel> extends LLMEvalChain<T, L> {
102
+ /**
103
+ * The name of the evaluation.
104
+ */
105
+ evaluationName?: string;
106
+ /**
107
+ * Evaluate Chain or LLM output, based on optional input and label.
108
+ * @returns The evaluation results containing the score or value. It is recommended that the dictionary contain the following keys:
109
+ * - score: the score of the evaluation, if applicable.
110
+ * - value: the string value of the evaluation, if applicable.
111
+ * - reasoning: the reasoning for the evaluation, if applicable.
112
+ * @param args
113
+ * @param callOptions
114
+ * @param config
115
+ */
116
+ abstract _evaluateStrings(args: StringEvaluatorArgs, callOptions?: this["llm"]["CallOptions"], config?: Callbacks | BaseCallbackConfig): Promise<ChainValues>;
117
+ /**
118
+ * Evaluate Chain or LLM output, based on optional input and label.
119
+ * @returns The evaluation results containing the score or value. It is recommended that the dictionary contain the following keys:
120
+ * - score: the score of the evaluation, if applicable.
121
+ * - value: the string value of the evaluation, if applicable.
122
+ * - reasoning: the reasoning for the evaluation, if applicable.
123
+ * @param args
124
+ * @param callOptions
125
+ * @param config
126
+ */
127
+ evaluateStrings(args: StringEvaluatorArgs, callOptions?: this["llm"]["CallOptions"], config?: Callbacks | BaseCallbackConfig): Promise<ChainValues>;
128
+ }
129
+ /**
130
+ * Grade, tag, or otherwise evaluate predictions relative to their inputs
131
+ * and/or reference labels
132
+ */
133
+ export declare abstract class StringEvaluator extends EvalChain {
134
+ /**
135
+ * The name of the evaluation.
136
+ */
137
+ evaluationName?: string;
138
+ /**
139
+ * Evaluate Chain or LLM output, based on optional input and label.
140
+ * @returns The evaluation results containing the score or value. It is recommended that the dictionary contain the following keys:
141
+ * - score: the score of the evaluation, if applicable.
142
+ * - value: the string value of the evaluation, if applicable.
143
+ * - reasoning: the reasoning for the evaluation, if applicable.
144
+ * @param args
145
+ * @param config
146
+ */
147
+ abstract _evaluateStrings(args: StringEvaluatorArgs, config?: Callbacks | BaseCallbackConfig): Promise<ChainValues>;
148
+ /**
149
+ * Evaluate Chain or LLM output, based on optional input and label.
150
+ * @returns The evaluation results containing the score or value. It is recommended that the dictionary contain the following keys:
151
+ * - score: the score of the evaluation, if applicable.
152
+ * - value: the string value of the evaluation, if applicable.
153
+ * - reasoning: the reasoning for the evaluation, if applicable.
154
+ * @param args
155
+ * @param config
156
+ */
157
+ evaluateStrings(args: StringEvaluatorArgs, config?: Callbacks | BaseCallbackConfig): Promise<ChainValues>;
158
+ }
159
+ /**
160
+ * Compare the output of two models (or two outputs of the same model).
161
+ */
162
+ export declare abstract class PairwiseStringEvaluator extends EvalChain {
163
+ /**
164
+ * The name of the evaluation.
165
+ */
166
+ evaluationName?: string;
167
+ /**
168
+ * Evaluate the output string pairs.
169
+ * @param args
170
+ * @param config
171
+ * @return A dictionary containing the preference, scores, and/or other information.
172
+ */
173
+ abstract _evaluateStringPairs(args: PairwiseStringEvaluatorArgs, config?: Callbacks | BaseCallbackConfig): Promise<ChainValues>;
174
+ /**
175
+ * Evaluate the output string pairs.
176
+ * @param args
177
+ * @param config
178
+ * @return A dictionary containing the preference, scores, and/or other information.
179
+ */
180
+ evaluateStringPairs(args: PairwiseStringEvaluatorArgs, config?: Callbacks | BaseCallbackConfig): Promise<ChainValues>;
181
+ }
182
+ /**
183
+ * Compare the output of two models (or two outputs of the same model).
184
+ */
185
+ export declare abstract class LLMPairwiseStringEvaluator extends LLMEvalChain {
186
+ /**
187
+ * The name of the evaluation.
188
+ */
189
+ evaluationName?: string;
190
+ /**
191
+ * Evaluate the output string pairs.
192
+ * @param args
193
+ * @param callOptions
194
+ * @param config
195
+ * @return A dictionary containing the preference, scores, and/or other information.
196
+ */
197
+ abstract _evaluateStringPairs(args: LLMPairwiseStringEvaluatorArgs, callOptions?: this["llm"]["CallOptions"], config?: Callbacks | BaseCallbackConfig): Promise<ChainValues>;
198
+ /**
199
+ * Evaluate the output string pairs.
200
+ * @param args
201
+ * @param callOptions
202
+ * @param config
203
+ * @return A dictionary containing the preference, scores, and/or other information.
204
+ */
205
+ evaluateStringPairs(args: LLMPairwiseStringEvaluatorArgs, callOptions?: this["llm"]["CallOptions"], config?: Callbacks | BaseCallbackConfig): Promise<ChainValues>;
206
+ }
207
+ /**
208
+ * Interface for evaluating agent trajectories.
209
+ */
210
+ export declare abstract class AgentTrajectoryEvaluator extends LLMEvalChain {
211
+ requiresInput: boolean;
212
+ /**
213
+ * The name of the evaluation.
214
+ */
215
+ evaluationName?: string;
216
+ /**
217
+ * Evaluate a trajectory.
218
+ * @return The evaluation result.
219
+ * @param args
220
+ * @param callOptions
221
+ * @param config
222
+ */
223
+ abstract _evaluateAgentTrajectory(args: LLMTrajectoryEvaluatorArgs, callOptions?: this["llm"]["CallOptions"], config?: Callbacks | BaseCallbackConfig): Promise<ChainValues>;
224
+ /**
225
+ * Evaluate a trajectory.
226
+ * @return The evaluation result.
227
+ * @param args
228
+ * @param callOptions
229
+ * @param config
230
+ */
231
+ evaluateAgentTrajectory(args: LLMTrajectoryEvaluatorArgs, callOptions?: this["llm"]["CallOptions"], config?: Callbacks | BaseCallbackConfig): Promise<ChainValues>;
232
+ }
@@ -0,0 +1,263 @@
1
+ import { BaseChain, LLMChain } from "../chains/index.js";
2
+ /**
3
+ * Compare two sets for equality
4
+ *
5
+ * @param xs
6
+ * @param ys
7
+ */
8
+ export const eqSet = (xs, ys) => xs.size === ys.size && [...xs].every((x) => ys.has(x));
9
+ /**
10
+ * Base llm chain class for evaluators.
11
+ */
12
+ export class LLMEvalChain extends LLMChain {
13
+ constructor() {
14
+ super(...arguments);
15
+ Object.defineProperty(this, "requiresInput", {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value: false
20
+ });
21
+ Object.defineProperty(this, "requiresReference", {
22
+ enumerable: true,
23
+ configurable: true,
24
+ writable: true,
25
+ value: false
26
+ });
27
+ Object.defineProperty(this, "skipInputWarning", {
28
+ enumerable: true,
29
+ configurable: true,
30
+ writable: true,
31
+ value: `Ignoring input in ${this.constructor.name}, as it is not expected.`
32
+ });
33
+ Object.defineProperty(this, "skipReferenceWarning", {
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true,
37
+ value: `Ignoring reference in ${this.constructor.name}, as it is not expected.`
38
+ });
39
+ }
40
+ /**
41
+ * Check if the evaluation arguments are valid.
42
+ * @param reference The reference label.
43
+ * @param input The input string.
44
+ * @throws {Error} If the evaluator requires an input string but none is provided, or if the evaluator requires a reference label but none is provided.
45
+ */
46
+ checkEvaluationArgs(reference, input) {
47
+ if (this.requiresInput && input == null) {
48
+ throw new Error(`${this.constructor.name} requires an input string.`);
49
+ }
50
+ else if (input != null && !this.requiresInput) {
51
+ console.warn(this.skipInputWarning);
52
+ }
53
+ if (this.requiresReference && reference == null) {
54
+ throw new Error(`${this.constructor.name} requires a reference string.`);
55
+ }
56
+ else if (reference != null && !this.requiresReference) {
57
+ console.warn(this.skipReferenceWarning);
58
+ }
59
+ }
60
+ }
61
+ /**
62
+ * Base chain class for evaluators.
63
+ */
64
+ export class EvalChain extends BaseChain {
65
+ constructor() {
66
+ super(...arguments);
67
+ Object.defineProperty(this, "requiresInput", {
68
+ enumerable: true,
69
+ configurable: true,
70
+ writable: true,
71
+ value: false
72
+ });
73
+ Object.defineProperty(this, "requiresReference", {
74
+ enumerable: true,
75
+ configurable: true,
76
+ writable: true,
77
+ value: false
78
+ });
79
+ Object.defineProperty(this, "skipInputWarning", {
80
+ enumerable: true,
81
+ configurable: true,
82
+ writable: true,
83
+ value: `Ignoring input in ${this.constructor.name}, as it is not expected.`
84
+ });
85
+ Object.defineProperty(this, "skipReferenceWarning", {
86
+ enumerable: true,
87
+ configurable: true,
88
+ writable: true,
89
+ value: `Ignoring reference in ${this.constructor.name}, as it is not expected.`
90
+ });
91
+ }
92
+ /**
93
+ * Check if the evaluation arguments are valid.
94
+ * @param reference The reference label.
95
+ * @param input The input string.
96
+ * @throws {Error} If the evaluator requires an input string but none is provided, or if the evaluator requires a reference label but none is provided.
97
+ */
98
+ checkEvaluationArgs(reference, input) {
99
+ if (this.requiresInput && input == null) {
100
+ throw new Error(`${this.constructor.name} requires an input string.`);
101
+ }
102
+ else if (input != null && !this.requiresInput) {
103
+ console.warn(this.skipInputWarning);
104
+ }
105
+ if (this.requiresReference && reference == null) {
106
+ throw new Error(`${this.constructor.name} requires a reference string.`);
107
+ }
108
+ else if (reference != null && !this.requiresReference) {
109
+ console.warn(this.skipReferenceWarning);
110
+ }
111
+ }
112
+ }
113
+ /**
114
+ * Grade, tag, or otherwise evaluate predictions relative to their inputs
115
+ * and/or reference labels
116
+ */
117
+ export class LLMStringEvaluator extends LLMEvalChain {
118
+ constructor() {
119
+ super(...arguments);
120
+ /**
121
+ * The name of the evaluation.
122
+ */
123
+ Object.defineProperty(this, "evaluationName", {
124
+ enumerable: true,
125
+ configurable: true,
126
+ writable: true,
127
+ value: this.constructor.name
128
+ });
129
+ }
130
+ /**
131
+ * Evaluate Chain or LLM output, based on optional input and label.
132
+ * @returns The evaluation results containing the score or value. It is recommended that the dictionary contain the following keys:
133
+ * - score: the score of the evaluation, if applicable.
134
+ * - value: the string value of the evaluation, if applicable.
135
+ * - reasoning: the reasoning for the evaluation, if applicable.
136
+ * @param args
137
+ * @param callOptions
138
+ * @param config
139
+ */
140
+ evaluateStrings(args, callOptions, config) {
141
+ this.checkEvaluationArgs(args.reference, args.input);
142
+ return this._evaluateStrings(args, callOptions, config);
143
+ }
144
+ }
145
+ /**
146
+ * Grade, tag, or otherwise evaluate predictions relative to their inputs
147
+ * and/or reference labels
148
+ */
149
+ export class StringEvaluator extends EvalChain {
150
+ constructor() {
151
+ super(...arguments);
152
+ /**
153
+ * The name of the evaluation.
154
+ */
155
+ Object.defineProperty(this, "evaluationName", {
156
+ enumerable: true,
157
+ configurable: true,
158
+ writable: true,
159
+ value: this.constructor.name
160
+ });
161
+ }
162
+ /**
163
+ * Evaluate Chain or LLM output, based on optional input and label.
164
+ * @returns The evaluation results containing the score or value. It is recommended that the dictionary contain the following keys:
165
+ * - score: the score of the evaluation, if applicable.
166
+ * - value: the string value of the evaluation, if applicable.
167
+ * - reasoning: the reasoning for the evaluation, if applicable.
168
+ * @param args
169
+ * @param config
170
+ */
171
+ evaluateStrings(args, config) {
172
+ this.checkEvaluationArgs(args.reference, args.input);
173
+ return this._evaluateStrings(args, config);
174
+ }
175
+ }
176
+ /**
177
+ * Compare the output of two models (or two outputs of the same model).
178
+ */
179
+ export class PairwiseStringEvaluator extends EvalChain {
180
+ constructor() {
181
+ super(...arguments);
182
+ /**
183
+ * The name of the evaluation.
184
+ */
185
+ Object.defineProperty(this, "evaluationName", {
186
+ enumerable: true,
187
+ configurable: true,
188
+ writable: true,
189
+ value: this.constructor.name
190
+ });
191
+ }
192
+ /**
193
+ * Evaluate the output string pairs.
194
+ * @param args
195
+ * @param config
196
+ * @return A dictionary containing the preference, scores, and/or other information.
197
+ */
198
+ evaluateStringPairs(args, config) {
199
+ return this._evaluateStringPairs(args, config);
200
+ }
201
+ }
202
+ /**
203
+ * Compare the output of two models (or two outputs of the same model).
204
+ */
205
+ export class LLMPairwiseStringEvaluator extends LLMEvalChain {
206
+ constructor() {
207
+ super(...arguments);
208
+ /**
209
+ * The name of the evaluation.
210
+ */
211
+ Object.defineProperty(this, "evaluationName", {
212
+ enumerable: true,
213
+ configurable: true,
214
+ writable: true,
215
+ value: this.constructor.name
216
+ });
217
+ }
218
+ /**
219
+ * Evaluate the output string pairs.
220
+ * @param args
221
+ * @param callOptions
222
+ * @param config
223
+ * @return A dictionary containing the preference, scores, and/or other information.
224
+ */
225
+ evaluateStringPairs(args, callOptions, config) {
226
+ this.checkEvaluationArgs(args.reference, args.input);
227
+ return this._evaluateStringPairs(args, callOptions, config);
228
+ }
229
+ }
230
+ /**
231
+ * Interface for evaluating agent trajectories.
232
+ */
233
+ export class AgentTrajectoryEvaluator extends LLMEvalChain {
234
+ constructor() {
235
+ super(...arguments);
236
+ Object.defineProperty(this, "requiresInput", {
237
+ enumerable: true,
238
+ configurable: true,
239
+ writable: true,
240
+ value: true
241
+ });
242
+ /**
243
+ * The name of the evaluation.
244
+ */
245
+ Object.defineProperty(this, "evaluationName", {
246
+ enumerable: true,
247
+ configurable: true,
248
+ writable: true,
249
+ value: this.constructor.name
250
+ });
251
+ }
252
+ /**
253
+ * Evaluate a trajectory.
254
+ * @return The evaluation result.
255
+ * @param args
256
+ * @param callOptions
257
+ * @param config
258
+ */
259
+ evaluateAgentTrajectory(args, callOptions, config) {
260
+ this.checkEvaluationArgs(args.reference, args.input);
261
+ return this._evaluateAgentTrajectory(args, callOptions, config);
262
+ }
263
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./pairwise.cjs"), exports);
@@ -0,0 +1 @@
1
+ export * from "./pairwise.js";
@@ -0,0 +1 @@
1
+ export * from "./pairwise.js";