HATEOAS 与大语言模型结合应用

1作者: charlieflowers6 个月前
我只是观察到,灵光一现,想分享一下。<p>我所见过的说自己在“做 REST”的大部分开发团队,实际上并没有遵循 HATEOAS。按照 Roy Fielding 的严格定义,他会认为这“算不上真正的 REST”。(现在别分心,我不想卷入那场纯粹主义的争论)。<p>许多人没有做 HATEOAS 的原因是,它要求 API 客户端具有智能和适应性。它需要发现“好的,接下来我可以做什么”,应用逻辑,然后选择下一步。但许多公司的时间都很紧,把 REST 简单地理解为“通过 HTTP 传输 JSON,并使用一致的 URL 模式”要简单得多。<p>酷的是:有了 LLM 的加入,HATEOAS 就被解放了。LLM 可以做到“愚蠢”的 API 客户端做不到的事情:询问“接下来我可以做什么”,然后使用_推理_来理解这些选项并选择一个。
查看原文
Just an observation, a light bulb moment, I wanted to share.<p>Most of the dev teams I&#x27;ve ever encountered who said they were &quot;doing REST&quot; were not actually following HATEOAS. Per a strict reading of Roy Fielding, he would consider that &quot;not really REST.&quot; (Now don&#x27;t get distracted, I don&#x27;t want to wade into that whole purist debate).<p>The reason many did not do HATEOAS is that it requires the API client to be smart and adaptive. It would discover &quot;ok, what can i do next&quot;, apply logic to it, and choose the next step. But many shops were on tight time commitments and it was much simpler to just think of REST as &quot;json over http with consistent url patterns.&quot;<p>The cool thing is: With an LLM in the mix, HATEOAS is unchained. An LLM can do exactly what a &quot;dumb&quot; api client cannot: ask &quot;what can i do next&quot;, and then use _inference_ to understand those options and select one.