作者转发 allietheicon 的 Jev 模式最佳实践,介绍推测性提问:在多数情况下把问题批量合并进单次调用更快且往往更便宜,即使还不确定是否需要答案。原因包括单次调用可完成整个任务、只需为状态中的 token 付费一次从而避免重复支付状态成本、同一调用中问题互不影响输出因此准确性不受损;图中建议在初始调用中随 gate 一起加入追问,代码先检查 gate,只使用需要的追问答案并忽略其余。
can’t get answers to questions you don’t ask! Jev first, figure it out later.
fresh best practices drop from @allietheicon
在 X 查看被引用的帖子One of the most important Jev patterns to learn is what we sometimes call "speculative questions".
In the majority of cases, it's faster and even often cheaper to batch questions together in to a single call, *even when you don't yet know if you'll need the answers!*
Why? Many reasons:
Speed! Oftentimes you can accomplish the entire task in a single call, instead of multiple sequential calls in different logic paths.
Cost! You only pay for tokens in state once per call, so batching questions also avoids paying for the state multiple times. When your state is large, batching questions often saves cost compared to sequential calls that duplicate state.
Questions never affect the output of other questions in the same call, so accuracy will not suffer.
来源:TypeSafe AI · x.com