Skip to content

Commit

Permalink
build tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anish-palakurthi committed Jun 20, 2024
1 parent 67ab411 commit ec5ebc9
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 168 deletions.
13 changes: 13 additions & 0 deletions engine/baml-lib/jinja/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ mod render_tests {
client: RenderContext_Client {
name: "gpt4".to_string(),
provider: "openai".to_string(),
default_role: "system".to_string(),
},
output_format: OutputFormatContent::new_string(),
tags: HashMap::from([("ROLE".to_string(), BamlValue::String("john doe".into()))]),
Expand Down Expand Up @@ -542,6 +543,7 @@ mod render_tests {
client: RenderContext_Client {
name: "gpt4".to_string(),
provider: "openai".to_string(),
default_role: "system".to_string(),
},
output_format: OutputFormatContent::new_string(),
tags: HashMap::from([("ROLE".to_string(), BamlValue::String("john doe".into()))]),
Expand Down Expand Up @@ -588,6 +590,7 @@ mod render_tests {
client: RenderContext_Client {
name: "gpt4".to_string(),
provider: "openai".to_string(),
default_role: "system".to_string(),
},
output_format: OutputFormatContent::new_string(),
tags: HashMap::from([("ROLE".to_string(), BamlValue::String("john doe".into()))]),
Expand Down Expand Up @@ -644,6 +647,7 @@ mod render_tests {
client: RenderContext_Client {
name: "gpt4".to_string(),
provider: "openai".to_string(),
default_role: "system".to_string(),
},
output_format: OutputFormatContent::new_string(),
tags: HashMap::from([("ROLE".to_string(), BamlValue::String("john doe".into()))]),
Expand Down Expand Up @@ -708,6 +712,7 @@ mod render_tests {
client: RenderContext_Client {
name: "gpt4".to_string(),
provider: "openai".to_string(),
default_role: "system".to_string(),
},
output_format: OutputFormatContent::new_string(),
tags: HashMap::from([("ROLE".to_string(), BamlValue::String("john doe".into()))]),
Expand Down Expand Up @@ -747,6 +752,7 @@ mod render_tests {
client: RenderContext_Client {
name: "gpt4".to_string(),
provider: "openai".to_string(),
default_role: "system".to_string(),
},
output_format: OutputFormatContent::new_string(),
tags: HashMap::from([("ROLE".to_string(), BamlValue::String("john doe".into()))]),
Expand Down Expand Up @@ -775,6 +781,7 @@ mod render_tests {
client: RenderContext_Client {
name: "gpt4".to_string(),
provider: "openai".to_string(),
default_role: "system".to_string(),
},
output_format: OutputFormatContent::new_string(),
tags: HashMap::from([("ROLE".to_string(), BamlValue::String("john doe".into()))]),
Expand Down Expand Up @@ -803,6 +810,7 @@ mod render_tests {
client: RenderContext_Client {
name: "gpt4".to_string(),
provider: "openai".to_string(),
default_role: "system".to_string(),
},
output_format: OutputFormatContent::new_string(),
tags: HashMap::from([("ROLE".to_string(), BamlValue::String("john doe".into()))]),
Expand Down Expand Up @@ -831,6 +839,7 @@ mod render_tests {
client: RenderContext_Client {
name: "gpt4".to_string(),
provider: "openai".to_string(),
default_role: "system".to_string(),
},
output_format: OutputFormatContent::new_string(),
tags: HashMap::from([("ROLE".to_string(), BamlValue::String("john doe".into()))]),
Expand Down Expand Up @@ -881,6 +890,7 @@ mod render_tests {
client: RenderContext_Client {
name: "gpt4".to_string(),
provider: "openai".to_string(),
default_role: "system".to_string(),
},
output_format: OutputFormatContent::new_string(),
tags: HashMap::from([("ROLE".to_string(), BamlValue::String("john doe".into()))]),
Expand Down Expand Up @@ -930,6 +940,7 @@ mod render_tests {
client: RenderContext_Client {
name: "gpt4".to_string(),
provider: "openai".to_string(),
default_role: "system".to_string(),
},
output_format: OutputFormatContent::new_string(),
tags: HashMap::from([("ROLE".to_string(), BamlValue::String("john doe".into()))]),
Expand Down Expand Up @@ -993,6 +1004,7 @@ mod render_tests {
client: RenderContext_Client {
name: "gpt4".to_string(),
provider: "openai".to_string(),
default_role: "system".to_string(),
},
output_format: OutputFormatContent::new_string(),
tags: HashMap::from([("ROLE".to_string(), BamlValue::String("john doe".into()))]),
Expand Down Expand Up @@ -1035,6 +1047,7 @@ mod render_tests {
client: RenderContext_Client {
name: "gpt4".to_string(),
provider: "openai".to_string(),
default_role: "system".to_string(),
},
output_format: OutputFormatContent::new_string(),
tags: HashMap::new(),
Expand Down
54 changes: 0 additions & 54 deletions integ-tests/python/baml_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,28 +341,6 @@ async def ExtractResume2(
mdl = create_model("ExtractResume2ReturnType", inner=(types.Resume, ...))
return coerce(mdl, raw.parsed())

async def ExtractResume5(
self,
resume_text: baml_py.Image,
baml_options: BamlCallOptions = {},
) -> types.Character:
__tb__ = baml_options.get("tb", None)
if __tb__ is not None:
tb = __tb__._tb
else:
tb = None

raw = await self.__runtime.call_function(
"ExtractResume5",
{
"resume_text": resume_text,
},
self.__ctx_manager.get(),
tb,
)
mdl = create_model("ExtractResume5ReturnType", inner=(types.Character, ...))
return coerce(mdl, raw.parsed())

async def FnClassOptionalOutput(
self,
input: str,
Expand Down Expand Up @@ -1761,38 +1739,6 @@ def ExtractResume2(
tb,
)

def ExtractResume5(
self,
resume_text: baml_py.Image,
baml_options: BamlCallOptions = {},
) -> baml_py.BamlStream[partial_types.Character, types.Character]:
__tb__ = baml_options.get("tb", None)
if __tb__ is not None:
tb = __tb__._tb
else:
tb = None

raw = self.__runtime.stream_function(
"ExtractResume5",
{
"resume_text": resume_text,
},
None,
self.__ctx_manager.get(),
tb,
)

mdl = create_model("ExtractResume5ReturnType", inner=(types.Character, ...))
partial_mdl = create_model("ExtractResume5PartialReturnType", inner=(partial_types.Character, ...))

return baml_py.BamlStream[partial_types.Character, types.Character](
raw,
lambda x: coerce(partial_mdl, x),
lambda x: coerce(mdl, x),
self.__ctx_manager.get(),
tb,
)

def FnClassOptionalOutput(
self,
input: str,
Expand Down
1 change: 0 additions & 1 deletion integ-tests/python/baml_client/inlinedbaml.py

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions integ-tests/python/baml_client/partial_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ class Blah(BaseModel):

prop4: Optional[str] = None

class Character(BaseModel):


color: Optional[str] = None
clothing: Optional[str] = None

class ClassOptionalOutput(BaseModel):


Expand Down
2 changes: 1 addition & 1 deletion integ-tests/python/baml_client/type_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class TypeBuilder(_TypeBuilder):
def __init__(self):
super().__init__(classes=set(
["Blah","Character","ClassOptionalOutput","ClassOptionalOutput2","ClassWithImage","DynamicClassOne","DynamicClassTwo","DynamicOutput","Education","Email","Event","FakeImage","InnerClass","InnerClass2","NamedArgsSingleClass","OptionalTest_Prop1","OptionalTest_ReturnType","OrderInfo","Person","RaysData","Resume","SearchParams","SomeClassNestedDynamic","TestClassAlias","TestClassNested","TestClassWithEnum","TestOutputClass","UnionTest_ReturnType","WithReasoning",]
["Blah","ClassOptionalOutput","ClassOptionalOutput2","ClassWithImage","DynamicClassOne","DynamicClassTwo","DynamicOutput","Education","Email","Event","FakeImage","InnerClass","InnerClass2","NamedArgsSingleClass","OptionalTest_Prop1","OptionalTest_ReturnType","OrderInfo","Person","RaysData","Resume","SearchParams","SomeClassNestedDynamic","TestClassAlias","TestClassNested","TestClassWithEnum","TestOutputClass","UnionTest_ReturnType","WithReasoning",]
), enums=set(
["Category","Category2","Category3","Color","DataType","DynEnumOne","DynEnumTwo","EnumInClass","EnumOutput","Hobby","NamedArgsSingleEnum","NamedArgsSingleEnumList","OptionalTest_CategoryType","OrderStatus","Tag","TestEnum",]
))
Expand Down
6 changes: 0 additions & 6 deletions integ-tests/python/baml_client/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,6 @@ class Blah(BaseModel):

prop4: Optional[str] = None

class Character(BaseModel):


color: str
clothing: str

class ClassOptionalOutput(BaseModel):


Expand Down
41 changes: 0 additions & 41 deletions integ-tests/ruby/baml_client/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -309,26 +309,6 @@ def ExtractResume2(
(raw.parsed_using_types(Baml::Types))
end

sig {

params(
resume_text: Baml::Image,
).returns(Baml::Types::Character)

}
def ExtractResume5(
resume_text:
)
raw = @runtime.call_function(
"ExtractResume5",
{
"resume_text" => resume_text,
},
@ctx_manager,
)
(raw.parsed_using_types(Baml::Types))
end

sig {

params(
Expand Down Expand Up @@ -1489,27 +1469,6 @@ def ExtractResume2(
)
end

sig {
params(
resume_text: Baml::Image,
).returns(Baml::BamlStream[Baml::Types::Character])
}
def ExtractResume5(
resume_text:
)
raw = @runtime.stream_function(
"ExtractResume5",
{
"resume_text" => resume_text,
},
@ctx_manager,
)
Baml::BamlStream[Baml::PartialTypes::Character, Baml::Types::Character].new(
ffi_stream: raw,
ctx_manager: @ctx_manager
)
end

sig {
params(
input: String,
Expand Down
1 change: 0 additions & 1 deletion integ-tests/ruby/baml_client/inlined.rb

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions integ-tests/ruby/baml_client/partial-types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ module Baml

module PartialTypes
class Blah < T::Struct; end
class Character < T::Struct; end
class ClassOptionalOutput < T::Struct; end
class ClassOptionalOutput2 < T::Struct; end
class ClassWithImage < T::Struct; end
Expand Down Expand Up @@ -54,11 +53,6 @@ class Blah < T::Struct
include T::Struct::ActsAsComparable
const :prop4, T.nilable(String)
end
class Character < T::Struct
include T::Struct::ActsAsComparable
const :color, T.nilable(String)
const :clothing, T.nilable(String)
end
class ClassOptionalOutput < T::Struct
include T::Struct::ActsAsComparable
const :prop1, T.nilable(String)
Expand Down
6 changes: 0 additions & 6 deletions integ-tests/ruby/baml_client/types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ class TestEnum < T::Enum
end
end
class Blah < T::Struct; end
class Character < T::Struct; end
class ClassOptionalOutput < T::Struct; end
class ClassOptionalOutput2 < T::Struct; end
class ClassWithImage < T::Struct; end
Expand Down Expand Up @@ -164,11 +163,6 @@ class Blah < T::Struct
include T::Struct::ActsAsComparable
const :prop4, T.nilable(String)
end
class Character < T::Struct
include T::Struct::ActsAsComparable
const :color, String
const :clothing, String
end
class ClassOptionalOutput < T::Struct
include T::Struct::ActsAsComparable
const :prop1, String
Expand Down
39 changes: 1 addition & 38 deletions integ-tests/typescript/baml_client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $ pnpm add @boundaryml/baml
// biome-ignore format: autogenerated code
/* eslint-disable */
import { BamlRuntime, FunctionResult, BamlCtxManager, BamlStream, Image } from "@boundaryml/baml"
import {Blah, Character, ClassOptionalOutput, ClassOptionalOutput2, ClassWithImage, DynamicClassOne, DynamicClassTwo, DynamicOutput, Education, Email, Event, FakeImage, InnerClass, InnerClass2, NamedArgsSingleClass, OptionalTest_Prop1, OptionalTest_ReturnType, OrderInfo, Person, RaysData, Resume, SearchParams, SomeClassNestedDynamic, TestClassAlias, TestClassNested, TestClassWithEnum, TestOutputClass, UnionTest_ReturnType, WithReasoning, Category, Category2, Category3, Color, DataType, DynEnumOne, DynEnumTwo, EnumInClass, EnumOutput, Hobby, NamedArgsSingleEnum, NamedArgsSingleEnumList, OptionalTest_CategoryType, OrderStatus, Tag, TestEnum} from "./types"
import {Blah, ClassOptionalOutput, ClassOptionalOutput2, ClassWithImage, DynamicClassOne, DynamicClassTwo, DynamicOutput, Education, Email, Event, FakeImage, InnerClass, InnerClass2, NamedArgsSingleClass, OptionalTest_Prop1, OptionalTest_ReturnType, OrderInfo, Person, RaysData, Resume, SearchParams, SomeClassNestedDynamic, TestClassAlias, TestClassNested, TestClassWithEnum, TestOutputClass, UnionTest_ReturnType, WithReasoning, Category, Category2, Category3, Color, DataType, DynEnumOne, DynEnumTwo, EnumInClass, EnumOutput, Hobby, NamedArgsSingleEnum, NamedArgsSingleEnumList, OptionalTest_CategoryType, OrderStatus, Tag, TestEnum} from "./types"
import TypeBuilder from "./type_builder"

export type RecursivePartialNull<T> = T extends object
Expand Down Expand Up @@ -232,21 +232,6 @@ export class BamlClient {
return raw.parsed() as Resume
}

async ExtractResume5(
resume_text: Image,
__baml_options__?: { tb?: TypeBuilder }
): Promise<Character> {
const raw = await this.runtime.callFunction(
"ExtractResume5",
{
"resume_text": resume_text
},
this.ctx_manager.get(),
__baml_options__?.tb?.__tb(),
)
return raw.parsed() as Character
}

async FnClassOptionalOutput(
input: string,
__baml_options__?: { tb?: TypeBuilder }
Expand Down Expand Up @@ -1199,28 +1184,6 @@ class BamlStreamClient {
)
}

ExtractResume5(
resume_text: Image,
__baml_options__?: { tb?: TypeBuilder }
): BamlStream<RecursivePartialNull<Character>, Character> {
const raw = this.runtime.streamFunction(
"ExtractResume5",
{
"resume_text": resume_text
},
undefined,
this.ctx_manager.get(),
__baml_options__?.tb?.__tb(),
)
return new BamlStream<RecursivePartialNull<Character>, Character>(
raw,
(a): a is RecursivePartialNull<Character> => a,
(a): a is Character => a,
this.ctx_manager.get(),
__baml_options__?.tb?.__tb(),
)
}

FnClassOptionalOutput(
input: string,
__baml_options__?: { tb?: TypeBuilder }
Expand Down
1 change: 0 additions & 1 deletion integ-tests/typescript/baml_client/inlinedbaml.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integ-tests/typescript/baml_client/type_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class TypeBuilder {
constructor() {
this.tb = new _TypeBuilder({
classes: new Set([
"Blah","Character","ClassOptionalOutput","ClassOptionalOutput2","ClassWithImage","DynamicClassOne","DynamicClassTwo","DynamicOutput","Education","Email","Event","FakeImage","InnerClass","InnerClass2","NamedArgsSingleClass","OptionalTest_Prop1","OptionalTest_ReturnType","OrderInfo","Person","RaysData","Resume","SearchParams","SomeClassNestedDynamic","TestClassAlias","TestClassNested","TestClassWithEnum","TestOutputClass","UnionTest_ReturnType","WithReasoning",
"Blah","ClassOptionalOutput","ClassOptionalOutput2","ClassWithImage","DynamicClassOne","DynamicClassTwo","DynamicOutput","Education","Email","Event","FakeImage","InnerClass","InnerClass2","NamedArgsSingleClass","OptionalTest_Prop1","OptionalTest_ReturnType","OrderInfo","Person","RaysData","Resume","SearchParams","SomeClassNestedDynamic","TestClassAlias","TestClassNested","TestClassWithEnum","TestOutputClass","UnionTest_ReturnType","WithReasoning",
]),
enums: new Set([
"Category","Category2","Category3","Color","DataType","DynEnumOne","DynEnumTwo","EnumInClass","EnumOutput","Hobby","NamedArgsSingleEnum","NamedArgsSingleEnumList","OptionalTest_CategoryType","OrderStatus","Tag","TestEnum",
Expand Down
6 changes: 0 additions & 6 deletions integ-tests/typescript/baml_client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,6 @@ export interface Blah {

}

export interface Character {
color: string
clothing: string

}

export interface ClassOptionalOutput {
prop1: string
prop2: string
Expand Down

0 comments on commit ec5ebc9

Please sign in to comment.