Skip to content

Commit 7548d70

Browse files
committed
simplify result
1 parent 4602139 commit 7548d70

File tree

4 files changed

+4
-23
lines changed

4 files changed

+4
-23
lines changed
Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// 💰 import zod
2-
// import { z } from 'zod'
31
import { type EpicMeMCP } from './index.ts'
42

53
export async function suggestTagsSampling(agent: EpicMeMCP, entryId: number) {
@@ -9,14 +7,5 @@ export async function suggestTagsSampling(agent: EpicMeMCP, entryId: number) {
97
// 🐨 Add a user message with the content "You just created a new journal entry with the id ${entryId}. Please respond with a proper commendation for yourself."
108
// 🐨 Set the maxTokens what you think is reasonable for the request
119
//
12-
// 🐨 parse the result with zod
13-
// 💰 I'll just give you the schema here:
14-
// const resultSchema = z.object({
15-
// content: z.object({
16-
// type: z.literal('text'),
17-
// text: z.string(),
18-
// }),
19-
// })
20-
// 💰 resultSchema.parse(result)
21-
// 🐨 add a console.error to print the result (this will show up in the inspector)
10+
// 🐨 add a console.error to print the result.content.text (this will show up in the inspector)
2211
}

exercises/05.sampling/01.solution.simple/src/sampling.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { z } from 'zod'
21
import { type EpicMeMCP } from './index.ts'
32

43
export async function suggestTagsSampling(agent: EpicMeMCP, entryId: number) {
@@ -25,12 +24,5 @@ Please respond with a proper commendation for yourself.
2524
maxTokens: 10,
2625
})
2726

28-
const resultSchema = z.object({
29-
content: z.object({
30-
type: z.literal('text'),
31-
text: z.string(),
32-
}),
33-
})
34-
const parsedResult = resultSchema.parse(result)
35-
console.error('Received response:', parsedResult.content.text)
27+
console.error('Received response:', result.content.text)
3628
}

exercises/05.sampling/02.problem.advanced/src/sampling.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Please respond with a proper commendation for yourself.
4040
},
4141
},
4242
],
43-
// 🐨 increase this to 300 or so...
43+
// 🐨 increase this to 100 or so...
4444
maxTokens: 10,
4545
})
4646

exercises/05.sampling/02.solution.advanced/src/sampling.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ If you have some suggestions, respond with an array of tag objects. Existing tag
3535
},
3636
},
3737
],
38-
maxTokens: 300,
38+
maxTokens: 100,
3939
})
4040

4141
const resultSchema = z.object({

0 commit comments

Comments
 (0)