Skip to content

Commit

Permalink
added integs
Browse files Browse the repository at this point in the history
  • Loading branch information
anish-palakurthi committed Jun 20, 2024
1 parent dfe054a commit 6c03c3b
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function AudioInput(aud: audio) -> string{
prompt #"
{{ _.role("user") }}

What is this person? Answer with a single word and no other characters.
Does this sound like a dinosaur? Yes or no? One word no other characters.

{{ aud }}
"#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function TestImageInput(img: image) -> string{
client Gemini
client GPT4o
prompt #"
{{ _.role("user") }}

Expand Down
4 changes: 2 additions & 2 deletions integ-tests/python/baml_client/inlinedbaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
"test-files/aliases/enums.baml": "enum TestEnum {\n A @alias(\"k1\") @description(#\"\n User is angry\n \"#)\n B @alias(\"k22\") @description(#\"\n User is happy\n \"#)\n // tests whether k1 doesnt incorrectly get matched with k11\n C @alias(\"k11\") @description(#\"\n User is sad\n \"#)\n D @alias(\"k44\") @description(\n User is confused\n )\n E @description(\n User is excited\n )\n F @alias(\"k5\") // only alias\n \n G @alias(\"k6\") @description(#\"\n User is bored\n With a long description\n \"#)\n \n @@alias(\"Category\")\n}\n\nfunction FnTestAliasedEnumOutput(input: string) -> TestEnum {\n client GPT35\n prompt #\"\n Classify the user input into the following category\n \n {{ ctx.output_format }}\n\n {{ _.role('user') }}\n {{input}}\n\n {{ _.role('assistant') }}\n Category ID:\n \"#\n}\n\ntest FnTestAliasedEnumOutput {\n functions [FnTestAliasedEnumOutput]\n args {\n input \"mehhhhh\"\n }\n}",
"test-files/comments/comments.baml": "// add some functions, classes, enums etc with comments all over.",
"test-files/dynamic/dynamic.baml": "class DynamicClassOne {\n @@dynamic\n}\n\nenum DynEnumOne {\n @@dynamic\n}\n\nenum DynEnumTwo {\n @@dynamic\n}\n\nclass SomeClassNestedDynamic {\n hi string\n @@dynamic\n\n}\n\nclass DynamicClassTwo {\n hi string\n some_class SomeClassNestedDynamic\n status DynEnumOne\n @@dynamic\n}\n\nfunction DynamicFunc(input: DynamicClassOne) -> DynamicClassTwo {\n client GPT35\n prompt #\"\n Please extract the schema from \n {{ input }}\n\n {{ ctx.output_format }}\n \"#\n}\n\nclass DynamicOutput {\n @@dynamic\n}\n \nfunction MyFunc(input: string) -> DynamicOutput {\n client GPT4\n prompt #\"\n Given a string, extract info using the schema:\n\n {{ input}}\n\n {{ ctx.output_format }}\n \"#\n}",
"test-files/functions/input/named-args/single/named-audio.baml": "function AudioInput(aud: audio) -> string{\n client Gemini\n prompt #\"\n {{ _.role(\"user\") }}\n\n What is this person? Answer with a single word and no other characters.\n \n {{ aud }}\n \"#\n}\n\n\ntest TestURLAudioInput{\n functions [AudioInput]\n args {\n aud{ \n url http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4\n }\n } \n}",
"test-files/functions/input/named-args/single/named-audio.baml": "function AudioInput(aud: audio) -> string{\n client Gemini\n prompt #\"\n {{ _.role(\"user\") }}\n\n Does this sound like a dinosaur? Yes or no? One word no other characters.\n \n {{ aud }}\n \"#\n}\n\n\ntest TestURLAudioInput{\n functions [AudioInput]\n args {\n aud{ \n url http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4\n }\n } \n}",
"test-files/functions/input/named-args/single/named-boolean.baml": "\n\nfunction TestFnNamedArgsSingleBool(myBool: bool) -> string{\n client GPT35\n prompt #\"\n Return this value back to me: {{myBool}}\n \"#\n}\n\ntest TestFnNamedArgsSingleBool {\n functions [TestFnNamedArgsSingleBool]\n args {\n myBool true\n }\n}",
"test-files/functions/input/named-args/single/named-class-list.baml": "\n\n\nfunction TestFnNamedArgsSingleStringList(myArg: string[]) -> string{\n client GPT35\n prompt #\"\n Return this value back to me: {{myArg}}\n \"#\n}\n\ntest TestFnNamedArgsSingleStringList {\n functions [TestFnNamedArgsSingleStringList]\n args {\n myArg [\"hello\", \"world\"]\n }\n}",
"test-files/functions/input/named-args/single/named-class.baml": "class NamedArgsSingleClass {\n key string\n key_two bool\n key_three int\n // TODO: doesn't work with keys with numbers\n // key2 bool\n // key3 int\n}\n\nfunction TestFnNamedArgsSingleClass(myArg: NamedArgsSingleClass) -> string {\n client GPT35\n prompt #\"\n Print these values back to me:\n {{myArg.key}}\n {{myArg.key_two}}\n {{myArg.key_three}}\n \"#\n}\n\ntest TestFnNamedArgsSingleClass {\n functions [TestFnNamedArgsSingleClass]\n args {\n myArg {\n key \"example\",\n key_two true,\n key_three 42\n }\n }\n}\n\nfunction TestMulticlassNamedArgs(myArg: NamedArgsSingleClass, myArg2: NamedArgsSingleClass) -> string {\n client GPT35\n prompt #\"\n Print these values back to me:\n {{myArg.key}}\n {{myArg.key_two}}\n {{myArg.key_three}}\n {{myArg2.key}}\n {{myArg2.key_two}}\n {{myArg2.key_three}}\n \"#\n}",
"test-files/functions/input/named-args/single/named-enum-list.baml": "enum NamedArgsSingleEnumList {\n ONE\n TWO\n}\n\nfunction TestFnNamedArgsSingleEnumList(myArg: NamedArgsSingleEnumList[]) -> string {\n client GPT35\n prompt #\"\n Print these values back to me:\n {{myArg}}\n \"#\n}\n\ntest TestFnNamedArgsSingleEnumList {\n functions [TestFnNamedArgsSingleEnumList]\n args {\n myArg [ONE, TWO]\n }\n}",
"test-files/functions/input/named-args/single/named-enum.baml": "enum NamedArgsSingleEnum {\n ONE\n TWO\n}\n\nfunction FnTestNamedArgsSingleEnum(myArg: NamedArgsSingleEnum) -> string {\n client GPT35\n prompt #\"\n Print these values back to me:\n {{myArg}}\n \"#\n}\n\ntest FnTestNamedArgsSingleEnum {\n functions [FnTestNamedArgsSingleEnum]\n args {\n myArg ONE\n }\n}",
"test-files/functions/input/named-args/single/named-float.baml": "function TestFnNamedArgsSingleFloat(myFloat: float) -> string {\n client GPT35\n prompt #\"\n Return this value back to me: {{myFloat}}\n \"#\n}\n\ntest TestFnNamedArgsSingleFloat {\n functions [TestFnNamedArgsSingleFloat]\n args {\n myFloat 3.14\n }\n}\n",
"test-files/functions/input/named-args/single/named-image.baml": "function TestImageInput(img: image) -> string{\n client Gemini\n prompt #\"\n {{ _.role(\"user\") }}\n\n Describe this in 4 words {{img}}\n \"#\n}\n\ntest TestImageInput {\n functions [TestImageInput]\n args {\n img {\n url \"https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png\"\n }\n }\n}\n\ntest shrek {\n functions [TestImageInput]\n args {\n img {\n url \"https://upload.wikimedia.org/wikipedia/en/4/4d/Shrek_%28character%29.png\"\n }\n }\n}\n\n\n// double check this before adding it. Probably n ot right.\n// function TestImageInputAnthropic(img: image) -> string{\n// client GPT4o\n// prompt #\"\n// {{ _.role(\"user\") }}\n\n// Describe this in 4 words {{img}}\n// \"#\n// }\n\n// test TestImageInputAnthropic {\n// functions [TestImageInputAnthropic]\n// args {\n// img {\n// base64 iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAApgAAAKYB3X3/OAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAANCSURBVEiJtZZPbBtFFMZ/M7ubXdtdb1xSFyeilBapySVU8h8OoFaooFSqiihIVIpQBKci6KEg9Q6H9kovIHoCIVQJJCKE1ENFjnAgcaSGC6rEnxBwA04Tx43t2FnvDAfjkNibxgHxnWb2e/u992bee7tCa00YFsffekFY+nUzFtjW0LrvjRXrCDIAaPLlW0nHL0SsZtVoaF98mLrx3pdhOqLtYPHChahZcYYO7KvPFxvRl5XPp1sN3adWiD1ZAqD6XYK1b/dvE5IWryTt2udLFedwc1+9kLp+vbbpoDh+6TklxBeAi9TL0taeWpdmZzQDry0AcO+jQ12RyohqqoYoo8RDwJrU+qXkjWtfi8Xxt58BdQuwQs9qC/afLwCw8tnQbqYAPsgxE1S6F3EAIXux2oQFKm0ihMsOF71dHYx+f3NND68ghCu1YIoePPQN1pGRABkJ6Bus96CutRZMydTl+TvuiRW1m3n0eDl0vRPcEysqdXn+jsQPsrHMquGeXEaY4Yk4wxWcY5V/9scqOMOVUFthatyTy8QyqwZ+kDURKoMWxNKr2EeqVKcTNOajqKoBgOE28U4tdQl5p5bwCw7BWquaZSzAPlwjlithJtp3pTImSqQRrb2Z8PHGigD4RZuNX6JYj6wj7O4TFLbCO/Mn/m8R+h6rYSUb3ekokRY6f/YukArN979jcW+V/S8g0eT/N3VN3kTqWbQ428m9/8k0P/1aIhF36PccEl6EhOcAUCrXKZXXWS3XKd2vc/TRBG9O5ELC17MmWubD2nKhUKZa26Ba2+D3P+4/MNCFwg59oWVeYhkzgN/JDR8deKBoD7Y+ljEjGZ0sosXVTvbc6RHirr2reNy1OXd6pJsQ+gqjk8VWFYmHrwBzW/n+uMPFiRwHB2I7ih8ciHFxIkd/3Omk5tCDV1t+2nNu5sxxpDFNx+huNhVT3/zMDz8usXC3ddaHBj1GHj/As08fwTS7Kt1HBTmyN29vdwAw+/wbwLVOJ3uAD1wi/dUH7Qei66PfyuRj4Ik9is+hglfbkbfR3cnZm7chlUWLdwmprtCohX4HUtlOcQjLYCu+fzGJH2QRKvP3UNz8bWk1qMxjGTOMThZ3kvgLI5AzFfo379UAAAAASUVORK5CYII=\n// media_type \"image/png\"\n// }\n// }\n// }",
"test-files/functions/input/named-args/single/named-image.baml": "function TestImageInput(img: image) -> string{\n client GPT4o\n prompt #\"\n {{ _.role(\"user\") }}\n\n Describe this in 4 words {{img}}\n \"#\n}\n\ntest TestImageInput {\n functions [TestImageInput]\n args {\n img {\n url \"https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png\"\n }\n }\n}\n\ntest shrek {\n functions [TestImageInput]\n args {\n img {\n url \"https://upload.wikimedia.org/wikipedia/en/4/4d/Shrek_%28character%29.png\"\n }\n }\n}\n\n\n// double check this before adding it. Probably n ot right.\n// function TestImageInputAnthropic(img: image) -> string{\n// client GPT4o\n// prompt #\"\n// {{ _.role(\"user\") }}\n\n// Describe this in 4 words {{img}}\n// \"#\n// }\n\n// test TestImageInputAnthropic {\n// functions [TestImageInputAnthropic]\n// args {\n// img {\n// base64 iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAApgAAAKYB3X3/OAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAANCSURBVEiJtZZPbBtFFMZ/M7ubXdtdb1xSFyeilBapySVU8h8OoFaooFSqiihIVIpQBKci6KEg9Q6H9kovIHoCIVQJJCKE1ENFjnAgcaSGC6rEnxBwA04Tx43t2FnvDAfjkNibxgHxnWb2e/u992bee7tCa00YFsffekFY+nUzFtjW0LrvjRXrCDIAaPLlW0nHL0SsZtVoaF98mLrx3pdhOqLtYPHChahZcYYO7KvPFxvRl5XPp1sN3adWiD1ZAqD6XYK1b/dvE5IWryTt2udLFedwc1+9kLp+vbbpoDh+6TklxBeAi9TL0taeWpdmZzQDry0AcO+jQ12RyohqqoYoo8RDwJrU+qXkjWtfi8Xxt58BdQuwQs9qC/afLwCw8tnQbqYAPsgxE1S6F3EAIXux2oQFKm0ihMsOF71dHYx+f3NND68ghCu1YIoePPQN1pGRABkJ6Bus96CutRZMydTl+TvuiRW1m3n0eDl0vRPcEysqdXn+jsQPsrHMquGeXEaY4Yk4wxWcY5V/9scqOMOVUFthatyTy8QyqwZ+kDURKoMWxNKr2EeqVKcTNOajqKoBgOE28U4tdQl5p5bwCw7BWquaZSzAPlwjlithJtp3pTImSqQRrb2Z8PHGigD4RZuNX6JYj6wj7O4TFLbCO/Mn/m8R+h6rYSUb3ekokRY6f/YukArN979jcW+V/S8g0eT/N3VN3kTqWbQ428m9/8k0P/1aIhF36PccEl6EhOcAUCrXKZXXWS3XKd2vc/TRBG9O5ELC17MmWubD2nKhUKZa26Ba2+D3P+4/MNCFwg59oWVeYhkzgN/JDR8deKBoD7Y+ljEjGZ0sosXVTvbc6RHirr2reNy1OXd6pJsQ+gqjk8VWFYmHrwBzW/n+uMPFiRwHB2I7ih8ciHFxIkd/3Omk5tCDV1t+2nNu5sxxpDFNx+huNhVT3/zMDz8usXC3ddaHBj1GHj/As08fwTS7Kt1HBTmyN29vdwAw+/wbwLVOJ3uAD1wi/dUH7Qei66PfyuRj4Ik9is+hglfbkbfR3cnZm7chlUWLdwmprtCohX4HUtlOcQjLYCu+fzGJH2QRKvP3UNz8bWk1qMxjGTOMThZ3kvgLI5AzFfo379UAAAAASUVORK5CYII=\n// media_type \"image/png\"\n// }\n// }\n// }",
"test-files/functions/input/named-args/single/named-int.baml": "// test for int\nfunction TestFnNamedArgsSingleInt(myInt: int) -> string {\n client GPT35\n prompt #\"\n Return this value back to me: {{myInt}}\n \"#\n}\n\ntest TestFnNamedArgsSingleInt {\n functions [TestFnNamedArgsSingleInt]\n args {\n myInt 42\n }\n}\n",
"test-files/functions/input/named-args/single/named-string-list.baml": "// string[]\nfunction TestFnNamedArgsSingleStringArray(myStringArray: string[]) -> string {\n client GPT35\n prompt #\"\n Return this value back to me: {{myStringArray}}\n \"#\n}\n\ntest TestFnNamedArgsSingleStringArray {\n functions [TestFnNamedArgsSingleStringArray]\n args {\n myStringArray [\"example1\", \"example2\", \"example3\"]\n }\n}\n",
"test-files/functions/input/named-args/single/named-string-optional.baml": "\n\n // string[]\nfunction FnNamedArgsSingleStringOptional(myString: string?) -> string {\n client GPT35\n prompt #\"\n Return this value back to me: {{myString}}\n \"#\n}\n\ntest FnNamedArgsSingleStringOptional {\n functions [FnNamedArgsSingleStringOptional]\n args {\n myString \"example string\"\n }\n}\n\ntest FnNamedArgsSingleStringOptional2 {\n functions [FnNamedArgsSingleStringOptional]\n args {\n \n }\n}\n",
Expand Down
4 changes: 2 additions & 2 deletions integ-tests/python/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ async def test_should_work_with_image_base64():
@pytest.mark.asyncio
async def test_should_work_with_audio_base64():
res = await b.AudioInput(aud=baml_py.Audio.from_base64("audio/mp3", audio_b64))
assert "monster" not in res.lower()
assert "yes" in res.lower()


@pytest.mark.asyncio
Expand All @@ -123,7 +123,7 @@ async def test_should_work_with_audio_url():
"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4"
)
)
assert "monster" in res.lower()
assert "no" in res.lower()


@pytest.mark.asyncio
Expand Down
Loading

0 comments on commit 6c03c3b

Please sign in to comment.