Hey folks, we're having a weird issue that may or may not be a direct result of the way we're trying
Hey folks, we're having a weird issue that may or may not be a direct result of the way we're trying to leverage the AI binding in our worker.
We're using the application context to inject the various instances of Cloudflare bindings (we've done this for KV, R2 and multiple other services and now trying for AI).
We setup a
We would then do something along the lines of:
Where the
Our
But, when we try to do something similar to in a service:
we catch an error which is hard to debug
We're using the application context to inject the various instances of Cloudflare bindings (we've done this for KV, R2 and multiple other services and now trying for AI).
We setup a
withAI and useAI method that allows us to inject the binding instance into our workers from a core package.We would then do something along the lines of:
Where the
Env interface was generated by wrangler types.Our
_env.AI in this case is of abstract class Ai as defined in the workers-type pacakge.But, when we try to do something similar to in a service:
we catch an error which is hard to debug