https://www.boundaryml.com logo
This may be simple but... is it
# questions
r
This may be simple but... is it reasonable to use function calling to issue entities I extract new, unique UUID
id
property? I need them to work across references... if the two records are the same, they should have the same UUID. Like in this example I need the
Ticker
I extract and the
Company.ticker
to have the same UUID if all values are the same... this would just simplify downstream processing a lot! This is what happens in my Gemini 2.5 Pro extraction, they are the same but aren duplicated. The reason is that downstream I ETL this stuff in PySpark and have to work to assign tickers across all companies with the same name, then assign the most common/longest company name to all instances of the ticker. But... without a starting identifier, once I process those... There is also a
Product.company
field, and how am I to know at that point whether those objects match without going through each field - which will not now match? Any tips?
Copy code
class Ticker {
  id uuid
  @description("Unique identifier for this record")

  name string
  @description("Name of the company")

  symbol string
  @description("Ticker symbol of the company if publicly traded")

  exchange string?
  @description("Exchange where the company is traded")
}

class Company {
  id uuid
  @description("Unique identifier for this record")

  name string
  @description("Formal name of the company with company suffix")

  ticker Ticker?
  @description("Ticker symbol of the company if publicly traded")

  description string?
  @description("Description of the company")
}
Honestly, I could even just get them by ID - could a prompt do this?
v
LLMs are generally going to be bad at generating consistent random sequences. It’s not really a part of their training set. What I would do is have the LLM generate a thing like company1 etc for the id, then remap to the right uuid in code
It’s more likely to succeed
r
Function calling exists for this, LLMs are good at it. Doing it myself later makes ER 2x as hard.
Consecutively numbered then converted to UUID, per document…
That’s actually not too bad… of a hack. When will you get function calling?
Seems like you could extend Jinja2 with a uuid type?
v
Yea but the issue with uuid is that we can’t guarantee anything consistent from models
r
You could via function calling. Models run Python for you for use cases like this, but I would suggest just doing the job yourself on the client in the template. If you can substitute, then do so? Just put a constant dummy value and substitute UUIDs for records… I’m not exactly sure how you handle duping in the data to have the same UUID except for subbing them in after analyzing the returned data for duplicates… but you probably can ask for unique IDs that aren’t UUIDs, given that LLMs like Gemini will reliably, precisely duplicate a
Ticker
or
Company
among many places in the entire data, Make sense? You can extend Jinja2 with this capability?
Maybe function calling is the way to go, I just don’t understand how BAML works well enough to speculate. The docs say you plan to support function calling… I would suggest this will be the most common use case. Everyone is going to need to deduplicate the knowledge graphs they are building with BAML. UUIDs are critical for this.
Cc @prrao you have any thoughts here? Post processing for exact equivalence is a drag! It’s like hoisting schemas… takes up space in the output, too. You really want an option for IDs only for references.
p
No immediate thoughts, but this is a lot to digest! Will take a look when I can šŸ˜