Genie Discord forum
![Author Avatar](https://cdn.discordapp.com/avatars/1008753638048534580/58ff429481c901cf74d72bb29b497fdb.png?size=512)
coming from Flask, I am not sure here how to load something (an LLM) when the API is launched... It cannot be handled in the route otherwise every call will hit that, but I am not sure where I should load my model... any hint to documentation that I might have missed is more than welcome!
![Author Avatar](https://cdn.discordapp.com/avatars/743412727464067154/bc30abeb49653e9978c0f7c90f4486a8.png?size=512)
You can load it when you load the API module, before the route definitions. This is how I'm doing it in an app I'm writing now (see image)
see the include
and @load
statements. You could have something like
module API
LLM = load_my_llm()
route("/llm") do
process_query()
end
end
![](https://cdn.discordapp.com/attachments/1179156477726953495/1179384445921402910/image.png?ex=65ba2fdb&is=65a7badb&hm=3e39366b42bfc8387857efbe20b05055cc8639641914e7cafcdcb0196392411f&)
![Author Avatar](https://cdn.discordapp.com/avatars/1008753638048534580/58ff429481c901cf74d72bb29b497fdb.png?size=512)
thank you! it is indeed simpler than I thought...
![Author Avatar](https://cdn.discordapp.com/avatars/738049963250155580/13375362e7047976b44a466ef441a20f.png?size=512)
beware of globals though - make it a const or a Ref
![Author Avatar](https://cdn.discordapp.com/avatars/1008753638048534580/58ff429481c901cf74d72bb29b497fdb.png?size=512)
mm not sure I understand, I am really a newbie in julia