Skip to content

Commit

Permalink
undo integ-test changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hellovai committed Jul 3, 2024
1 parent 0d2d4ea commit 1efbc90
Show file tree
Hide file tree
Showing 16 changed files with 807 additions and 744 deletions.
2 changes: 1 addition & 1 deletion integ-tests/baml_src/fiddle-examples/images/image.baml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ function DescribeImage4(classWithImage: ClassWithImage, img2: image) -> string {
test TestName {
functions [DescribeImage]
args {
img { url "http://imgs.xkcd.com/comics/standards.png" }
img { url "https://imgs.xkcd.com/comics/standards.png"}
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
class Response {
type string
reason string
appropriate_for_video_games bool
score int @description(#"
1-5, 1 being best at video game background music and 5 being worst
"#)
}

function AudioInput(aud: audio) -> Response {
function AudioInput(aud: audio) -> string{
client Gemini
prompt #"
Describe the sound.

{{ ctx.output_format(prefix="Answer in this schema:\n") }}


{{ _.role("user") }}

Does this sound like a roar? Yes or no? One word no other characters.

{{ aud }}
"#
Expand Down
15 changes: 7 additions & 8 deletions integ-tests/baml_src/test-files/testing_pipeline/resume.baml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ class Resume {
name string
email string
phone string
experience string[]
education Education[]
experience Education[]
education string[]
skills string[]
}

Expand All @@ -12,9 +12,7 @@ class Education {
location string
degree string
major string[]
date string? @alias(start_date) @description(#"
YYYY-MM
"#)
graduation_date string?
}

template_string AddRole(foo: string) #"
Expand All @@ -31,6 +29,7 @@ function ExtractResume(resume: string, img: image?) -> Resume {

Extract data:


<<<<
{{ resume }}
<<<<
Expand All @@ -46,9 +45,9 @@ function ExtractResume(resume: string, img: image?) -> Resume {
test sam_resume {
functions [ExtractResume]
input {
// img {
// url "https://avatars.githubusercontent.com/u/1016595?v=4"
// }
img {
url "https://avatars.githubusercontent.com/u/1016595?v=4"
}
resume #"
Sam Lijin
he/him | [email protected] | sxlijin.github.io | 111-222-3333 | sxlijin | sxlijin
Expand Down
12 changes: 6 additions & 6 deletions integ-tests/python/baml_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async def AudioInput(
self,
aud: baml_py.Audio,
baml_options: BamlCallOptions = {},
) -> types.Response:
) -> str:
__tb__ = baml_options.get("tb", None)
if __tb__ is not None:
tb = __tb__._tb
Expand All @@ -74,7 +74,7 @@ async def AudioInput(
self.__ctx_manager.get(),
tb,
)
mdl = create_model("AudioInputReturnType", inner=(types.Response, ...))
mdl = create_model("AudioInputReturnType", inner=(str, ...))
return coerce(mdl, raw.parsed())

async def ClassifyMessage(
Expand Down Expand Up @@ -1433,7 +1433,7 @@ def AudioInput(
self,
aud: baml_py.Audio,
baml_options: BamlCallOptions = {},
) -> baml_py.BamlStream[partial_types.Response, types.Response]:
) -> baml_py.BamlStream[Optional[str], str]:
__tb__ = baml_options.get("tb", None)
if __tb__ is not None:
tb = __tb__._tb
Expand All @@ -1450,10 +1450,10 @@ def AudioInput(
tb,
)

mdl = create_model("AudioInputReturnType", inner=(types.Response, ...))
partial_mdl = create_model("AudioInputPartialReturnType", inner=(partial_types.Response, ...))
mdl = create_model("AudioInputReturnType", inner=(str, ...))
partial_mdl = create_model("AudioInputPartialReturnType", inner=(Optional[str], ...))

return baml_py.BamlStream[partial_types.Response, types.Response](
return baml_py.BamlStream[Optional[str], str](
raw,
lambda x: coerce(partial_mdl, x),
lambda x: coerce(mdl, x),
Expand Down
8 changes: 4 additions & 4 deletions integ-tests/python/baml_client/inlinedbaml.py

Large diffs are not rendered by default.

14 changes: 3 additions & 11 deletions integ-tests/python/baml_client/partial_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Education(BaseModel):
location: Optional[str] = None
degree: Optional[str] = None
major: List[Optional[str]]
date: Optional[str] = None
graduation_date: Optional[str] = None

class Email(BaseModel):

Expand Down Expand Up @@ -173,22 +173,14 @@ class ReceiptItem(BaseModel):
quantity: Optional[int] = None
price: Optional[float] = None

class Response(BaseModel):


type: Optional[str] = None
reason: Optional[str] = None
appropriate_for_video_games: Optional[bool] = None
score: Optional[int] = None

class Resume(BaseModel):


name: Optional[str] = None
email: Optional[str] = None
phone: Optional[str] = None
experience: List[Optional[str]]
education: List["Education"]
experience: List["Education"]
education: List[Optional[str]]
skills: List[Optional[str]]

class SearchParams(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","ClassOptionalOutput","ClassOptionalOutput2","ClassWithImage","DynInputOutput","DynamicClassOne","DynamicClassTwo","DynamicOutput","Education","Email","Event","FakeImage","InnerClass","InnerClass2","NamedArgsSingleClass","OptionalTest_Prop1","OptionalTest_ReturnType","OrderInfo","Person","RaysData","ReceiptInfo","ReceiptItem","Response","Resume","SearchParams","SomeClassNestedDynamic","TestClassAlias","TestClassNested","TestClassWithEnum","TestOutputClass","UnionTest_ReturnType","WithReasoning",]
["Blah","ClassOptionalOutput","ClassOptionalOutput2","ClassWithImage","DynInputOutput","DynamicClassOne","DynamicClassTwo","DynamicOutput","Education","Email","Event","FakeImage","InnerClass","InnerClass2","NamedArgsSingleClass","OptionalTest_Prop1","OptionalTest_ReturnType","OrderInfo","Person","RaysData","ReceiptInfo","ReceiptItem","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
14 changes: 3 additions & 11 deletions integ-tests/python/baml_client/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class Education(BaseModel):
location: str
degree: str
major: List[str]
date: Optional[str] = None
graduation_date: Optional[str] = None

class Email(BaseModel):

Expand Down Expand Up @@ -264,22 +264,14 @@ class ReceiptItem(BaseModel):
quantity: int
price: float

class Response(BaseModel):


type: str
reason: str
appropriate_for_video_games: bool
score: int

class Resume(BaseModel):


name: str
email: str
phone: str
experience: List[str]
education: List["Education"]
experience: List["Education"]
education: List[str]
skills: List[str]

class SearchParams(BaseModel):
Expand Down
6 changes: 3 additions & 3 deletions integ-tests/ruby/baml_client/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def self.from_directory(path)

params(
aud: Baml::Audio,
).returns(Baml::Types::Response)
).returns(String)

}
def AudioInput(
Expand Down Expand Up @@ -1299,7 +1299,7 @@ def initialize(runtime:, ctx_manager:)
sig {
params(
aud: Baml::Audio,
).returns(Baml::BamlStream[Baml::Types::Response])
).returns(Baml::BamlStream[String])
}
def AudioInput(
aud:
Expand All @@ -1311,7 +1311,7 @@ def AudioInput(
},
@ctx_manager,
)
Baml::BamlStream[Baml::PartialTypes::Response, Baml::Types::Response].new(
Baml::BamlStream[T.nilable(String), String].new(
ffi_stream: raw,
ctx_manager: @ctx_manager
)
Expand Down
6 changes: 3 additions & 3 deletions integ-tests/ruby/baml_client/inlined.rb

Large diffs are not rendered by default.

14 changes: 3 additions & 11 deletions integ-tests/ruby/baml_client/partial-types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class Person < T::Struct; end
class RaysData < T::Struct; end
class ReceiptInfo < T::Struct; end
class ReceiptItem < T::Struct; end
class Response < T::Struct; end
class Resume < T::Struct; end
class SearchParams < T::Struct; end
class SomeClassNestedDynamic < T::Struct; end
Expand Down Expand Up @@ -96,7 +95,7 @@ class Education < T::Struct
const :location, T.nilable(String)
const :degree, T.nilable(String)
const :major, T::Array[T.nilable(String)]
const :date, T.nilable(String)
const :graduation_date, T.nilable(String)
end
class Email < T::Struct
include T::Struct::ActsAsComparable
Expand Down Expand Up @@ -171,20 +170,13 @@ class ReceiptItem < T::Struct
const :quantity, T.nilable(Integer)
const :price, T.nilable(Float)
end
class Response < T::Struct
include T::Struct::ActsAsComparable
const :type, T.nilable(String)
const :reason, T.nilable(String)
const :appropriate_for_video_games, T.nilable(T::Boolean)
const :score, T.nilable(Integer)
end
class Resume < T::Struct
include T::Struct::ActsAsComparable
const :name, T.nilable(String)
const :email, T.nilable(String)
const :phone, T.nilable(String)
const :experience, T::Array[T.nilable(String)]
const :education, T::Array[Baml::PartialTypes::Education]
const :experience, T::Array[Baml::PartialTypes::Education]
const :education, T::Array[T.nilable(String)]
const :skills, T::Array[T.nilable(String)]
end
class SearchParams < T::Struct
Expand Down
14 changes: 3 additions & 11 deletions integ-tests/ruby/baml_client/types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ class Person < T::Struct; end
class RaysData < T::Struct; end
class ReceiptInfo < T::Struct; end
class ReceiptItem < T::Struct; end
class Response < T::Struct; end
class Resume < T::Struct; end
class SearchParams < T::Struct; end
class SomeClassNestedDynamic < T::Struct; end
Expand Down Expand Up @@ -206,7 +205,7 @@ class Education < T::Struct
const :location, String
const :degree, String
const :major, T::Array[String]
const :date, T.nilable(String)
const :graduation_date, T.nilable(String)
end
class Email < T::Struct
include T::Struct::ActsAsComparable
Expand Down Expand Up @@ -281,20 +280,13 @@ class ReceiptItem < T::Struct
const :quantity, Integer
const :price, Float
end
class Response < T::Struct
include T::Struct::ActsAsComparable
const :type, String
const :reason, String
const :appropriate_for_video_games, T::Boolean
const :score, Integer
end
class Resume < T::Struct
include T::Struct::ActsAsComparable
const :name, String
const :email, String
const :phone, String
const :experience, T::Array[String]
const :education, T::Array[Baml::Types::Education]
const :experience, T::Array[Baml::Types::Education]
const :education, T::Array[String]
const :skills, T::Array[String]
end
class SearchParams < T::Struct
Expand Down
Loading

0 comments on commit 1efbc90

Please sign in to comment.