Routing HTTP path strings...without HTTP?
bit of a weird one, hear me out! i'm working on an application which uses llms + tools to hit some "endpoints" like
for clarity, you can imagine my LLM tool to be defined as:
the issue here is the fetch. there is no reason perform a real fetch request to a real endpoint when the API itself is just a construct for the llm. in reality, it would be much more efficient to:
of couse, we need the
LMK!
/api/v1/posts /api/v1/posts/1234. i've put endpoints in quotes because, while they are currently implemented as endpoints, that is really just an abstraction i've found useful for language models - they are extremely reliable at generating well formed URLs. in reality, these endpoints do not require a full HTTP server, they just need to map from string -> function. for clarity, you can imagine my LLM tool to be defined as:
the issue here is the fetch. there is no reason perform a real fetch request to a real endpoint when the API itself is just a construct for the llm. in reality, it would be much more efficient to:
of couse, we need the
match function. basically a router. i could build my own, but i'm wondering if it's possible to use the internal HTTPRouter to just match strings -> functions and skip the HTTP transport entirely.LMK!
