#Wrote a technical content summarizer
1 messages · Page 1 of 1 (latest)
Nice!!
Thinking if you let the LLM know the target length, then it will just be looping on discovering the forbidden words.
Guessing you're only letting it know about the the forbidden words it actually hits to keep things going, right 🙂
yeah, seemed like the only way to get it in the loop was the move that out - it got a really good draft without using the tools if I gave that upfront
I'm not too familiar with TS/JS errors, is there something better to return than boolean? Maybe a string "PASSED" or "FAILED: with reason" here? https://github.com/jasonmccallister/tech-summarizer-agent/blob/main/reader-workspace/src/index.ts#L51
yeah a checker should always give feedback otherwise it doesn't know what to change
Updated to this and trying now:
@func()
checkContent(content: string): [boolean, string] {
if (!content || content.length === 0) {
return [false, "The content provided is empty"];
}
if (content.length > this.maxLength || content.length < this.minLength) {
return [
false,
`The content provided is too long or too short. It should be between ${this.minLength} and ${this.maxLength} characters long`,
];
}
if (this.forbiddenWords.some((word) => content.includes(word))) {
return [
false,
`The content provided contains forbidden words {${this.forbiddenWords.join(", ")}}`,
];
}
return [true, "Passed!"];
}
which does not work with dagger functions
switching to Gemini and returning a string with the errors is much better, thank you @lavish carbon!
rather than returning a bool, a false should raise an error with a message
Yeah tried an array type, but dagger wouldn’t compile the module
throw new Error("You wrote too much! Write half as much!");
return false;
}
if (content.length < this.minLength) {
throw new Error("You produced no content! Write twice as much!");
return false;
}
seems to be working this style 👆
return false is unreachable, but whatever, the throw new Error("") part
yep no need to return false. I think the function could return nothing
and the error text should probably say something like "Your content is XX characters which is under/over the min/max length of YY"
@shadow sand pretty fun
Digital assistants transform work by taking on tasks like managing projects and processing documents, using advanced models to understand context and act autonomously, boosting efficiency.
MCP is a new standard connecting assistants to data sources, improving responses via a universal protocol. Developers can expose data or build connecting applications.
Using https://www.anthropic.com/news/model-context-protocol
https://dagger.cloud/JasonDagger/traces/8888f3d3a364ea58fe28e9f1284e2f19
Throwing errors makes me check twice that it didn't actually error. Makes me think that its broken