typia icon indicating copy to clipboard operation
typia copied to clipboard

Improve Error Message for Non-Object Parameters in `typia.llm.application`

Open kakasoo opened this issue 11 months ago • 4 comments

Contents

The typia.llm.application method requires the top-level parameter to be an object. This means that even if a string is part of a union with an object, it is still not allowed.

{
  "code": "typia.llm.application",
  "message": "unsupported type detected\n\n- PickNotionServicegetDatabaseInfo.getDatabaseInfo: unknown\n  - LLM application's function (\"getDatabaseInfo\")'s parameter must be an object type.",
  "name": "Error"
}

Strictly speaking, this error message is not incorrect, but I wonder if the phrase "must be an object type" might be unclear for those who are not deeply familiar with TypeScript's type system. It may not be immediately obvious that this means "a union with an object is not allowed."

Would you be open to modifying this error message? Or would it be okay if I made the change myself?

Reference

@luke0408 's code.

  • https://github.com/luke0408/connectors/blob/8a186df7260104ddb9082ea80c8c644e85865609/packages/notion/src/notion/NotionService.ts#L738-L799

kakasoo avatar Mar 28 '25 07:03 kakasoo

Wait for your contribution.

samchon avatar Apr 15 '25 05:04 samchon

@luke0408 how do you think?

kakasoo avatar Apr 15 '25 13:04 kakasoo

Good! I'll fix it

luke0408 avatar Apr 15 '25 13:04 luke0408

Would a message like "${prefix}'s parameter must be an object type. Union types (e.g., string | object) are not supported." be sufficient?

luke0408 avatar Apr 16 '25 07:04 luke0408