https://www.boundaryml.com logo
How do I check for a class inside a
# general
b
How do I check for a class inside a jinja string conditional? E.g.
if <thing> is typeof "MyClass"
v
sadly this is hard to do in jinja except for checking if a key or set of keys exist. in BAML 1.0 you can just do:
Copy code
prompt: `${value is MyClass}`
(we still accept jinja strings as well, but they get re-written to this version under the hood and have a bit more capability!)
b
Is 1.0 stable enough NOW that I should upgrade?
Or will there be many changes in the next 2 months?
Copy code
py
class DrawnShape {
  type "Circle" | "Arrow"
}

class DrawnWriting {
  type "Text"
}

type Drawing = DrawnShape | DrawnWriting
Then:
Copy code
py
{% if drawing.type == "Text" %}
### Yields:
"property 'type' has inconsistent types across classes in type alias Drawing"
or..
"property 'type' has inconsistent types across union members"
(same same?)
v
are those two a warning or an error (I think just warnings?)? if so we can look into it (but you can also ignore jinja warnings). Jinja is quite hard to typecheck as it only half carries the information. re 1.0 upgrading, we have one last set of changes we're hoping for as we test for stability (1-2 weeks?), but i think a few folks have already tested it in prod (including us). we don't yet have type-builder support or client registry, that is still planned.
b
Warnings! My files are yellow in cursor 🙁 re 1.0: Oh, I use client registry extensively. So there's no programmatic client changing? My API gives consumers model options which routes into BAML
v
well there is actually, but its slightly different. instead of client_registry, you just pass in a client object directly into the function as a parameter.
let me check how we construct new clients in the python bridge
b
Yeah as far as I remember, client registry was never the right shape for achieving that
v
cc @baml-sam who was putting together a compatability document for python / BAML
yep, we too were not happy with client registry
so we are hoping to make it much more ergonomic for doing this kind of work
b
ergomaxxing
Why are you up right now, isn't it super late in the US
Oh 10:30pm. Not too bad 😂
v
yea normal hours 😉
i'm just making some website copy updates
can send you a peek if you're interested!
b
I am!
v
give me 5-10 and i'll push
b
Claude Codes + Zyn + Techno method for 5-10 minutes "I will push, I'm a coder!"
This prompted me to finally look into the new docs. Wow! It seems SUPER exciting at a first glance! Syntax highlighted logic????
v
here ya go
curious to see your take on it!
feedback on what resonates and what doesn't would be super helpful!
b
I'm not familiar enough with that site yet to be able to tell what changed in that update 😂 sorry
v
oh no worries on that end
just meant to ask whats resonating haha
b
I did notice the site update overall few days ago. Overall the old docs were much better for humans. Writing it "as an essay" is an interesting idea though. The essay style feels like a great way to get buy-in from someone unfamiliar
But as a dev on the daily juggling many different languages and having bolted BAML on top of everything else, it's easy to forget syntax. I frequently look up syntax, and the old docs style serves better for that use-case
The essay is ALSO great for getting into 1.0. Overall it's a very nice way of introducing the language
But not a very nice way of providing a reference. I think Fern with "Guide" + "Examples" + "Reference" is the better approach for daily dev with BAML
@Vaibhav (BAML 🐑) How about calling it /tutorial instead of /explore Then create a dedicated /docs route that renders a Fern propper docs site https://cdn.discordapp.com/attachments/1524283402453254305/1524303759935672401/image.png?ex=6a4f4200&is=6a4df080&hm=0d68102c203fab279e1483162a0f31fa84dcb0b02a392461347672ae217b0765&
v
we will likely have some sort of a docs page
but we're still thinking what manner that will be!
b
Yeah, I found your mintlify experiment hehe
v
currently our docs are actually all direct from
baml describe
oh that one is very not in sync haha
b
Yeah 😂
Fern worked amazingly for me!
The "Guide" (sub menu) + "Examples" (submenu) + "Refernec" (submenu) split was PERFECT for me to navigate as a human trying to lookup syntax or how-to's
v
there's also a leet code version here: https://boundaryml.com/bamlcode
b
That's cool too
But again I feel these new "docs" experiements are not great for daily dev
Most of the time I'm trying to find one very specific thing, not take a course
v
yea valid point!
do you think you'd actually read the docs tho, or do you feel like you would just point your agent at it?
b
Love the leetcode version though. When I eventually will do the upgrade I'll use that to get myself onboarded
Actually the leetcode format seems amazing compared to reading the essay
I would use the docs myself, so far Claude Code has not been as great as myself at designing BAML pipelines
Oh the leetcode version is LITTERALY leetcode problems 🤦‍♂️
I think that site has potential to be more than a joke! I think it could genuinely be a very powerful way of getting people onboarded to understand how features translate into real use-cases. But solving actual leetcode problems doesn't seem like the right shape 😂
maybe the essay should litteraly be at
/essay
, then change the course material of the leetcode thing and make it
/tutorial
essay could also be on
/why
"explore" doesn't land for me
This is not really feedback on routes, it's more that I got surprised of the format the first time I clicked "Learn BAML", I didn't expect to find a one-pager there
Also, who actually learns anything by reading a one-pager essay
Actually, the main route is super minimal right now. Why don't you just put the essay bellow the fold? So if people scroll on https://boundaryml.com/ They will find the essay
Then "Learn BAML" takes you to the leetcode tutorial, and instead of leetcode it ACTUALLY teaches you the language via minimal use-cases that each introduce a new feature. Label "problems" with feature-tags, e.g:
Problem 1: "[classes] Extract Resume Fields"
The one-pager is good, but it doesn't really teach you. And there is no content under the fold on the main route, so why not put this here? The one-pager feels like a semi-manifesto AND a light introduction to the actual language. That fits really well as being the main landingpage IMO
Essays are amazing btw. Make SV great again, reinstate PG as the king, and bring reading + essays back
v
sorry i feel assleep 🥲
this is great feedback btw, I think small things like naming the route to
/why
is an easy win! regarding the docs vs manifesto concept, you're def right, the goal was def to just produce a single artifact that explains WHY 1.0 is there, but its less so of a tutorial
2 Views