https://www.boundaryml.com logo
🟡 Question about passing state as a string in ai-...
# questions
m
Hey everyone! Potentially dumb question here... Been working my way through Vaibhav and Dexter's ai-that-works series and in Ep #7 at around 27:30 Vaibhav says he's gonna do something really dumb and pass in state as a string for the PickAction function. Wondering why this is dumb as I saw the same pattern in Ep #4 with the DetermineNextStep function whereby the ongoing chat thread was simply passed in as a string. What would be a better implementation or pattern for this stuff? Cheers! PS thanks for the awesome ai-that-works series, it has been truly eye opening 👌
v
Hi @mpb_001100 ! The only reason I actually use the word dumb there is because it’s just inefficient when it comes to how your code looks long term. How’s your system evolves you will likely want to manipulate how you render the context so you likely need a sequence of objects with a custom render. The problem with a string is that you can’t really manipulate it past the original point. The reason we do something different in our episode sometimes is one to challenge ourselves, and two strings are definitely faster to code. So similarly in your code base you might want to do something similar where if you’re trying to ship really quickly just smash a bunch of strings together but as you go on if you need to make your code nicer and more accurate shift to an array of objects
Hope that helps!
m
Thanks for clarifying mate!