typia 14.0.6 → 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +3 -0
  2. package/lib/internal/_createLlmEvaluation.d.ts +1 -0
  3. package/lib/internal/_createLlmEvaluation.js +486 -0
  4. package/lib/internal/_createLlmEvaluation.js.map +1 -0
  5. package/lib/internal/_createLlmEvaluation.mjs +382 -0
  6. package/lib/internal/_createLlmEvaluation.mjs.map +1 -0
  7. package/lib/internal/_stringLengthGte.d.ts +1 -0
  8. package/lib/internal/_stringLengthGte.js +14 -0
  9. package/lib/internal/_stringLengthGte.js.map +1 -0
  10. package/lib/internal/_stringLengthGte.mjs +11 -0
  11. package/lib/internal/_stringLengthGte.mjs.map +1 -0
  12. package/lib/internal/_stringLengthLte.d.ts +1 -0
  13. package/lib/internal/_stringLengthLte.js +14 -0
  14. package/lib/internal/_stringLengthLte.js.map +1 -0
  15. package/lib/internal/_stringLengthLte.mjs +11 -0
  16. package/lib/internal/_stringLengthLte.mjs.map +1 -0
  17. package/lib/llm.d.ts +54 -1
  18. package/lib/llm.js +5 -0
  19. package/lib/llm.js.map +1 -1
  20. package/lib/llm.mjs +6 -1
  21. package/lib/llm.mjs.map +1 -1
  22. package/lib/re-exports.d.ts +1 -1
  23. package/lib/re-exports.js.map +1 -1
  24. package/native/cmd/ttsc-typia/build.go +2 -0
  25. package/native/cmd/ttsc-typia/dynamic_key_tags_transform_test.go +1 -1
  26. package/native/cmd/ttsc-typia/llm_evaluation_accepts_property_probability_test.go +27 -0
  27. package/native/cmd/ttsc-typia/llm_evaluation_accepts_unselected_source_probability_test.go +26 -0
  28. package/native/cmd/ttsc-typia/llm_evaluation_complete_object_shape_test.go +96 -0
  29. package/native/cmd/ttsc-typia/llm_evaluation_ignores_declaration_probability_without_call_test.go +18 -0
  30. package/native/cmd/ttsc-typia/llm_evaluation_plan_emission_transform_test.go +90 -0
  31. package/native/cmd/ttsc-typia/llm_evaluation_program_scan_dependencies_test.go +69 -0
  32. package/native/cmd/ttsc-typia/llm_evaluation_rejects_alias_comment_test.go +44 -0
  33. package/native/cmd/ttsc-typia/llm_evaluation_rejects_alias_refinement_test.go +45 -0
  34. package/native/cmd/ttsc-typia/llm_evaluation_rejects_computed_method_probability_test.go +30 -0
  35. package/native/cmd/ttsc-typia/llm_evaluation_rejects_imported_declaration_probability_test.go +48 -0
  36. package/native/cmd/ttsc-typia/llm_evaluation_rejects_invalid_probability_test.go +199 -0
  37. package/native/cmd/ttsc-typia/llm_evaluation_rejects_refinements_test.go +94 -0
  38. package/native/cmd/ttsc-typia/llm_evaluation_rejects_undecidable_types_test.go +232 -0
  39. package/native/cmd/ttsc-typia/metadata_type_tag_sole_malformed_diagnostic_test.go +94 -0
  40. package/native/cmd/ttsc-typia/template_literal_type_tags_transform_test.go +3 -2
  41. package/native/cmd/ttsc-typia/transform.go +2 -0
  42. package/native/cmd/ttsc-typia/transform_helpers_test.go +17 -3
  43. package/native/core/context/ITypiaContext.go +4 -0
  44. package/native/core/factories/IdentifierFactory.go +10 -0
  45. package/native/core/factories/LiteralFactory.go +16 -0
  46. package/native/core/factories/MetadataCommentTagFactory.go +12 -10
  47. package/native/core/factories/MetadataTypeTagFactory.go +97 -24
  48. package/native/core/factories/MetadataTypeTagSchemaFactory.go +5 -0
  49. package/native/core/factories/internal/metadata/IMetadataIteratorProps.go +6 -2
  50. package/native/core/factories/internal/metadata/emplace_metadata_object.go +49 -15
  51. package/native/core/factories/literal_factory_null_survives_objects_test.go +43 -0
  52. package/native/core/factories/metadata_comment_tag_factory_string_length_helpers_test.go +55 -0
  53. package/native/core/factories/metadata_type_tag_factory_reports_all_invalid_candidates_test.go +73 -0
  54. package/native/core/programmers/llm/LlmApplicationProgrammer.go +1 -0
  55. package/native/core/programmers/llm/LlmEvaluationProgrammer.go +555 -0
  56. package/native/core/programmers/llm/LlmParametersProgrammer.go +6 -5
  57. package/native/core/programmers/llm/LlmReferenceDescription.go +113 -0
  58. package/native/core/programmers/llm/llm_reference_description_test.go +134 -0
  59. package/native/core/schemas/metadata/MetadataDependency.go +9 -0
  60. package/native/transform/CallExpressionTransformer.go +1 -0
  61. package/native/transform/FileTransformer.go +5 -0
  62. package/native/transform/features/llm/LlmEvaluationProbabilityDeclarations.go +94 -0
  63. package/native/transform/features/llm/LlmEvaluationProbabilityDeclarations_test.go +50 -0
  64. package/native/transform/features/llm/LlmEvaluationTransformer.go +59 -0
  65. package/native/transform/features/llm/LlmSchemaTransformer.go +14 -11
  66. package/native/transform/features/llm/llm_transformer_entry_coverage_test.go +29 -27
  67. package/package.json +3 -3
  68. package/src/internal/_createLlmEvaluation.ts +678 -0
  69. package/src/internal/_stringLengthGte.ts +6 -0
  70. package/src/internal/_stringLengthLte.ts +6 -0
  71. package/src/llm.ts +64 -0
  72. package/src/re-exports.ts +1 -0
package/src/llm.ts CHANGED
@@ -2,6 +2,7 @@ import {
2
2
  IJsonParseResult,
3
3
  ILlmApplication,
4
4
  ILlmController,
5
+ ILlmEvaluation,
5
6
  ILlmSchema,
6
7
  ILlmStructuredOutput,
7
8
  } from "@typia/interface";
@@ -201,6 +202,69 @@ export function structuredOutput(): never {
201
202
  NoTransformConfigurationError("llm.structuredOutput");
202
203
  }
203
204
 
205
+ /* -----------------------------------------------------------
206
+ EVALUATION
207
+ ----------------------------------------------------------- */
208
+ /**
209
+ * Creates LLM evaluation questions.
210
+ *
211
+ * @danger You must configure the generic argument `T`
212
+ */
213
+ export function evaluation(): never;
214
+
215
+ /**
216
+ * Creates LLM evaluation questions from TypeScript object type.
217
+ *
218
+ * Generates {@link ILlmEvaluation} for evaluation models, which answer typed
219
+ * questions about a shared state with probabilities instead of generating text:
220
+ * TypeSafe's Jev natively, and OpenAI, Anthropic, and Google through Vercel AI
221
+ * SDK's `experimental_evaluate()`.
222
+ *
223
+ * Every leaf property of `T` becomes one question, and its JSDoc description
224
+ * becomes the question text:
225
+ *
226
+ * - `boolean` → boolean question
227
+ * - String enum or string literal union → choice question
228
+ * - Numeric enum or numeric literal union → score question
229
+ * - Array of a string literal union or string enum → one boolean question per
230
+ * member
231
+ * - Nested object → flattened, one question per leaf
232
+ *
233
+ * Types an evaluation model cannot answer, such as `string`, `number`, optional
234
+ * properties, or a leaf without a JSDoc description, are compile errors. Use
235
+ * `tags.Probability<N>` or `@probability N` to set decision thresholds and
236
+ * acceptance minimums. Once one choice, score, or set member declares a
237
+ * requirement, every member must declare one or inherit the property's
238
+ * `@probability` default. A nested object's own JSDoc description is not sent
239
+ * to the model; only the leaves' descriptions become question text. Other
240
+ * validation refinements that the answer decoder cannot enforce are compile
241
+ * errors.
242
+ *
243
+ * This feature is experimental. It follows Vercel AI SDK's evaluation model
244
+ * specification, which is itself experimental and may change in patch
245
+ * releases.
246
+ *
247
+ * Workflow:
248
+ *
249
+ * 1. Pass {@link ILlmEvaluation.questions} to the evaluation model
250
+ * 2. Receive the answer map keyed by the same question IDs
251
+ * 3. Use {@link ILlmEvaluation.decode} to fold the answers back into `T`; pass the
252
+ * model's declared rounding precision when available
253
+ *
254
+ * Related functions:
255
+ *
256
+ * - {@link structuredOutput} — Structured output generated as text by an LLM
257
+ *
258
+ * @template T Target decision type (object with static properties)
259
+ * @returns LLM evaluation questions with a checked answer decoder
260
+ */
261
+ export function evaluation<T extends Record<string, any>>(): ILlmEvaluation<T>;
262
+
263
+ /** @internal */
264
+ export function evaluation(): never {
265
+ NoTransformConfigurationError("llm.evaluation");
266
+ }
267
+
204
268
  /* -----------------------------------------------------------
205
269
  RAW SCHEMAS
206
270
  ----------------------------------------------------------- */
package/src/re-exports.ts CHANGED
@@ -25,6 +25,7 @@ export type {
25
25
  ILlmApplication,
26
26
  ILlmFunction,
27
27
  ILlmStructuredOutput,
28
+ ILlmEvaluation,
28
29
  ILlmSchema,
29
30
  // reflect
30
31
  IMetadataSchema,