diff --git a/engine/language_client_codegen/src/typescript/mod.rs b/engine/language_client_codegen/src/typescript/mod.rs index 6d9213cf6..78e2c3c8e 100644 --- a/engine/language_client_codegen/src/typescript/mod.rs +++ b/engine/language_client_codegen/src/typescript/mod.rs @@ -309,7 +309,7 @@ impl ToTypeReferenceInClientDefinition for FieldType { Some(checks) => { let base_type_ref = base.to_type_ref(ir); let checks_type_ref = type_name_for_checks(&checks); - format!("Checked<{base_type_ref},{checks_type_ref}") + format!("Checked<{base_type_ref},{checks_type_ref}>") } None => { base.to_type_ref(ir) diff --git a/integ-tests/python/baml_client/partial_types.py b/integ-tests/python/baml_client/partial_types.py index dabc19f62..7a1f5a17c 100644 --- a/integ-tests/python/baml_client/partial_types.py +++ b/integ-tests/python/baml_client/partial_types.py @@ -21,7 +21,7 @@ from . import types -from .types import Checks__valid_email, Checks__young_enough, Checks__earth_aged__no_infants, Checks__regex_bad__regex_good__trivial, Checks__unreasonably_certain, Checks__valid_phone_number, Checks__too_big +from .types import Checks__too_big, Checks__valid_email, Checks__valid_phone_number, Checks__earth_aged__no_infants, Checks__unreasonably_certain, Checks__regex_bad__regex_good__trivial, Checks__young_enough ############################################################################### diff --git a/integ-tests/python/baml_client/types.py b/integ-tests/python/baml_client/types.py index 945f227c9..40e0c19ba 100644 --- a/integ-tests/python/baml_client/types.py +++ b/integ-tests/python/baml_client/types.py @@ -119,29 +119,29 @@ class TestEnum(str, Enum): F = "F" G = "G" -class Checks__young_enough(BaseModel): - young_enough: baml_py.Check - -class Checks__valid_phone_number(BaseModel): - valid_phone_number: baml_py.Check - class Checks__too_big(BaseModel): too_big: baml_py.Check -class Checks__unreasonably_certain(BaseModel): - unreasonably_certain: baml_py.Check - class Checks__earth_aged__no_infants(BaseModel): - no_infants: baml_py.Check earth_aged: baml_py.Check + no_infants: baml_py.Check + +class Checks__young_enough(BaseModel): + young_enough: baml_py.Check class Checks__valid_email(BaseModel): valid_email: baml_py.Check +class Checks__unreasonably_certain(BaseModel): + unreasonably_certain: baml_py.Check + class Checks__regex_bad__regex_good__trivial(BaseModel): - trivial: baml_py.Check - regex_good: baml_py.Check regex_bad: baml_py.Check + regex_good: baml_py.Check + trivial: baml_py.Check + +class Checks__valid_phone_number(BaseModel): + valid_phone_number: baml_py.Check class BigNumbers(BaseModel): diff --git a/integ-tests/typescript/baml_client/async_client.ts b/integ-tests/typescript/baml_client/async_client.ts index 32b0b7ed7..6564a5a2d 100644 --- a/integ-tests/typescript/baml_client/async_client.ts +++ b/integ-tests/typescript/baml_client/async_client.ts @@ -1095,7 +1095,7 @@ export class BamlAsyncClient { async PredictAgeBare( inp: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { + ): Promise> { try { const raw = await this.runtime.callFunction( "PredictAgeBare", @@ -1106,7 +1106,7 @@ export class BamlAsyncClient { __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) - return raw.parsed() as Checked } catch (error: any) { const bamlError = createBamlValidationError(error); if (bamlError instanceof BamlValidationError) { @@ -3587,7 +3587,7 @@ class BamlStreamClient { PredictAgeBare( inp: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, Checked { + ): BamlStream>, Checked> { try { const raw = this.runtime.streamFunction( "PredictAgeBare", @@ -3599,10 +3599,10 @@ class BamlStreamClient { __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) - return new BamlStream, Checked( + return new BamlStream>, Checked>( raw, - (a): a is RecursivePartialNull => a, - (a): a is Checked a, + (a): a is RecursivePartialNull> => a, + (a): a is Checked => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) diff --git a/integ-tests/typescript/baml_client/sync_client.ts b/integ-tests/typescript/baml_client/sync_client.ts index 1873121b4..302b4b01b 100644 --- a/integ-tests/typescript/baml_client/sync_client.ts +++ b/integ-tests/typescript/baml_client/sync_client.ts @@ -1095,7 +1095,7 @@ export class BamlSyncClient { PredictAgeBare( inp: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Checked { try { const raw = this.runtime.callFunctionSync( "PredictAgeBare", @@ -1106,7 +1106,7 @@ export class BamlSyncClient { __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) - return raw.parsed() as Checked } catch (error: any) { const bamlError = createBamlValidationError(error); if (bamlError instanceof BamlValidationError) { diff --git a/integ-tests/typescript/baml_client/types.ts b/integ-tests/typescript/baml_client/types.ts index 87c4a6c7d..c4416acba 100644 --- a/integ-tests/typescript/baml_client/types.ts +++ b/integ-tests/typescript/baml_client/types.ts @@ -116,37 +116,37 @@ export enum TestEnum { G = "G", } -export interface Checks__valid_phone_number { - valid_phone_number: Check -} - -export interface Checks__too_big { - too_big: Check -} - export interface Checks__valid_email { valid_email: Check } export interface Checks__earth_aged__no_infants { - earth_aged: Check no_infants: Check + earth_aged: Check } export interface Checks__unreasonably_certain { unreasonably_certain: Check } -export interface Checks__young_enough { - young_enough: Check -} - export interface Checks__regex_bad__regex_good__trivial { trivial: Check regex_bad: Check regex_good: Check } +export interface Checks__valid_phone_number { + valid_phone_number: Check +} + +export interface Checks__too_big { + too_big: Check +} + +export interface Checks__young_enough { + young_enough: Check +} + export interface BigNumbers { a: number b: number @@ -238,7 +238,7 @@ export interface DynamicOutput { } export interface Earthling { - age: Checked } @@ -259,7 +259,7 @@ export interface Email { } export interface EmailAddress { - value: Checked } @@ -287,8 +287,8 @@ export interface FlightConfirmation { export interface FooAny { planetary_age: Martian | Earthling - certainty: Checked + species: Checked } @@ -320,7 +320,7 @@ export interface InputWithConstraint { } export interface Martian { - age: Checked } @@ -372,7 +372,7 @@ export interface Person { } export interface PhoneNumber { - value: Checked }