Hi! If you want to learn how to build AI agents fo...
# ai
v
Hi! If you want to learn how to build AI agents for multiplatform, or get a few practical advices how to deal with LLM trying to escape your tool calling requirements — feel free to check out my new article: Cooking AI Agents for Every Flavor: JVM Backend, Android, iOS, JS, and WASM in One Pot
K 6
a
This is an amazing writeup Vadim. That was just so wow
🙏 1
m
Just starting to take a look and KMP is specifically what I am aiming to do as soon as I can make the time! It looks good so far but one issue
Copy code
abstract class ListMenuTool : Tool<ListMenuTool.Empty, ListMenuTool.Result>() {
    override val description: String =
        "Lists all contacts of the current user with their names, emails, and other information"
The
ListMenuTool
description
needs to be updated to match the context for menu instead of contacts.
v
@Michael Wills thanks for noticing! Fixed now 🙂
Also I used the API from the upcoming
0.5.0
where I didn’t have to specify a
ToolDescriptor
explicitly on KMP (it’s now generated automatically) 0.5.0 is coming out this week 🙂
m
Ooooooh that sounds good 😄 I was wondering about the serializer overrides if specifying those would become more automagic based on types, yet still with the ability to explicity override as it is now.
Copy code
override val argsSerializer: KSerializer<OrderProposal> = OrderProposal.serializer()
    override val resultSerializer: KSerializer<FinalOrderResult> = FinalOrderResult.serializer()
So that might somehow be picked up from
Tool<OrderProposal, FinalOrderResult>
. I'm still on the early road to learning Kotlin though...
v
> become more automagic based on types, yet still with the ability to explicity override as it is now. that’s exactly how it will be possible since upcoming
0.5.0
> So that might somehow be picked up from
Tool<OrderProposal, FinalOrderResult>
. I’m still on the early road to learning Kotlin though... (edited) For a class — unfortunately no 😞 you can do that from
inline fun <reified T> f() { … T.serializer() is OK to call here … }
but without
inline
+
reified
— no. I think @simon.vergauwen had some proposal of making Tools from functions for multiplatform (though, only functions with a single class-parameter would work) — then it will be possible I think. And also with some
::yourFunction.asTool(name = "name", description = "description")
function that would convert them. Still, class-based approach remains valid for dependency injection + inheritance. And you can’t avoid type serializers there for now
🙌 1