Skip to content

Commit

Permalink
codegen fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
imalsogreg committed Oct 16, 2024
1 parent c23aa49 commit 982b2a5
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion engine/language_client_codegen/src/typescript/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion integ-tests/python/baml_client/partial_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


###############################################################################
Expand Down
24 changes: 12 additions & 12 deletions integ-tests/python/baml_client/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down
12 changes: 6 additions & 6 deletions integ-tests/typescript/baml_client/async_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ export class BamlAsyncClient {
async PredictAgeBare(
inp: string,
__baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry }
): Promise<Checked<number,Checks__too_big> {
): Promise<Checked<number,Checks__too_big>> {
try {
const raw = await this.runtime.callFunction(
"PredictAgeBare",
Expand All @@ -1106,7 +1106,7 @@ export class BamlAsyncClient {
__baml_options__?.tb?.__tb(),
__baml_options__?.clientRegistry,
)
return raw.parsed() as Checked<number,Checks__too_big
return raw.parsed() as Checked<number,Checks__too_big>
} catch (error: any) {
const bamlError = createBamlValidationError(error);
if (bamlError instanceof BamlValidationError) {
Expand Down Expand Up @@ -3587,7 +3587,7 @@ class BamlStreamClient {
PredictAgeBare(
inp: string,
__baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry }
): BamlStream<RecursivePartialNull<Checked<number,Checks__too_big>, Checked<number,Checks__too_big> {
): BamlStream<RecursivePartialNull<Checked<number,Checks__too_big>>, Checked<number,Checks__too_big>> {
try {
const raw = this.runtime.streamFunction(
"PredictAgeBare",
Expand All @@ -3599,10 +3599,10 @@ class BamlStreamClient {
__baml_options__?.tb?.__tb(),
__baml_options__?.clientRegistry,
)
return new BamlStream<RecursivePartialNull<Checked<number,Checks__too_big>, Checked<number,Checks__too_big>(
return new BamlStream<RecursivePartialNull<Checked<number,Checks__too_big>>, Checked<number,Checks__too_big>>(
raw,
(a): a is RecursivePartialNull<Checked<number,Checks__too_big> => a,
(a): a is Checked<number,Checks__too_big => a,
(a): a is RecursivePartialNull<Checked<number,Checks__too_big>> => a,
(a): a is Checked<number,Checks__too_big> => a,
this.ctx_manager.cloneContext(),
__baml_options__?.tb?.__tb(),
)
Expand Down
4 changes: 2 additions & 2 deletions integ-tests/typescript/baml_client/sync_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ export class BamlSyncClient {
PredictAgeBare(
inp: string,
__baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry }
): Checked<number,Checks__too_big {
): Checked<number,Checks__too_big> {
try {
const raw = this.runtime.callFunctionSync(
"PredictAgeBare",
Expand All @@ -1106,7 +1106,7 @@ export class BamlSyncClient {
__baml_options__?.tb?.__tb(),
__baml_options__?.clientRegistry,
)
return raw.parsed() as Checked<number,Checks__too_big
return raw.parsed() as Checked<number,Checks__too_big>
} catch (error: any) {
const bamlError = createBamlValidationError(error);
if (bamlError instanceof BamlValidationError) {
Expand Down
38 changes: 19 additions & 19 deletions integ-tests/typescript/baml_client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -238,7 +238,7 @@ export interface DynamicOutput {
}

export interface Earthling {
age: Checked<number,Checks__earth_aged__no_infants
age: Checked<number,Checks__earth_aged__no_infants>

}

Expand All @@ -259,7 +259,7 @@ export interface Email {
}

export interface EmailAddress {
value: Checked<string,Checks__valid_email
value: Checked<string,Checks__valid_email>

}

Expand Down Expand Up @@ -287,8 +287,8 @@ export interface FlightConfirmation {

export interface FooAny {
planetary_age: Martian | Earthling
certainty: Checked<number,Checks__unreasonably_certain
species: Checked<string,Checks__regex_bad__regex_good__trivial
certainty: Checked<number,Checks__unreasonably_certain>
species: Checked<string,Checks__regex_bad__regex_good__trivial>

}

Expand Down Expand Up @@ -320,7 +320,7 @@ export interface InputWithConstraint {
}

export interface Martian {
age: Checked<number,Checks__young_enough
age: Checked<number,Checks__young_enough>

}

Expand Down Expand Up @@ -372,7 +372,7 @@ export interface Person {
}

export interface PhoneNumber {
value: Checked<string,Checks__valid_phone_number
value: Checked<string,Checks__valid_phone_number>

}

Expand Down

0 comments on commit 982b2a5

Please sign in to comment.