Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Enum typed property (of "chatgpt" and "gemini") ignores description #1463

Closed
samchon opened this issue Jan 23, 2025 · 1 comment
Closed

Enum typed property (of "chatgpt" and "gemini") ignores description #1463

samchon opened this issue Jan 23, 2025 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@samchon
Copy link
Owner

samchon commented Jan 23, 2025

import typia from "typia";

interface Something {
  /**
   * The value.
   * 
   * The value of enumerations.
   */
  value: 1 | 2 | 3;

  /**
   * No problem on plain type.
   */
  plain: string;
}

typia.llm.parameters<Something, "chatgpt">();
typia.llm.schema<Something, "gemini">();

If declare an enum type and convert it to ChatGPT or Gemini schema, its description be dropped.

Such bug does not occur for non-enumeration types.

({
  type: "object",
  properties: {
    value: {
      title: "The value",
      type: "number",
      enum: [1, 2, 3],
    },
    plain: {
      title: "No problem on plain type",
      description: "No problem on plain type.",
      type: "string",
    },
  },
  required: ["value", "plain"],
  additionalProperties: false,
  $defs: {},
});
({
  type: "object",
  properties: {
    value: {
      type: "number",
      enum: [1, 2, 3],
    },
    plain: {
      type: "string",
      description: "No problem on plain type.",
    },
  },
  required: ["value", "plain"],
});
@samchon
Copy link
Owner Author

samchon commented Jan 27, 2025

Fixed in the @samchon/openapi library.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
No open projects
Status: Done
Development

No branches or pull requests

1 participant