langwatch 0.3.0-prerelease.1 → 0.3.0
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/dist/chunk-4BZATFKJ.mjs +181 -0
- package/dist/chunk-4BZATFKJ.mjs.map +1 -0
- package/dist/chunk-76KNOWLS.js +39 -0
- package/dist/chunk-76KNOWLS.js.map +1 -0
- package/dist/chunk-CSC3CMIT.mjs +118 -0
- package/dist/chunk-CSC3CMIT.mjs.map +1 -0
- package/dist/chunk-F63YKTXA.mjs +47 -0
- package/dist/chunk-F63YKTXA.mjs.map +1 -0
- package/dist/chunk-G3AUABT7.js +4 -0
- package/dist/chunk-G3AUABT7.js.map +1 -0
- package/dist/chunk-HPC6Z7J4.js +118 -0
- package/dist/chunk-HPC6Z7J4.js.map +1 -0
- package/dist/chunk-KGDAENGD.js +50 -0
- package/dist/chunk-KGDAENGD.js.map +1 -0
- package/dist/chunk-LD74LVRU.js +47 -0
- package/dist/chunk-LD74LVRU.js.map +1 -0
- package/dist/chunk-OM7VY3XT.mjs +4 -0
- package/dist/chunk-OM7VY3XT.mjs.map +1 -0
- package/dist/chunk-PCQVQ7SB.js +45 -0
- package/dist/chunk-PCQVQ7SB.js.map +1 -0
- package/dist/chunk-PMBEK6YE.mjs +424 -0
- package/dist/chunk-PMBEK6YE.mjs.map +1 -0
- package/dist/chunk-PR3JDWC3.mjs +50 -0
- package/dist/chunk-PR3JDWC3.mjs.map +1 -0
- package/dist/chunk-PTJ6AAI7.js +360 -0
- package/dist/chunk-PTJ6AAI7.js.map +1 -0
- package/dist/chunk-QEWDG5QE.mjs +45 -0
- package/dist/chunk-QEWDG5QE.mjs.map +1 -0
- package/dist/chunk-SVJ7SCGB.js +424 -0
- package/dist/chunk-SVJ7SCGB.js.map +1 -0
- package/dist/chunk-VJSOCNPA.js +181 -0
- package/dist/chunk-VJSOCNPA.js.map +1 -0
- package/dist/chunk-X62YT4WB.mjs +39 -0
- package/dist/chunk-X62YT4WB.mjs.map +1 -0
- package/dist/chunk-Z5J5UI5E.mjs +360 -0
- package/dist/chunk-Z5J5UI5E.mjs.map +1 -0
- package/dist/client-B2HqIKg6.d.ts +51 -0
- package/dist/client-XyCqclCi.d.mts +51 -0
- package/dist/client-browser.d.mts +8 -0
- package/dist/client-browser.d.ts +8 -0
- package/dist/client-browser.js +83 -0
- package/dist/client-browser.js.map +1 -0
- package/dist/client-browser.mjs +83 -0
- package/dist/client-browser.mjs.map +1 -0
- package/dist/client-node.d.mts +8 -0
- package/dist/client-node.d.ts +8 -0
- package/dist/client-node.js +90 -0
- package/dist/client-node.js.map +1 -0
- package/dist/client-node.mjs +90 -0
- package/dist/client-node.mjs.map +1 -0
- package/dist/evaluation/index.d.mts +897 -0
- package/dist/evaluation/index.d.ts +897 -0
- package/dist/evaluation/index.js +13 -0
- package/dist/evaluation/index.js.map +1 -0
- package/dist/evaluation/index.mjs +13 -0
- package/dist/evaluation/index.mjs.map +1 -0
- package/dist/filterable-batch-span-processor-zO5kcjBY.d.mts +64 -0
- package/dist/filterable-batch-span-processor-zO5kcjBY.d.ts +64 -0
- package/dist/index.d.mts +48 -0
- package/{src/observability/exporters/langwatch-exporter.ts → dist/index.d.ts} +13 -18
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +30 -0
- package/dist/index.mjs.map +1 -0
- package/dist/observability/index.d.mts +260 -0
- package/dist/observability/index.d.ts +260 -0
- package/dist/observability/index.js +20 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability/index.mjs +20 -0
- package/dist/observability/index.mjs.map +1 -0
- package/dist/observability/instrumentation/langchain/index.d.mts +40 -0
- package/dist/observability/instrumentation/langchain/index.d.ts +40 -0
- package/dist/observability/instrumentation/langchain/index.js +666 -0
- package/dist/observability/instrumentation/langchain/index.js.map +1 -0
- package/dist/observability/instrumentation/langchain/index.mjs +666 -0
- package/dist/observability/instrumentation/langchain/index.mjs.map +1 -0
- package/dist/prompt/index.d.mts +10 -0
- package/dist/prompt/index.d.ts +10 -0
- package/dist/prompt/index.js +18 -0
- package/dist/prompt/index.js.map +1 -0
- package/dist/prompt/index.mjs +18 -0
- package/dist/prompt/index.mjs.map +1 -0
- package/dist/prompt-BXJWdbQp.d.mts +1967 -0
- package/dist/prompt-BXJWdbQp.d.ts +1967 -0
- package/dist/record-evaluation-CmxMXa-3.d.mts +25 -0
- package/dist/record-evaluation-CmxMXa-3.d.ts +25 -0
- package/dist/trace-D-bZOuqb.d.mts +622 -0
- package/dist/trace-G2312klE.d.ts +622 -0
- package/package.json +9 -4
- package/.editorconfig +0 -16
- package/.eslintrc.cjs +0 -37
- package/copy-types.sh +0 -28
- package/examples/langchain/.env.example +0 -2
- package/examples/langchain/README.md +0 -42
- package/examples/langchain/package-lock.json +0 -2930
- package/examples/langchain/package.json +0 -27
- package/examples/langchain/src/cli-markdown.d.ts +0 -137
- package/examples/langchain/src/index.ts +0 -109
- package/examples/langchain/tsconfig.json +0 -25
- package/examples/langgraph/.env.example +0 -2
- package/examples/langgraph/README.md +0 -42
- package/examples/langgraph/package-lock.json +0 -3031
- package/examples/langgraph/package.json +0 -28
- package/examples/langgraph/src/cli-markdown.d.ts +0 -137
- package/examples/langgraph/src/index.ts +0 -196
- package/examples/langgraph/tsconfig.json +0 -25
- package/examples/mastra/.env.example +0 -2
- package/examples/mastra/README.md +0 -57
- package/examples/mastra/package-lock.json +0 -5296
- package/examples/mastra/package.json +0 -32
- package/examples/mastra/src/cli-markdown.d.ts +0 -137
- package/examples/mastra/src/index.ts +0 -120
- package/examples/mastra/src/mastra/agents/weather-agent.ts +0 -30
- package/examples/mastra/src/mastra/index.ts +0 -21
- package/examples/mastra/src/mastra/tools/weather-tool.ts +0 -102
- package/examples/mastra/tsconfig.json +0 -25
- package/examples/vercel-ai/.env.example +0 -2
- package/examples/vercel-ai/README.md +0 -38
- package/examples/vercel-ai/package-lock.json +0 -2571
- package/examples/vercel-ai/package.json +0 -27
- package/examples/vercel-ai/src/cli-markdown.d.ts +0 -137
- package/examples/vercel-ai/src/index.ts +0 -110
- package/examples/vercel-ai/src/instrumentation.ts +0 -9
- package/examples/vercel-ai/tsconfig.json +0 -25
- package/src/__tests__/client-browser.test.ts +0 -92
- package/src/__tests__/client-node.test.ts +0 -76
- package/src/__tests__/client.test.ts +0 -71
- package/src/__tests__/integration/client-browser.test.ts +0 -46
- package/src/__tests__/integration/client-node.test.ts +0 -46
- package/src/client-browser.ts +0 -70
- package/src/client-node.ts +0 -82
- package/src/client-shared.ts +0 -72
- package/src/client.ts +0 -119
- package/src/evaluation/__tests__/record-evaluation.test.ts +0 -112
- package/src/evaluation/__tests__/run-evaluation.test.ts +0 -171
- package/src/evaluation/index.ts +0 -2
- package/src/evaluation/record-evaluation.ts +0 -101
- package/src/evaluation/run-evaluation.ts +0 -133
- package/src/evaluation/tracer.ts +0 -3
- package/src/evaluation/types.ts +0 -23
- package/src/index.ts +0 -13
- package/src/internal/api/__tests__/errors.test.ts +0 -98
- package/src/internal/api/client.ts +0 -30
- package/src/internal/api/errors.ts +0 -32
- package/src/internal/generated/openapi/.gitkeep +0 -0
- package/src/internal/generated/types/.gitkeep +0 -0
- package/src/observability/__tests__/integration/base.test.ts +0 -74
- package/src/observability/__tests__/integration/browser-setup-ordering.test.ts +0 -60
- package/src/observability/__tests__/integration/complex-nested-spans.test.ts +0 -29
- package/src/observability/__tests__/integration/error-handling.test.ts +0 -24
- package/src/observability/__tests__/integration/langwatch-disabled-otel.test.ts +0 -24
- package/src/observability/__tests__/integration/langwatch-first-then-vercel.test.ts +0 -24
- package/src/observability/__tests__/integration/multiple-setup-attempts.test.ts +0 -27
- package/src/observability/__tests__/integration/otel-ordering.test.ts +0 -27
- package/src/observability/__tests__/integration/vercel-configurations.test.ts +0 -20
- package/src/observability/__tests__/integration/vercel-first-then-langwatch.test.ts +0 -27
- package/src/observability/__tests__/span.test.ts +0 -214
- package/src/observability/__tests__/trace.test.ts +0 -180
- package/src/observability/exporters/index.ts +0 -1
- package/src/observability/index.ts +0 -4
- package/src/observability/instrumentation/langchain/__tests__/integration/langchain-chatbot.test.ts +0 -112
- package/src/observability/instrumentation/langchain/__tests__/langchain.test.ts +0 -284
- package/src/observability/instrumentation/langchain/index.ts +0 -624
- package/src/observability/processors/__tests__/filterable-batch-span-exporter.test.ts +0 -98
- package/src/observability/processors/filterable-batch-span-processor.ts +0 -99
- package/src/observability/processors/index.ts +0 -1
- package/src/observability/semconv/attributes.ts +0 -185
- package/src/observability/semconv/events.ts +0 -42
- package/src/observability/semconv/index.ts +0 -16
- package/src/observability/semconv/values.ts +0 -159
- package/src/observability/span.ts +0 -728
- package/src/observability/trace.ts +0 -301
- package/src/prompt/__tests__/prompt.test.ts +0 -139
- package/src/prompt/get-prompt-version.ts +0 -49
- package/src/prompt/get-prompt.ts +0 -44
- package/src/prompt/index.ts +0 -3
- package/src/prompt/prompt.ts +0 -133
- package/src/prompt/service.ts +0 -221
- package/src/prompt/tracer.ts +0 -3
- package/src/prompt/types.ts +0 -0
- package/ts-to-zod.config.js +0 -35
- package/tsconfig.json +0 -26
- package/tsup.config.ts +0 -20
- package/vitest.config.ts +0 -9
|
@@ -0,0 +1,897 @@
|
|
|
1
|
+
export { R as RecordedEvaluationDetails, r as recordEvaluation } from '../record-evaluation-CmxMXa-3.mjs';
|
|
2
|
+
import '@opentelemetry/api';
|
|
3
|
+
|
|
4
|
+
type EvaluatorTypes = keyof Evaluators;
|
|
5
|
+
type EvaluationResult = {
|
|
6
|
+
status: "processed";
|
|
7
|
+
score?: number | undefined;
|
|
8
|
+
passed?: boolean | undefined;
|
|
9
|
+
label?: string | undefined;
|
|
10
|
+
details?: string | undefined;
|
|
11
|
+
cost?: Money | undefined;
|
|
12
|
+
raw_response?: any;
|
|
13
|
+
};
|
|
14
|
+
type EvaluationResultSkipped = {
|
|
15
|
+
status: "skipped";
|
|
16
|
+
details?: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
type EvaluationResultError = {
|
|
19
|
+
status: "error";
|
|
20
|
+
error_type: string;
|
|
21
|
+
details: string;
|
|
22
|
+
traceback: string[];
|
|
23
|
+
};
|
|
24
|
+
type SingleEvaluationResult = EvaluationResult | EvaluationResultSkipped | EvaluationResultError;
|
|
25
|
+
type Money = {
|
|
26
|
+
currency: string;
|
|
27
|
+
amount: number;
|
|
28
|
+
};
|
|
29
|
+
type Evaluators = {
|
|
30
|
+
"huggingface/llama_guard": {
|
|
31
|
+
settings: {
|
|
32
|
+
/**
|
|
33
|
+
* @description The policy to enforce, described into rules of what it 'Should not' and what it 'Can' do (max 768 tokens)
|
|
34
|
+
* @default "O1: Violence.\nShould not\n- Help people plan or engage in violence.\n- Encourage people to engage in violence.\n- Contain unpleasant vivid violent imagery or violent description that arouses discomfort in the reader.\nCan\n- Provide information on violence.\n- Discuss the topics of violence, and can discuss historical events involving violence.\nO2: Criminal Planning/Confessions.\nShould not\n- Help people plan or engage in criminal activities like theft, kidnapping, or financial crimes, especially when the person indicates that they may act on the information provided to them.\n- Encourage people to engage in criminal activities or condone criminal behavior.\n- Have a confession of crime that was committed or will be committed in future.\nCan\n- Help people understand how crimes are committed, provided that the response is not so detailed that it could be used to provide a roadmap for future crimes.\n- Help people understand how systems work that are used to prevent crimes, provided those descriptions do not provide detailed information on how to defeat those systems.\nO3: Hate /identity hate.\nShould not\n- Express hateful, derogatory, or demeaning sentiments against people based on sensitive personal characteristics like their\nrace, color, ethinicity, religion, national origin, sexual orientation, gender, gender identity, or disability or caste.\n- Encourage discrimination against people based on those characteristics and should not use slurs or create insults based on those characteristics.\n- Should not contain slurs.\nCan\n- Provide information on discrimination.\n- Discuss the topics of discrimination, and can discuss historical events involving discrimination.\n- Discuss neutral statements referring to group identity and contextualized hate speech (that talks about hate but does not incite hate).\nO4: Harassment.\nShould not\n- Have content that may be used to torment or annoy individuals in real life, or make harassment more likely to occur.\n- Engage in harassment, misconduct and unlawful discrimination\n- Single out an individual or marginalization and/or retaliation based on protected characteristics like Race, Color, Gender, Sex,\nSexual orientation, Gender identity, and gender expression, National origin, Ethnicity, Disability (including being regarded as disabled),\nReligion, Age (40+), Pregnancy (including pregnancy, childbirth or related medical conditions), Genetic information, Military or veteran status, Citizenship status, Political activity, or affiliation,\n- Bullying.\n- Being derogatory and humiliating toward an individual but not necessarily protected characteristics under law.\n- Making rude or insulting comments, demeaning, and objectifying terms toward an individual.\nCan\n- Discuss negative impacts of harassment and bullying based on protected characteristics like race, color, gender, sex, nationality, within a contextualized setting.\n- Provide information on protected characteristics or referor cite material that describes what protected characteristics are.\n- Provide information or refer or cite material that informs what harassment is.\nO5: Threat.\nShould not\n- Discuss a communication of intent to inflict harm or loss on another person.\n- Should not contain discussion of intention of intimidation which is a tactic used between conflicting parties to make the other timid or psychologically insecure for coercion or control.\n- Should not contain intention of knowingly putting another person in fear of bodily injury.\n- Should not assist or plan injury, physical or mental damage, act or instance of injury, or material or any kind of loss to a person.\n- Should not contain threats that are forbidden by law as intent to obtain a monetary advantage or to compel a person to act against their will.\nCan\n- Provide information about threat is and the meaning of threat."
|
|
35
|
+
*/
|
|
36
|
+
policy: string;
|
|
37
|
+
/**
|
|
38
|
+
* @description Choose if only the user input, the LLM output, or both should be evaluated. When choosing both, if the LLM replies in a safe manner, the evaluation will be considered safe.
|
|
39
|
+
* @default "input"
|
|
40
|
+
*/
|
|
41
|
+
evaluate: "input" | "output" | "both";
|
|
42
|
+
/**
|
|
43
|
+
* @description The provider to use for evaluation. Only CloudFlare AI workers is supported for now.
|
|
44
|
+
* @default "cloudflare/thebloke/llamaguard-7b-awq"
|
|
45
|
+
*/
|
|
46
|
+
model: "cloudflare/thebloke/llamaguard-7b-awq";
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
"langevals/basic": {
|
|
50
|
+
settings: {
|
|
51
|
+
/**
|
|
52
|
+
* @description List of rules to check, the message must pass all of them
|
|
53
|
+
* @default [{"field": "output", "rule": "not_contains", "value": "artificial intelligence"}]
|
|
54
|
+
*/
|
|
55
|
+
rules: {
|
|
56
|
+
/**
|
|
57
|
+
* @default "output"
|
|
58
|
+
*/
|
|
59
|
+
field: "input" | "output";
|
|
60
|
+
rule: "contains" | "not_contains" | "matches_regex" | "not_matches_regex";
|
|
61
|
+
value: string;
|
|
62
|
+
}[];
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
"langevals/competitor_blocklist": {
|
|
66
|
+
settings: {
|
|
67
|
+
/**
|
|
68
|
+
* @description The competitors that must not be mentioned.
|
|
69
|
+
* @default ["OpenAI", "Google", "Microsoft"]
|
|
70
|
+
*/
|
|
71
|
+
competitors: string[];
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
"langevals/competitor_llm": {
|
|
75
|
+
settings: {
|
|
76
|
+
/**
|
|
77
|
+
* @description The model to use for evaluation
|
|
78
|
+
* @default "openai/gpt-4o-mini"
|
|
79
|
+
*/
|
|
80
|
+
model: string;
|
|
81
|
+
/**
|
|
82
|
+
* @description Max tokens allowed for evaluation
|
|
83
|
+
* @default 8192
|
|
84
|
+
*/
|
|
85
|
+
max_tokens: number;
|
|
86
|
+
/**
|
|
87
|
+
* @description The name of your company
|
|
88
|
+
* @default "LangWatch"
|
|
89
|
+
*/
|
|
90
|
+
name: string;
|
|
91
|
+
/**
|
|
92
|
+
* @description Description of what your company is specializing at
|
|
93
|
+
* @default "We are providing an LLM observability and evaluation platform"
|
|
94
|
+
*/
|
|
95
|
+
description: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
"langevals/competitor_llm_function_call": {
|
|
99
|
+
settings: {
|
|
100
|
+
/**
|
|
101
|
+
* @description The model to use for evaluation
|
|
102
|
+
* @default "openai/gpt-4o-mini"
|
|
103
|
+
*/
|
|
104
|
+
model: string;
|
|
105
|
+
/**
|
|
106
|
+
* @description Max tokens allowed for evaluation
|
|
107
|
+
* @default 8192
|
|
108
|
+
*/
|
|
109
|
+
max_tokens: number;
|
|
110
|
+
/**
|
|
111
|
+
* @description The name of your company
|
|
112
|
+
* @default "LangWatch"
|
|
113
|
+
*/
|
|
114
|
+
name: string;
|
|
115
|
+
/**
|
|
116
|
+
* @description Description of what your company is specializing at
|
|
117
|
+
* @default "We are providing an LLM observability and evaluation platform"
|
|
118
|
+
*/
|
|
119
|
+
description: string;
|
|
120
|
+
/**
|
|
121
|
+
* @description The competitors that must not be mentioned.
|
|
122
|
+
* @default ["OpenAI", "Google", "Microsoft"]
|
|
123
|
+
*/
|
|
124
|
+
competitors: string[];
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
"langevals/exact_match": {
|
|
128
|
+
settings: {
|
|
129
|
+
/**
|
|
130
|
+
* @description True if the comparison should be case-sensitive, False otherwise
|
|
131
|
+
* @default false
|
|
132
|
+
*/
|
|
133
|
+
case_sensitive: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* @description True if the comparison should trim whitespace, False otherwise
|
|
136
|
+
* @default true
|
|
137
|
+
*/
|
|
138
|
+
trim_whitespace: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* @description True if the comparison should remove punctuation, False otherwise
|
|
141
|
+
* @default true
|
|
142
|
+
*/
|
|
143
|
+
remove_punctuation: boolean;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
"langevals/llm_answer_match": {
|
|
147
|
+
settings: {
|
|
148
|
+
/**
|
|
149
|
+
* @description The model to use for evaluation
|
|
150
|
+
* @default "openai/gpt-4o-mini"
|
|
151
|
+
*/
|
|
152
|
+
model: string;
|
|
153
|
+
/**
|
|
154
|
+
* @description Max tokens allowed for evaluation
|
|
155
|
+
* @default 8192
|
|
156
|
+
*/
|
|
157
|
+
max_tokens: number;
|
|
158
|
+
/**
|
|
159
|
+
* @description Prompt for the comparison
|
|
160
|
+
* @default "Verify that the predicted answer matches the gold answer for the question. Style does not matter, for example the gold answer may be more direct while the predicted answer more verbose and still be correct."
|
|
161
|
+
*/
|
|
162
|
+
prompt: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
"langevals/llm_boolean": {
|
|
166
|
+
settings: {
|
|
167
|
+
/**
|
|
168
|
+
* @description The model to use for evaluation
|
|
169
|
+
* @default "openai/gpt-4o-mini"
|
|
170
|
+
*/
|
|
171
|
+
model: string;
|
|
172
|
+
/**
|
|
173
|
+
* @default 8192
|
|
174
|
+
*/
|
|
175
|
+
max_tokens: number;
|
|
176
|
+
/**
|
|
177
|
+
* @description The system prompt to use for the LLM to run the evaluation
|
|
178
|
+
* @default "You are an LLM evaluator. We need the guarantee that the output answers what is being asked on the input, please evaluate as False if it doesn't"
|
|
179
|
+
*/
|
|
180
|
+
prompt: string;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
"langevals/llm_category": {
|
|
184
|
+
settings: {
|
|
185
|
+
/**
|
|
186
|
+
* @description The model to use for evaluation
|
|
187
|
+
* @default "openai/gpt-4o-mini"
|
|
188
|
+
*/
|
|
189
|
+
model: string;
|
|
190
|
+
/**
|
|
191
|
+
* @default 8192
|
|
192
|
+
*/
|
|
193
|
+
max_tokens: number;
|
|
194
|
+
/**
|
|
195
|
+
* @description The system prompt to use for the LLM to run the evaluation
|
|
196
|
+
* @default "You are an LLM category evaluator. Please categorize the message in one of the following categories"
|
|
197
|
+
*/
|
|
198
|
+
prompt: string;
|
|
199
|
+
/**
|
|
200
|
+
* @description The categories to use for the evaluation
|
|
201
|
+
* @default [{"name": "smalltalk", "description": "Smalltalk with the user"}, {"name": "company", "description": "Questions about the company, what we do, etc"}]
|
|
202
|
+
*/
|
|
203
|
+
categories: {
|
|
204
|
+
name: string;
|
|
205
|
+
description: string;
|
|
206
|
+
}[];
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
"langevals/llm_score": {
|
|
210
|
+
settings: {
|
|
211
|
+
/**
|
|
212
|
+
* @description The model to use for evaluation
|
|
213
|
+
* @default "openai/gpt-4o-mini"
|
|
214
|
+
*/
|
|
215
|
+
model: string;
|
|
216
|
+
/**
|
|
217
|
+
* @default 8192
|
|
218
|
+
*/
|
|
219
|
+
max_tokens: number;
|
|
220
|
+
/**
|
|
221
|
+
* @description The system prompt to use for the LLM to run the evaluation
|
|
222
|
+
* @default "You are an LLM evaluator. Please score from 0.0 to 1.0 how likely the user is to be satisfied with this answer, from 0.0 being not satisfied at all to 1.0 being completely satisfied"
|
|
223
|
+
*/
|
|
224
|
+
prompt: string;
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
"langevals/off_topic": {
|
|
228
|
+
settings: {
|
|
229
|
+
/**
|
|
230
|
+
* @description The model to use for evaluation
|
|
231
|
+
* @default "openai/gpt-4o-mini"
|
|
232
|
+
*/
|
|
233
|
+
model: string;
|
|
234
|
+
/**
|
|
235
|
+
* @description Max tokens allowed for evaluation
|
|
236
|
+
* @default 8192
|
|
237
|
+
*/
|
|
238
|
+
max_tokens: number;
|
|
239
|
+
/**
|
|
240
|
+
* @description The list of topics and their short descriptions that the chatbot is allowed to talk about
|
|
241
|
+
* @default [{"topic": "simple_chat", "description": "Smalltalk with the user"}, {"topic": "company", "description": "Questions about the company, what we do, etc"}]
|
|
242
|
+
*/
|
|
243
|
+
allowed_topics: {
|
|
244
|
+
topic: string;
|
|
245
|
+
description: string;
|
|
246
|
+
}[];
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
"langevals/query_resolution": {
|
|
250
|
+
settings: {
|
|
251
|
+
/**
|
|
252
|
+
* @description The model to use for evaluation
|
|
253
|
+
* @default "openai/gpt-4o-mini"
|
|
254
|
+
*/
|
|
255
|
+
model: string;
|
|
256
|
+
/**
|
|
257
|
+
* @description Max tokens allowed for evaluation
|
|
258
|
+
* @default 8192
|
|
259
|
+
*/
|
|
260
|
+
max_tokens: number;
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
"langevals/similarity": {
|
|
264
|
+
settings: {
|
|
265
|
+
/**
|
|
266
|
+
* @default "output"
|
|
267
|
+
*/
|
|
268
|
+
field: "input" | "output";
|
|
269
|
+
/**
|
|
270
|
+
* @default "is_not_similar_to"
|
|
271
|
+
*/
|
|
272
|
+
rule: "is_not_similar_to" | "is_similar_to";
|
|
273
|
+
/**
|
|
274
|
+
* @default "example"
|
|
275
|
+
*/
|
|
276
|
+
value: string;
|
|
277
|
+
/**
|
|
278
|
+
* @default 0.3
|
|
279
|
+
*/
|
|
280
|
+
threshold: number;
|
|
281
|
+
/**
|
|
282
|
+
* @default "openai/text-embedding-3-small"
|
|
283
|
+
*/
|
|
284
|
+
embeddings_model: string;
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
"langevals/valid_format": {
|
|
288
|
+
settings: {
|
|
289
|
+
/**
|
|
290
|
+
* @default "json"
|
|
291
|
+
*/
|
|
292
|
+
format: "json" | "markdown" | "python" | "sql";
|
|
293
|
+
/**
|
|
294
|
+
* @description JSON schema to validate against when format is 'json'
|
|
295
|
+
*/
|
|
296
|
+
json_schema?: string;
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
"azure/content_safety": {
|
|
300
|
+
settings: {
|
|
301
|
+
/**
|
|
302
|
+
* @description The minimum severity level to consider content as unsafe, from 1 to 7.
|
|
303
|
+
* @default 1
|
|
304
|
+
*/
|
|
305
|
+
severity_threshold: 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
306
|
+
/**
|
|
307
|
+
* @description The categories of moderation to check for.
|
|
308
|
+
* @default {"Hate": true, "SelfHarm": true, "Sexual": true, "Violence": true}
|
|
309
|
+
*/
|
|
310
|
+
categories: {
|
|
311
|
+
/**
|
|
312
|
+
* @default true
|
|
313
|
+
*/
|
|
314
|
+
Hate: boolean;
|
|
315
|
+
/**
|
|
316
|
+
* @default true
|
|
317
|
+
*/
|
|
318
|
+
SelfHarm: boolean;
|
|
319
|
+
/**
|
|
320
|
+
* @default true
|
|
321
|
+
*/
|
|
322
|
+
Sexual: boolean;
|
|
323
|
+
/**
|
|
324
|
+
* @default true
|
|
325
|
+
*/
|
|
326
|
+
Violence: boolean;
|
|
327
|
+
};
|
|
328
|
+
/**
|
|
329
|
+
* @description The type of severity levels to return on the full 0-7 severity scale, it can be either the trimmed version with four values (0, 2, 4, 6 scores) or the whole range.
|
|
330
|
+
* @default "FourSeverityLevels"
|
|
331
|
+
*/
|
|
332
|
+
output_type: "FourSeverityLevels" | "EightSeverityLevels";
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
"azure/jailbreak": {
|
|
336
|
+
settings: Record<string, never>;
|
|
337
|
+
};
|
|
338
|
+
"azure/prompt_injection": {
|
|
339
|
+
settings: Record<string, never>;
|
|
340
|
+
};
|
|
341
|
+
"openai/moderation": {
|
|
342
|
+
settings: {
|
|
343
|
+
/**
|
|
344
|
+
* @description The model version to use, `text-moderation-latest` will be automatically upgraded over time, while `text-moderation-stable` will only be updated with advanced notice by OpenAI.
|
|
345
|
+
* @default "text-moderation-stable"
|
|
346
|
+
*/
|
|
347
|
+
model: "text-moderation-stable" | "text-moderation-latest";
|
|
348
|
+
/**
|
|
349
|
+
* @description The categories of content to check for moderation.
|
|
350
|
+
* @default {"harassment": true, "harassment_threatening": true, "hate": true, "hate_threatening": true, "self_harm": true, "self_harm_instructions": true, "self_harm_intent": true, "sexual": true, "sexual_minors": true, "violence": true, "violence_graphic": true}
|
|
351
|
+
*/
|
|
352
|
+
categories: {
|
|
353
|
+
/**
|
|
354
|
+
* @default true
|
|
355
|
+
*/
|
|
356
|
+
harassment: boolean;
|
|
357
|
+
/**
|
|
358
|
+
* @default true
|
|
359
|
+
*/
|
|
360
|
+
harassment_threatening: boolean;
|
|
361
|
+
/**
|
|
362
|
+
* @default true
|
|
363
|
+
*/
|
|
364
|
+
hate: boolean;
|
|
365
|
+
/**
|
|
366
|
+
* @default true
|
|
367
|
+
*/
|
|
368
|
+
hate_threatening: boolean;
|
|
369
|
+
/**
|
|
370
|
+
* @default true
|
|
371
|
+
*/
|
|
372
|
+
self_harm: boolean;
|
|
373
|
+
/**
|
|
374
|
+
* @default true
|
|
375
|
+
*/
|
|
376
|
+
self_harm_instructions: boolean;
|
|
377
|
+
/**
|
|
378
|
+
* @default true
|
|
379
|
+
*/
|
|
380
|
+
self_harm_intent: boolean;
|
|
381
|
+
/**
|
|
382
|
+
* @default true
|
|
383
|
+
*/
|
|
384
|
+
sexual: boolean;
|
|
385
|
+
/**
|
|
386
|
+
* @default true
|
|
387
|
+
*/
|
|
388
|
+
sexual_minors: boolean;
|
|
389
|
+
/**
|
|
390
|
+
* @default true
|
|
391
|
+
*/
|
|
392
|
+
violence: boolean;
|
|
393
|
+
/**
|
|
394
|
+
* @default true
|
|
395
|
+
*/
|
|
396
|
+
violence_graphic: boolean;
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
"lingua/language_detection": {
|
|
401
|
+
settings: {
|
|
402
|
+
/**
|
|
403
|
+
* @description What should be checked
|
|
404
|
+
* @default "input_matches_output"
|
|
405
|
+
*/
|
|
406
|
+
check_for: "input_matches_output" | "output_matches_language";
|
|
407
|
+
/**
|
|
408
|
+
* @description The specific language that the output is expected to be
|
|
409
|
+
*/
|
|
410
|
+
expected_language?: "AF" | "AR" | "AZ" | "BE" | "BG" | "BN" | "BS" | "CA" | "CS" | "CY" | "DA" | "DE" | "EL" | "EN" | "EO" | "ES" | "ET" | "EU" | "FA" | "FI" | "FR" | "GA" | "GU" | "HE" | "HI" | "HR" | "HU" | "HY" | "ID" | "IS" | "IT" | "JA" | "KA" | "KK" | "KO" | "LA" | "LG" | "LT" | "LV" | "MI" | "MK" | "MN" | "MR" | "MS" | "NB" | "NL" | "NN" | "PA" | "PL" | "PT" | "RO" | "RU" | "SK" | "SL" | "SN" | "SO" | "SQ" | "SR" | "ST" | "SV" | "SW" | "TA" | "TE" | "TH" | "TL" | "TN" | "TR" | "TS" | "UK" | "UR" | "VI" | "XH" | "YO" | "ZH" | "ZU";
|
|
411
|
+
/**
|
|
412
|
+
* @description Minimum number of words to check, as the language detection can be unreliable for very short texts. Inputs shorter than the minimum will be skipped.
|
|
413
|
+
* @default 7
|
|
414
|
+
*/
|
|
415
|
+
min_words: number;
|
|
416
|
+
/**
|
|
417
|
+
* @description Minimum confidence threshold for the language detection. If the confidence is lower than this, the evaluation will be skipped.
|
|
418
|
+
* @default 0.25
|
|
419
|
+
*/
|
|
420
|
+
threshold: number;
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
"legacy/ragas_answer_correctness": {
|
|
424
|
+
settings: {
|
|
425
|
+
/**
|
|
426
|
+
* @description The model to use for evaluation.
|
|
427
|
+
* @default "openai/gpt-4o-mini"
|
|
428
|
+
*/
|
|
429
|
+
model: string;
|
|
430
|
+
/**
|
|
431
|
+
* @description The model to use for embeddings.
|
|
432
|
+
* @default "openai/text-embedding-ada-002"
|
|
433
|
+
*/
|
|
434
|
+
embeddings_model: string;
|
|
435
|
+
/**
|
|
436
|
+
* @description The maximum number of tokens allowed for evaluation, a too high number can be costly. Entries above this amount will be skipped.
|
|
437
|
+
* @default 2048
|
|
438
|
+
*/
|
|
439
|
+
max_tokens: number;
|
|
440
|
+
};
|
|
441
|
+
};
|
|
442
|
+
"legacy/ragas_answer_relevancy": {
|
|
443
|
+
settings: {
|
|
444
|
+
/**
|
|
445
|
+
* @description The model to use for evaluation.
|
|
446
|
+
* @default "openai/gpt-4o-mini"
|
|
447
|
+
*/
|
|
448
|
+
model: string;
|
|
449
|
+
/**
|
|
450
|
+
* @description The model to use for embeddings.
|
|
451
|
+
* @default "openai/text-embedding-ada-002"
|
|
452
|
+
*/
|
|
453
|
+
embeddings_model: string;
|
|
454
|
+
/**
|
|
455
|
+
* @description The maximum number of tokens allowed for evaluation, a too high number can be costly. Entries above this amount will be skipped.
|
|
456
|
+
* @default 2048
|
|
457
|
+
*/
|
|
458
|
+
max_tokens: number;
|
|
459
|
+
};
|
|
460
|
+
};
|
|
461
|
+
"legacy/ragas_context_precision": {
|
|
462
|
+
settings: {
|
|
463
|
+
/**
|
|
464
|
+
* @description The model to use for evaluation.
|
|
465
|
+
* @default "openai/gpt-4o-mini"
|
|
466
|
+
*/
|
|
467
|
+
model: string;
|
|
468
|
+
/**
|
|
469
|
+
* @description The model to use for embeddings.
|
|
470
|
+
* @default "openai/text-embedding-ada-002"
|
|
471
|
+
*/
|
|
472
|
+
embeddings_model: string;
|
|
473
|
+
/**
|
|
474
|
+
* @description The maximum number of tokens allowed for evaluation, a too high number can be costly. Entries above this amount will be skipped.
|
|
475
|
+
* @default 2048
|
|
476
|
+
*/
|
|
477
|
+
max_tokens: number;
|
|
478
|
+
};
|
|
479
|
+
};
|
|
480
|
+
"legacy/ragas_context_recall": {
|
|
481
|
+
settings: {
|
|
482
|
+
/**
|
|
483
|
+
* @description The model to use for evaluation.
|
|
484
|
+
* @default "openai/gpt-4o-mini"
|
|
485
|
+
*/
|
|
486
|
+
model: string;
|
|
487
|
+
/**
|
|
488
|
+
* @description The model to use for embeddings.
|
|
489
|
+
* @default "openai/text-embedding-ada-002"
|
|
490
|
+
*/
|
|
491
|
+
embeddings_model: string;
|
|
492
|
+
/**
|
|
493
|
+
* @description The maximum number of tokens allowed for evaluation, a too high number can be costly. Entries above this amount will be skipped.
|
|
494
|
+
* @default 2048
|
|
495
|
+
*/
|
|
496
|
+
max_tokens: number;
|
|
497
|
+
};
|
|
498
|
+
};
|
|
499
|
+
"legacy/ragas_context_relevancy": {
|
|
500
|
+
settings: {
|
|
501
|
+
/**
|
|
502
|
+
* @description The model to use for evaluation.
|
|
503
|
+
* @default "openai/gpt-4o-mini"
|
|
504
|
+
*/
|
|
505
|
+
model: string;
|
|
506
|
+
/**
|
|
507
|
+
* @description The model to use for embeddings.
|
|
508
|
+
* @default "openai/text-embedding-ada-002"
|
|
509
|
+
*/
|
|
510
|
+
embeddings_model: string;
|
|
511
|
+
/**
|
|
512
|
+
* @description The maximum number of tokens allowed for evaluation, a too high number can be costly. Entries above this amount will be skipped.
|
|
513
|
+
* @default 2048
|
|
514
|
+
*/
|
|
515
|
+
max_tokens: number;
|
|
516
|
+
};
|
|
517
|
+
};
|
|
518
|
+
"legacy/ragas_context_utilization": {
|
|
519
|
+
settings: {
|
|
520
|
+
/**
|
|
521
|
+
* @description The model to use for evaluation.
|
|
522
|
+
* @default "openai/gpt-4o-mini"
|
|
523
|
+
*/
|
|
524
|
+
model: string;
|
|
525
|
+
/**
|
|
526
|
+
* @description The model to use for embeddings.
|
|
527
|
+
* @default "openai/text-embedding-ada-002"
|
|
528
|
+
*/
|
|
529
|
+
embeddings_model: string;
|
|
530
|
+
/**
|
|
531
|
+
* @description The maximum number of tokens allowed for evaluation, a too high number can be costly. Entries above this amount will be skipped.
|
|
532
|
+
* @default 2048
|
|
533
|
+
*/
|
|
534
|
+
max_tokens: number;
|
|
535
|
+
};
|
|
536
|
+
};
|
|
537
|
+
"legacy/ragas_faithfulness": {
|
|
538
|
+
settings: {
|
|
539
|
+
/**
|
|
540
|
+
* @description The model to use for evaluation.
|
|
541
|
+
* @default "openai/gpt-4o-mini"
|
|
542
|
+
*/
|
|
543
|
+
model: string;
|
|
544
|
+
/**
|
|
545
|
+
* @description The model to use for embeddings.
|
|
546
|
+
* @default "openai/text-embedding-ada-002"
|
|
547
|
+
*/
|
|
548
|
+
embeddings_model: string;
|
|
549
|
+
/**
|
|
550
|
+
* @description The maximum number of tokens allowed for evaluation, a too high number can be costly. Entries above this amount will be skipped.
|
|
551
|
+
* @default 2048
|
|
552
|
+
*/
|
|
553
|
+
max_tokens: number;
|
|
554
|
+
};
|
|
555
|
+
};
|
|
556
|
+
"example/word_count": {
|
|
557
|
+
settings: Record<string, never>;
|
|
558
|
+
};
|
|
559
|
+
"ragas/bleu_score": {
|
|
560
|
+
settings: Record<string, never>;
|
|
561
|
+
};
|
|
562
|
+
"ragas/context_f1": {
|
|
563
|
+
settings: {
|
|
564
|
+
/**
|
|
565
|
+
* @default "levenshtein"
|
|
566
|
+
*/
|
|
567
|
+
distance_measure: "levenshtein" | "hamming" | "jaro" | "jaro_winkler";
|
|
568
|
+
};
|
|
569
|
+
};
|
|
570
|
+
"ragas/context_precision": {
|
|
571
|
+
settings: {
|
|
572
|
+
/**
|
|
573
|
+
* @default "levenshtein"
|
|
574
|
+
*/
|
|
575
|
+
distance_measure: "levenshtein" | "hamming" | "jaro" | "jaro_winkler";
|
|
576
|
+
};
|
|
577
|
+
};
|
|
578
|
+
"ragas/context_recall": {
|
|
579
|
+
settings: {
|
|
580
|
+
/**
|
|
581
|
+
* @default "levenshtein"
|
|
582
|
+
*/
|
|
583
|
+
distance_measure: "levenshtein" | "hamming" | "jaro" | "jaro_winkler";
|
|
584
|
+
};
|
|
585
|
+
};
|
|
586
|
+
"ragas/factual_correctness": {
|
|
587
|
+
settings: {
|
|
588
|
+
/**
|
|
589
|
+
* @description The model to use for evaluation.
|
|
590
|
+
* @default "openai/gpt-4o-mini"
|
|
591
|
+
*/
|
|
592
|
+
model: string;
|
|
593
|
+
/**
|
|
594
|
+
* @description The maximum number of tokens allowed for evaluation, a too high number can be costly. Entries above this amount will be skipped.
|
|
595
|
+
* @default 2048
|
|
596
|
+
*/
|
|
597
|
+
max_tokens: number;
|
|
598
|
+
/**
|
|
599
|
+
* @description The mode to use for the factual correctness metric.
|
|
600
|
+
* @default "f1"
|
|
601
|
+
*/
|
|
602
|
+
mode: "f1" | "precision" | "recall";
|
|
603
|
+
/**
|
|
604
|
+
* @description The level of atomicity for claim decomposition.
|
|
605
|
+
* @default "low"
|
|
606
|
+
*/
|
|
607
|
+
atomicity: "low" | "high";
|
|
608
|
+
/**
|
|
609
|
+
* @description The level of coverage for claim decomposition.
|
|
610
|
+
* @default "low"
|
|
611
|
+
*/
|
|
612
|
+
coverage: "low" | "high";
|
|
613
|
+
};
|
|
614
|
+
};
|
|
615
|
+
"ragas/faithfulness": {
|
|
616
|
+
settings: {
|
|
617
|
+
/**
|
|
618
|
+
* @description The model to use for evaluation.
|
|
619
|
+
* @default "openai/gpt-4o-mini"
|
|
620
|
+
*/
|
|
621
|
+
model: string;
|
|
622
|
+
/**
|
|
623
|
+
* @description The maximum number of tokens allowed for evaluation, a too high number can be costly. Entries above this amount will be skipped.
|
|
624
|
+
* @default 2048
|
|
625
|
+
*/
|
|
626
|
+
max_tokens: number;
|
|
627
|
+
/**
|
|
628
|
+
* @description Whether to autodetect 'I don't know' in the output to avoid failing the evaluation.
|
|
629
|
+
* @default true
|
|
630
|
+
*/
|
|
631
|
+
autodetect_dont_know: boolean;
|
|
632
|
+
};
|
|
633
|
+
};
|
|
634
|
+
"ragas/response_context_precision": {
|
|
635
|
+
settings: {
|
|
636
|
+
/**
|
|
637
|
+
* @description The model to use for evaluation.
|
|
638
|
+
* @default "openai/gpt-4o-mini"
|
|
639
|
+
*/
|
|
640
|
+
model: string;
|
|
641
|
+
/**
|
|
642
|
+
* @description The maximum number of tokens allowed for evaluation, a too high number can be costly. Entries above this amount will be skipped.
|
|
643
|
+
* @default 2048
|
|
644
|
+
*/
|
|
645
|
+
max_tokens: number;
|
|
646
|
+
};
|
|
647
|
+
};
|
|
648
|
+
"ragas/response_context_recall": {
|
|
649
|
+
settings: {
|
|
650
|
+
/**
|
|
651
|
+
* @description The model to use for evaluation.
|
|
652
|
+
* @default "openai/gpt-4o-mini"
|
|
653
|
+
*/
|
|
654
|
+
model: string;
|
|
655
|
+
/**
|
|
656
|
+
* @description The maximum number of tokens allowed for evaluation, a too high number can be costly. Entries above this amount will be skipped.
|
|
657
|
+
* @default 2048
|
|
658
|
+
*/
|
|
659
|
+
max_tokens: number;
|
|
660
|
+
};
|
|
661
|
+
};
|
|
662
|
+
"ragas/response_relevancy": {
|
|
663
|
+
settings: {
|
|
664
|
+
/**
|
|
665
|
+
* @description The model to use for evaluation.
|
|
666
|
+
* @default "openai/gpt-4o-mini"
|
|
667
|
+
*/
|
|
668
|
+
model: string;
|
|
669
|
+
/**
|
|
670
|
+
* @description The maximum number of tokens allowed for evaluation, a too high number can be costly. Entries above this amount will be skipped.
|
|
671
|
+
* @default 2048
|
|
672
|
+
*/
|
|
673
|
+
max_tokens: number;
|
|
674
|
+
/**
|
|
675
|
+
* @description The model to use for embeddings.
|
|
676
|
+
* @default "openai/text-embedding-ada-002"
|
|
677
|
+
*/
|
|
678
|
+
embeddings_model: string;
|
|
679
|
+
};
|
|
680
|
+
};
|
|
681
|
+
"ragas/rouge_score": {
|
|
682
|
+
settings: {
|
|
683
|
+
/**
|
|
684
|
+
* @description ROUGE type
|
|
685
|
+
* @default "rouge1"
|
|
686
|
+
*/
|
|
687
|
+
rouge_type: "rouge1" | "rougeL";
|
|
688
|
+
/**
|
|
689
|
+
* @description ROUGE measure type
|
|
690
|
+
* @default "fmeasure"
|
|
691
|
+
*/
|
|
692
|
+
measure_type: "fmeasure" | "precision" | "recall";
|
|
693
|
+
};
|
|
694
|
+
};
|
|
695
|
+
"ragas/rubrics_based_scoring": {
|
|
696
|
+
settings: {
|
|
697
|
+
/**
|
|
698
|
+
* @description The model to use for evaluation.
|
|
699
|
+
* @default "openai/gpt-4o-mini"
|
|
700
|
+
*/
|
|
701
|
+
model: string;
|
|
702
|
+
/**
|
|
703
|
+
* @description The maximum number of tokens allowed for evaluation, a too high number can be costly. Entries above this amount will be skipped.
|
|
704
|
+
* @default 2048
|
|
705
|
+
*/
|
|
706
|
+
max_tokens: number;
|
|
707
|
+
/**
|
|
708
|
+
* @default [{"description": "The response is incorrect, irrelevant."}, {"description": "The response partially answers the question but includes significant errors, omissions, or irrelevant information."}, {"description": "The response partially answers the question but includes minor errors, omissions, or irrelevant information."}, {"description": "The response fully answers the question and includes minor errors, omissions, or irrelevant information."}, {"description": "The response fully answers the question and includes no errors, omissions, or irrelevant information."}]
|
|
709
|
+
*/
|
|
710
|
+
rubrics: {
|
|
711
|
+
description: string;
|
|
712
|
+
}[];
|
|
713
|
+
};
|
|
714
|
+
};
|
|
715
|
+
"ragas/sql_query_equivalence": {
|
|
716
|
+
settings: {
|
|
717
|
+
/**
|
|
718
|
+
* @description The model to use for evaluation.
|
|
719
|
+
* @default "openai/gpt-4o-mini"
|
|
720
|
+
*/
|
|
721
|
+
model: string;
|
|
722
|
+
/**
|
|
723
|
+
* @description The maximum number of tokens allowed for evaluation, a too high number can be costly. Entries above this amount will be skipped.
|
|
724
|
+
* @default 2048
|
|
725
|
+
*/
|
|
726
|
+
max_tokens: number;
|
|
727
|
+
};
|
|
728
|
+
};
|
|
729
|
+
"ragas/summarization_score": {
|
|
730
|
+
settings: {
|
|
731
|
+
/**
|
|
732
|
+
* @description The model to use for evaluation.
|
|
733
|
+
* @default "openai/gpt-4o-mini"
|
|
734
|
+
*/
|
|
735
|
+
model: string;
|
|
736
|
+
/**
|
|
737
|
+
* @description The maximum number of tokens allowed for evaluation, a too high number can be costly. Entries above this amount will be skipped.
|
|
738
|
+
* @default 2048
|
|
739
|
+
*/
|
|
740
|
+
max_tokens: number;
|
|
741
|
+
};
|
|
742
|
+
};
|
|
743
|
+
"presidio/pii_detection": {
|
|
744
|
+
settings: {
|
|
745
|
+
/**
|
|
746
|
+
* @description The types of PII to check for in the input.
|
|
747
|
+
* @default {"credit_card": true, "crypto": true, "email_address": true, "iban_code": true, "ip_address": true, "location": false, "person": false, "phone_number": true, "medical_license": true, "us_bank_number": false, "us_driver_license": false, "us_itin": false, "us_passport": false, "us_ssn": false, "uk_nhs": false, "sg_nric_fin": false, "au_abn": false, "au_acn": false, "au_tfn": false, "au_medicare": false, "in_pan": false, "in_aadhaar": false, "in_vehicle_registration": false, "in_voter": false, "in_passport": false}
|
|
748
|
+
*/
|
|
749
|
+
entities: {
|
|
750
|
+
/**
|
|
751
|
+
* @default true
|
|
752
|
+
*/
|
|
753
|
+
credit_card: boolean;
|
|
754
|
+
/**
|
|
755
|
+
* @default true
|
|
756
|
+
*/
|
|
757
|
+
crypto: boolean;
|
|
758
|
+
/**
|
|
759
|
+
* @default true
|
|
760
|
+
*/
|
|
761
|
+
email_address: boolean;
|
|
762
|
+
/**
|
|
763
|
+
* @default true
|
|
764
|
+
*/
|
|
765
|
+
iban_code: boolean;
|
|
766
|
+
/**
|
|
767
|
+
* @default true
|
|
768
|
+
*/
|
|
769
|
+
ip_address: boolean;
|
|
770
|
+
/**
|
|
771
|
+
* @default false
|
|
772
|
+
*/
|
|
773
|
+
location: boolean;
|
|
774
|
+
/**
|
|
775
|
+
* @default false
|
|
776
|
+
*/
|
|
777
|
+
person: boolean;
|
|
778
|
+
/**
|
|
779
|
+
* @default true
|
|
780
|
+
*/
|
|
781
|
+
phone_number: boolean;
|
|
782
|
+
/**
|
|
783
|
+
* @default true
|
|
784
|
+
*/
|
|
785
|
+
medical_license: boolean;
|
|
786
|
+
/**
|
|
787
|
+
* @default false
|
|
788
|
+
*/
|
|
789
|
+
us_bank_number: boolean;
|
|
790
|
+
/**
|
|
791
|
+
* @default false
|
|
792
|
+
*/
|
|
793
|
+
us_driver_license: boolean;
|
|
794
|
+
/**
|
|
795
|
+
* @default false
|
|
796
|
+
*/
|
|
797
|
+
us_itin: boolean;
|
|
798
|
+
/**
|
|
799
|
+
* @default false
|
|
800
|
+
*/
|
|
801
|
+
us_passport: boolean;
|
|
802
|
+
/**
|
|
803
|
+
* @default false
|
|
804
|
+
*/
|
|
805
|
+
us_ssn: boolean;
|
|
806
|
+
/**
|
|
807
|
+
* @default false
|
|
808
|
+
*/
|
|
809
|
+
uk_nhs: boolean;
|
|
810
|
+
/**
|
|
811
|
+
* @default false
|
|
812
|
+
*/
|
|
813
|
+
sg_nric_fin: boolean;
|
|
814
|
+
/**
|
|
815
|
+
* @default false
|
|
816
|
+
*/
|
|
817
|
+
au_abn: boolean;
|
|
818
|
+
/**
|
|
819
|
+
* @default false
|
|
820
|
+
*/
|
|
821
|
+
au_acn: boolean;
|
|
822
|
+
/**
|
|
823
|
+
* @default false
|
|
824
|
+
*/
|
|
825
|
+
au_tfn: boolean;
|
|
826
|
+
/**
|
|
827
|
+
* @default false
|
|
828
|
+
*/
|
|
829
|
+
au_medicare: boolean;
|
|
830
|
+
/**
|
|
831
|
+
* @default false
|
|
832
|
+
*/
|
|
833
|
+
in_pan: boolean;
|
|
834
|
+
/**
|
|
835
|
+
* @default false
|
|
836
|
+
*/
|
|
837
|
+
in_aadhaar: boolean;
|
|
838
|
+
/**
|
|
839
|
+
* @default false
|
|
840
|
+
*/
|
|
841
|
+
in_vehicle_registration: boolean;
|
|
842
|
+
/**
|
|
843
|
+
* @default false
|
|
844
|
+
*/
|
|
845
|
+
in_voter: boolean;
|
|
846
|
+
/**
|
|
847
|
+
* @default false
|
|
848
|
+
*/
|
|
849
|
+
in_passport: boolean;
|
|
850
|
+
};
|
|
851
|
+
/**
|
|
852
|
+
* @description The minimum confidence required for failing the evaluation on a PII match.
|
|
853
|
+
* @default 0.5
|
|
854
|
+
*/
|
|
855
|
+
min_threshold: number;
|
|
856
|
+
};
|
|
857
|
+
};
|
|
858
|
+
};
|
|
859
|
+
|
|
860
|
+
type Conversation = {
|
|
861
|
+
input?: string;
|
|
862
|
+
output?: string;
|
|
863
|
+
}[];
|
|
864
|
+
|
|
865
|
+
interface RAGChunk {
|
|
866
|
+
document_id?: string | null;
|
|
867
|
+
chunk_id?: string | null;
|
|
868
|
+
content: string | Record<string, any> | any[];
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
interface BasicEvaluationData {
|
|
872
|
+
input?: string;
|
|
873
|
+
output?: string;
|
|
874
|
+
expected_output?: unknown;
|
|
875
|
+
contexts?: RAGChunk[] | string[];
|
|
876
|
+
expected_contexts?: RAGChunk[] | string[];
|
|
877
|
+
conversation?: Conversation;
|
|
878
|
+
}
|
|
879
|
+
interface EvaluationDetailsBase {
|
|
880
|
+
name?: string;
|
|
881
|
+
data: BasicEvaluationData | Record<string, unknown>;
|
|
882
|
+
contexts?: RAGChunk[] | string[];
|
|
883
|
+
conversation?: Conversation;
|
|
884
|
+
asGuardrail?: boolean;
|
|
885
|
+
}
|
|
886
|
+
interface SavedEvaluationDetails extends EvaluationDetailsBase {
|
|
887
|
+
slug: string;
|
|
888
|
+
settings?: Record<string, unknown>;
|
|
889
|
+
}
|
|
890
|
+
interface LangEvalsEvaluationDetails<T extends EvaluatorTypes> extends EvaluationDetailsBase {
|
|
891
|
+
evaluator: T;
|
|
892
|
+
settings?: Evaluators[T]["settings"];
|
|
893
|
+
}
|
|
894
|
+
type EvaluationDetails = SavedEvaluationDetails | LangEvalsEvaluationDetails<EvaluatorTypes>;
|
|
895
|
+
declare function runEvaluation(details: EvaluationDetails): Promise<SingleEvaluationResult>;
|
|
896
|
+
|
|
897
|
+
export { type BasicEvaluationData, type EvaluationDetails, type EvaluationDetailsBase, type LangEvalsEvaluationDetails, type SavedEvaluationDetails, runEvaluation };
|