create-mastra 0.12.2 → 0.12.3-alpha.1
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/CHANGELOG.md +8 -0
- package/package.json +3 -3
- package/dist/templates/scorers/answer-relevancy-scorer.ts +0 -15
- package/dist/templates/scorers/bias-detection-scorer.ts +0 -16
- package/dist/templates/scorers/completeness-scorer.ts +0 -16
- package/dist/templates/scorers/content-similarity-scorer.ts +0 -15
- package/dist/templates/scorers/faithfulness-scorer.ts +0 -21
- package/dist/templates/scorers/hallucination-scorer.ts +0 -21
- package/dist/templates/scorers/keyword-coverage-scorer.ts +0 -15
- package/dist/templates/scorers/textual-difference-scorer.ts +0 -16
- package/dist/templates/scorers/tone-consistency-scorer.ts +0 -16
- package/dist/templates/scorers/toxicity-detection-scorer.ts +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# create-mastra
|
|
2
2
|
|
|
3
|
+
## 0.12.3-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Client SDK Agents, Mastra server - support runtimeContext with GET requests ([#7734](https://github.com/mastra-ai/mastra/pull/7734))
|
|
8
|
+
|
|
9
|
+
## 0.12.3-alpha.0
|
|
10
|
+
|
|
3
11
|
## 0.12.2
|
|
4
12
|
|
|
5
13
|
## 0.12.2-alpha.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-mastra",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.3-alpha.1",
|
|
4
4
|
"description": "Create Mastra apps with one command",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"rollup-plugin-esbuild": "^6.2.1",
|
|
52
52
|
"rollup-plugin-node-externals": "^8.0.1",
|
|
53
53
|
"typescript": "^5.8.3",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
54
|
+
"mastra": "^0.12.3-alpha.1",
|
|
55
|
+
"@internal/lint": "0.0.38"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
58
|
"node": ">=20"
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export const answerRelevancyScorer = `
|
|
2
|
-
import { openai } from "@ai-sdk/openai";
|
|
3
|
-
import { createAnswerRelevancyScorer } from "@mastra/evals/scorers/llm";
|
|
4
|
-
|
|
5
|
-
const scorer = createAnswerRelevancyScorer({ model: openai("gpt-4o-mini") });
|
|
6
|
-
|
|
7
|
-
const inputMessages = [{ role: 'user', content: "What are the health benefits of regular exercise?" }];
|
|
8
|
-
const outputMessage = { text: "Regular exercise improves cardiovascular health, strengthens muscles, boosts metabolism, and enhances mental well-being through the release of endorphins." };
|
|
9
|
-
|
|
10
|
-
const result = await scorer.run({
|
|
11
|
-
input: inputMessages,
|
|
12
|
-
output: outputMessage,
|
|
13
|
-
});
|
|
14
|
-
console.log(result);
|
|
15
|
-
`;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export const biasDetectionScorer = `
|
|
2
|
-
import { openai } from "@ai-sdk/openai";
|
|
3
|
-
import { createBiasScorer } from "@mastra/evals/scorers/llm";
|
|
4
|
-
|
|
5
|
-
const scorer = createBiasScorer({ model: openai("gpt-4o-mini") });
|
|
6
|
-
|
|
7
|
-
const query = "What makes someone a good leader?";
|
|
8
|
-
const response =
|
|
9
|
-
"Men naturally make better leaders due to their assertiveness and decisiveness. Women tend to be too emotional and collaborative, which can slow down decision-making processes.";
|
|
10
|
-
|
|
11
|
-
const result = await scorer.run({
|
|
12
|
-
input: [{ role: 'user', content: query }],
|
|
13
|
-
output: { text: response },
|
|
14
|
-
});
|
|
15
|
-
console.log(result);
|
|
16
|
-
`;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export const completenessScorer = `
|
|
2
|
-
import { openai } from "@ai-sdk/openai";
|
|
3
|
-
import { createCompletenessScorer } from "@mastra/evals/scorers/llm";
|
|
4
|
-
|
|
5
|
-
const scorer = createCompletenessScorer({ model: openai("gpt-4o-mini") });
|
|
6
|
-
|
|
7
|
-
const query = "Explain the process of photosynthesis, including the inputs, outputs, and stages involved.";
|
|
8
|
-
const response =
|
|
9
|
-
"Photosynthesis is the process by which plants convert sunlight into chemical energy. Inputs: Carbon dioxide (CO2) from the air enters through stomata, water (H2O) is absorbed by roots, and sunlight provides energy captured by chlorophyll. The process occurs in two main stages: 1) Light-dependent reactions in the thylakoids convert light energy to ATP and NADPH while splitting water and releasing oxygen. 2) Light-independent reactions (Calvin cycle) in the stroma use ATP, NADPH, and CO2 to produce glucose. Outputs: Glucose (C6H12O6) serves as food for the plant, and oxygen (O2) is released as a byproduct. The overall equation is: 6CO2 + 6H2O + light energy → C6H12O6 + 6O2.";
|
|
10
|
-
|
|
11
|
-
const result = await scorer.run({
|
|
12
|
-
input: [{ role: 'user', content: query }],
|
|
13
|
-
output: { text: response },
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
console.log(result);`;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export const contentSimilarityScorer = `
|
|
2
|
-
import { createContentSimilarityScorer } from "@mastra/evals/scorers/llm";
|
|
3
|
-
|
|
4
|
-
const scorer = createContentSimilarityScorer();
|
|
5
|
-
|
|
6
|
-
const query = "The quick brown fox jumps over the lazy dog.";
|
|
7
|
-
const response = "A quick brown fox jumped over a lazy dog.";
|
|
8
|
-
|
|
9
|
-
const result = await scorer.run({
|
|
10
|
-
input: [{ role: 'user', content: query }],
|
|
11
|
-
output: { text: response },
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
console.log(result);
|
|
15
|
-
`;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export const faithfulnessScorer = `
|
|
2
|
-
import { openai } from "@ai-sdk/openai";
|
|
3
|
-
import { createFaithfulnessScorer } from "@mastra/evals/scorers/llm";
|
|
4
|
-
|
|
5
|
-
const scorer = createFaithfulnessScorer({ model: openai("gpt-4o-mini"), options: {
|
|
6
|
-
context: [
|
|
7
|
-
"The Tesla Model 3 was launched in 2017.",
|
|
8
|
-
"It has a range of up to 358 miles.",
|
|
9
|
-
"The base model accelerates 0-60 mph in 5.8 seconds."
|
|
10
|
-
]
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const query = "Tell me about the Tesla Model 3.";
|
|
14
|
-
const response = "The Tesla Model 3 was introduced in 2017. It can travel up to 358 miles on a single charge and the base version goes from 0 to 60 mph in 5.8 seconds.";
|
|
15
|
-
|
|
16
|
-
const result = await scorer.run({
|
|
17
|
-
input: [{ role: 'user', content: query }],
|
|
18
|
-
output: { text: response },
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
console.log(result);`;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export const hallucinationScorer = `
|
|
2
|
-
import { openai } from "@ai-sdk/openai";
|
|
3
|
-
import { createHallucinationScorer } from "@mastra/evals/scorers/llm";
|
|
4
|
-
|
|
5
|
-
const scorer = createHallucinationScorer({ model: openai("gpt-4o-mini"), options: {
|
|
6
|
-
context: [
|
|
7
|
-
"The iPhone was first released in 2007.",
|
|
8
|
-
"Steve Jobs unveiled it at Macworld.",
|
|
9
|
-
"The original model had a 3.5-inch screen."
|
|
10
|
-
]
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const query = "When was the first iPhone released?";
|
|
14
|
-
const response = "The iPhone was first released in 2007, when Steve Jobs unveiled it at Macworld. The original iPhone featured a 3.5-inch screen.";
|
|
15
|
-
|
|
16
|
-
const result = await scorer.run({
|
|
17
|
-
input: [{ role: 'user', content: query }],
|
|
18
|
-
output: { text: response },
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
console.log(result);`;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export const keywordCoverageScorer = `
|
|
2
|
-
import { createKeywordCoverageScorer } from "@mastra/evals/scorers/code";
|
|
3
|
-
|
|
4
|
-
const scorer = createKeywordCoverageScorer();
|
|
5
|
-
|
|
6
|
-
const input = 'JavaScript frameworks like React and Vue';
|
|
7
|
-
const output = 'Popular JavaScript frameworks include React and Vue for web development';
|
|
8
|
-
|
|
9
|
-
const result = await scorer.run({
|
|
10
|
-
input: [{ role: 'user', content: input }],
|
|
11
|
-
output: { role: 'assistant', text: output },
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
console.log('Score:', result.score);
|
|
15
|
-
console.log('AnalyzeStepResult:', result.analyzeStepResult);`;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export const textualDifferenceScorer = `
|
|
2
|
-
import { createTextualDifferenceScorer } from "@mastra/evals/scorers/code";
|
|
3
|
-
|
|
4
|
-
const scorer = createTextualDifferenceScorer();
|
|
5
|
-
|
|
6
|
-
const input = 'The quick brown fox jumps over the lazy dog';
|
|
7
|
-
const output = 'The quick brown fox jumps over the lazy dog';
|
|
8
|
-
|
|
9
|
-
const result = await scorer.run({
|
|
10
|
-
input: [{ role: 'user', content: input }],
|
|
11
|
-
output: { role: 'assistant', text: output },
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
console.log('Score:', result.score);
|
|
15
|
-
console.log('AnalyzeStepResult:', result.analyzeStepResult);
|
|
16
|
-
`;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export const toneConsistencyScorer = `
|
|
2
|
-
import { createToneScorer } from "@mastra/evals/scorers/code";
|
|
3
|
-
|
|
4
|
-
const scorer = createToneScorer();
|
|
5
|
-
|
|
6
|
-
const input = 'This product is fantastic and amazing!';
|
|
7
|
-
const output = 'The product is excellent and wonderful!';
|
|
8
|
-
|
|
9
|
-
const result = await scorer.run({
|
|
10
|
-
input: [{ role: 'user', content: input }],
|
|
11
|
-
output: { role: 'assistant', text: output },
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
console.log('Score:', result.score);
|
|
15
|
-
console.log('AnalyzeStepResult:', result.analyzeStepResult);
|
|
16
|
-
`;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export const toxicityDetectionScorer = `
|
|
2
|
-
import { openai } from "@ai-sdk/openai";
|
|
3
|
-
import { createToxicityScorer } from "@mastra/evals/scorers/llm";
|
|
4
|
-
|
|
5
|
-
const scorer = createToxicityScorer({ model: openai("gpt-4o-mini") });
|
|
6
|
-
|
|
7
|
-
const query = 'What do you think about the new team member?';
|
|
8
|
-
const response = 'That incompetent fool is a complete waste of space. They clearly bought their degree and have no business being here. Everyone hates working with them.';
|
|
9
|
-
|
|
10
|
-
const result = await scorer.run({
|
|
11
|
-
input: [{ role: 'user', content: query }],
|
|
12
|
-
output: { role: 'assistant', text: response },
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
console.log('Score:', result.score);
|
|
16
|
-
console.log('Reason:', result.reason);`;
|