https://toitlang.org/ logo
Improve AI for Toit
# general
d
Asking Gemini if it is still useful in a time of LLMs to use an OO language. "Hallucinated Pointer" sounds bad. Maybe tuning a small model (for local, inexpensive deployment) for Toit + teaching it how to readily expose existing C libraries as services (displays, cameras, etc)? That would be a sweet setup. https://cdn.discordapp.com/attachments/918498540232253483/1462865630935126066/oo-lang-pro-con.md?ex=69730b09&is=6971b989&hm=3941b40d620b16f803cf5d51f6d3df9c2f20a2f92afe098132dfddeeebdee42d&
f
I’ve thought about this a bit, but haven’t had time to explore it in depth yet. There seem to be two main approaches to improving AI support for Toit: 1. Using a RAG-based setup, where we add Toit code and documentation to a retrieval index. 2. Fine-tuning a model on Toit-specific material. The RAG approach feels significantly simpler. I’m not sure how much effort it would take to set up in practice, though.
g
I'm getting AS_CHECK_FAILS on "json-msg/Map := json.decode msg" even though msg is definitely a string. I'm not very fluent in toit, but i'm pretty sure Gemini's explanation "In Toit, json.decode returns a special Map-like object that often fails a strict Map type check." means Gemini is degenerating into conspiracy theory! (Unless you are hiding "special" Map types??)
f
Could you reask the question in the '#help' channel? (This way any response would be public on help.toit.io)
g
It was more of a comment. I'll struggle a little more before asking for help. thanks.
f
Basically, there could be two issues: - use
json.parse
if
msg
is a string (and not a ByteArray). - if the
msg
is a string (
"json-string"
) then the returned object isn't a
Map
. If neither applies to you, please provide the backtrace with the exact error message.
g
thank you. In general Antigravity (and Gemini) is amazing and has reignited my fondness for toit.
parse works perfectly, despite Gemini's misinformation "Does your encoding.json import actually provide parse, or is it decode? Standard Toit usually uses json.decode. If you’re manually using parse, it might be an alias or a different function with different requirements." Obviously Gemini would benefit from more learning, but, thank you again for being this far along.
f
parse
is for strings.
decode
is for ByteArrays.
d
I have been using https://exe.dev/docs/what-is-exe recently to develop a web/mobile app, and the new agent Shelley is a substantial upgrade to Sketch (which I wrote about in a June show-and-tell). It relies on Opus 4.5 which does a really nice job, but I am fearful of what the subscription costs might be for these models, for hobbyist developers. I put some thoughts in a placeholder https://github.com/davidg238/sedaris
m
Don't know if this helps?