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.
- package/README.md +3 -0
- package/lib/internal/_createLlmEvaluation.d.ts +1 -0
- package/lib/internal/_createLlmEvaluation.js +486 -0
- package/lib/internal/_createLlmEvaluation.js.map +1 -0
- package/lib/internal/_createLlmEvaluation.mjs +382 -0
- package/lib/internal/_createLlmEvaluation.mjs.map +1 -0
- package/lib/internal/_stringLengthGte.d.ts +1 -0
- package/lib/internal/_stringLengthGte.js +14 -0
- package/lib/internal/_stringLengthGte.js.map +1 -0
- package/lib/internal/_stringLengthGte.mjs +11 -0
- package/lib/internal/_stringLengthGte.mjs.map +1 -0
- package/lib/internal/_stringLengthLte.d.ts +1 -0
- package/lib/internal/_stringLengthLte.js +14 -0
- package/lib/internal/_stringLengthLte.js.map +1 -0
- package/lib/internal/_stringLengthLte.mjs +11 -0
- package/lib/internal/_stringLengthLte.mjs.map +1 -0
- package/lib/llm.d.ts +54 -1
- package/lib/llm.js +5 -0
- package/lib/llm.js.map +1 -1
- package/lib/llm.mjs +6 -1
- package/lib/llm.mjs.map +1 -1
- package/lib/re-exports.d.ts +1 -1
- package/lib/re-exports.js.map +1 -1
- package/native/cmd/ttsc-typia/build.go +2 -0
- package/native/cmd/ttsc-typia/dynamic_key_tags_transform_test.go +1 -1
- package/native/cmd/ttsc-typia/llm_evaluation_accepts_property_probability_test.go +27 -0
- package/native/cmd/ttsc-typia/llm_evaluation_accepts_unselected_source_probability_test.go +26 -0
- package/native/cmd/ttsc-typia/llm_evaluation_complete_object_shape_test.go +96 -0
- package/native/cmd/ttsc-typia/llm_evaluation_ignores_declaration_probability_without_call_test.go +18 -0
- package/native/cmd/ttsc-typia/llm_evaluation_plan_emission_transform_test.go +90 -0
- package/native/cmd/ttsc-typia/llm_evaluation_program_scan_dependencies_test.go +69 -0
- package/native/cmd/ttsc-typia/llm_evaluation_rejects_alias_comment_test.go +44 -0
- package/native/cmd/ttsc-typia/llm_evaluation_rejects_alias_refinement_test.go +45 -0
- package/native/cmd/ttsc-typia/llm_evaluation_rejects_computed_method_probability_test.go +30 -0
- package/native/cmd/ttsc-typia/llm_evaluation_rejects_imported_declaration_probability_test.go +48 -0
- package/native/cmd/ttsc-typia/llm_evaluation_rejects_invalid_probability_test.go +199 -0
- package/native/cmd/ttsc-typia/llm_evaluation_rejects_refinements_test.go +94 -0
- package/native/cmd/ttsc-typia/llm_evaluation_rejects_undecidable_types_test.go +232 -0
- package/native/cmd/ttsc-typia/metadata_type_tag_sole_malformed_diagnostic_test.go +94 -0
- package/native/cmd/ttsc-typia/template_literal_type_tags_transform_test.go +3 -2
- package/native/cmd/ttsc-typia/transform.go +2 -0
- package/native/cmd/ttsc-typia/transform_helpers_test.go +17 -3
- package/native/core/context/ITypiaContext.go +4 -0
- package/native/core/factories/IdentifierFactory.go +10 -0
- package/native/core/factories/LiteralFactory.go +16 -0
- package/native/core/factories/MetadataCommentTagFactory.go +12 -10
- package/native/core/factories/MetadataTypeTagFactory.go +97 -24
- package/native/core/factories/MetadataTypeTagSchemaFactory.go +5 -0
- package/native/core/factories/internal/metadata/IMetadataIteratorProps.go +6 -2
- package/native/core/factories/internal/metadata/emplace_metadata_object.go +49 -15
- package/native/core/factories/literal_factory_null_survives_objects_test.go +43 -0
- package/native/core/factories/metadata_comment_tag_factory_string_length_helpers_test.go +55 -0
- package/native/core/factories/metadata_type_tag_factory_reports_all_invalid_candidates_test.go +73 -0
- package/native/core/programmers/llm/LlmApplicationProgrammer.go +1 -0
- package/native/core/programmers/llm/LlmEvaluationProgrammer.go +555 -0
- package/native/core/programmers/llm/LlmParametersProgrammer.go +6 -5
- package/native/core/programmers/llm/LlmReferenceDescription.go +113 -0
- package/native/core/programmers/llm/llm_reference_description_test.go +134 -0
- package/native/core/schemas/metadata/MetadataDependency.go +9 -0
- package/native/transform/CallExpressionTransformer.go +1 -0
- package/native/transform/FileTransformer.go +5 -0
- package/native/transform/features/llm/LlmEvaluationProbabilityDeclarations.go +94 -0
- package/native/transform/features/llm/LlmEvaluationProbabilityDeclarations_test.go +50 -0
- package/native/transform/features/llm/LlmEvaluationTransformer.go +59 -0
- package/native/transform/features/llm/LlmSchemaTransformer.go +14 -11
- package/native/transform/features/llm/llm_transformer_entry_coverage_test.go +29 -27
- package/package.json +3 -3
- package/src/internal/_createLlmEvaluation.ts +678 -0
- package/src/internal/_stringLengthGte.ts +6 -0
- package/src/internal/_stringLengthLte.ts +6 -0
- package/src/llm.ts +64 -0
- 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
|
----------------------------------------------------------- */
|