https://www.boundaryml.com logo
Playground fails with 400 error while same BAML fu...
# help
k
I've tried restarting VScode, deleting my whole baml_client directory and regenerating it, and a few other things. What could explain how my BAML function is working while the playground only raises an error?
a
is tehre an api key set in the playground?
can you paste the full error?
what provider do you use?
k
yes my vertex api key is set in the playground. Here is my full error:
Copy code
Unspecified error code: 400 Request failed with status code: 400 Bad Request, 
<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 400 (Bad Request)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>400.</b> <ins>That’s an error.</ins>
  <p>Your client has issued a malformed or illegal request.  <ins>That’s all we know.</ins>


Request options: {"generation_config":{"temperature":0.0,"seed":42,"top_p":0.95,"thinkingConfig":{"thinkingBudget":0}}}
https://cdn.discordapp.com/attachments/1432827386189054044/1432878815595597996/image.png?ex=6902a7e3&is=69015663&hm=73d0d0fc7fde9cc099d28a01688155fe9bd5f9dc1d2ad250b4a90f56205cc441&
a
Can you copy the curl request? From the playground
k
I can't copy the whole thing, to avoid sharing secrets, but I do see something strange there:
Copy code
curl 'http://localhost:61301/' \
>   -H 'sec-ch-ua-platform: "macOS"' \
>   -H 'baml-original-url: https://$GEMINI_REGION-aiplatform.googleapis.com/v1/projects/...
I don't know why the
$GEMINI_REGION
variable is not getting picked up here; I have it defined both in my
.env
and
.bash_profile
and restarted my terminal and vscode etc. In the process of poking around there I also noticed that my vscode extension had been upgraded to 0.212.0, out of sync with my baml-py version (0.211.2) so I downgraded the extension to match, but that did not help.
a
and if you run the curl request in your terminal you get the same error right? you can try to see what the request looks like in python by doing
b.request.MyFunction()
, and compare it to the playground. Sorry you're running into these issues, I'll track an issue on our end
one thing is to try to disable playground proxy in vsocde settings and reload the playground via:
baml.enablePlaygroundProxy: "false"
k
thanks -- I'll report back if I get a chance to explore your suggestions here, but for now my quick fix is to define
GEMINI_REGION
in the API keys section of the playground. I thought other variables were getting read directly from my global environment, but possibly I was wrong about that
3 Views