Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

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

Open
samchon opened this issue Jan 23, 2025 · 0 comments
Open

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

samchon opened this issue Jan 23, 2025 · 0 comments
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"],
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

1 participant