Hi @Amy_Weatherford - High five for giving Pack building a try . Unfortunately the SDK doesn’t provide a way to say “one of these two parameters are required”. Any given parameter is either required or optional. There are a few options you an take though:
Only accept a URL. Just because the API supports an ID doesn’t mean your Pack needs to as well. The URL seems more user-friendly of the two.
Include two optional parameters, and validate them in your code. Early in the execute function, check that the user has entered one and only one of them, and throw a UserVisibleError if they haven’t. It’s easier to misuse the formula, but the error should make it clear what the problem was.
Have one required parameter that accepts an ID or a URL. The Pack code determines if the input is a valid URL, and if not assumes it’s an ID.
My recommendation would be to go with either option #1 or #3. I used something similar to option #3 in my Packs Metadata Pack, and you can see the code here:
Thanks! That’s not quite what I was after, but I definitely appreciate the answer nonetheless! (The idea is a formula where either parameter A or parameter B, is required, but not both. It’s a bit odd, haha.)
Thank you–this is great! I’ll probably end up going with #3–I was already leaning towards it, and having sample code to look at just about clinches it, haha. (I may default back to #1 if #3 decides to be difficult on me, but we’ll see
Sadly I don’t think I’m an advanced enough programmer/math person to fully grasp what you’re saying, but I have some idea–more after looking it up. Assuming that I understand right–yes, that could be very handy!
I can appreciate the tech jargon is daunting. Maybe this and this will help.
The simplicity of text embeddings is that given two pieces of text, we can know how similar they are even when we can’t predict what the texts will be. As such, it’s possible to code a system expecting terms like tortoise and hare, but users might use turtle and rabbit.
This gives us a new tool in the development of applications that can react correctly despite the terms users choose to guide the apps and formulas.