https://www.boundaryml.com logo
🟡 Implementing multiple classes in prompt paramet...
# questions
z
How can I implement two different classes in the prompt params? guessing it would an "or" or "|" operator.
v
yep!
z
what would a condition in the prompt look like to check if it's a particular class?
v
depends on the type! can you share?
(we don't have an
instanceof
in baml yet, but there are ways to check using jinja)
z
This is the gist(bottom half truncated): function SearchAgent(search_request: SearchRequest | CandidateResult[]) -> SearchResponse { client SearchAgentClient prompt #" You are DevMatch's talent search agent. Plan your search step by step. {% if search_request %} Job Description: {{ search_request.description }} {% endif %} {% if search_request.previous_results %} Previous Results: {{ search_request.previous_results }} {% endif %} }
v
one is an array other isn't?
z
Yes
v
what fields does SearchRequest have?
z
one is the from the initial request and the other input is from a tool result. I'm sure there is a more elegant way to do it.
class SearchRequest { job_description string? @description("Job description context") previous_results string? @description("Results from previous tool calls") }
Hmm a little bit of redundancy, may remove "previous_results" field from this model.
v
easiest way is actually likely to just pass in 2 different parameters. But jinja way is to check if
serach_request|has_attr('job_description')