#Wrote a technical content summarizer

1 messages · Page 1 of 1 (latest)

golden cloud
#

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 🙂

shadow sand
#

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

lavish carbon
shadow sand
#

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!

lavish carbon
#

rather than returning a bool, a false should raise an error with a message

golden cloud
shadow sand
#

Yeah tried an array type, but dagger wouldn’t compile the module

golden cloud
#
      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

lavish carbon
#

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"

golden cloud
#

@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.

shadow sand
#

Throwing errors makes me check twice that it didn't actually error. Makes me think that its broken