TypeSafe AI 谈 Jev 的 state 计费与提问策略
how to Jev
TypeSafe AI 介绍 Jev 的用法:请求中的 `state` 部分只计费一次,无论基于它问多少个问题;因此通常更划算的做法是先把可能需要的所有问题都问出来,再用代码筛选整理。被引用的 Allie the Icon 则指出,Jev 的输入 token 计费为 (state+(所有问题之和)),同一 state 并行提问只收一次 state 费用,但单次调用内两个问题仍比一个问题贵;成本敏感时可只在实际需要时运行低频追问,速度优先时批量提问通常更优。
查看原帖答案是有细微差别的! Jev 对输入 token 的计费方式是: (state+(所有问题之和)) 这里的关键在于,无论你并行运行多少个问题,你的 state token 都只会被计费一次。 在单次调用中,两个问题确实比一个问题花费更多。但如果你把这两个问题作为使用相同 state 的独立请求来提问,总体花费会更高,因为在第二个请求中你会再次为 state 付费。 在你对成本比对速度更敏感的情况下,分析你的用例中后续问题的使用频率是合理的。如果某些后续问题很少需要,那么只在真正需要时运行它们就能节省成本。 但在速度比成本更重要的情况下,批量处理几乎总是更优(不过这里也有一些细微差别,比如单个超大的后续问题会拖慢调用,因此根据该答案所需频率,把它分流到单独的调用中可能是有意义的!)
查看原文
The answer has nuance! The way Jev charges for input tokens is: (state+(sum of all questions)) The important bit here is that you only get charged once for your state tokens no matter how many questions you run in parallel. Within a single call, two questions do cost more than one. But if you ask those two questions as separate requests with the same state, you pay more overall, because you pay for the state again in the second request. In cases where you are more cost-sensitive than speed-sensitive, it makes sense to do analysis on how often the follow-up questions are used in your use-case. If some follow-ups are needed very rarely, then you can save on cost by running them only when actually needed. But in cases where speed is more important than cost, then batching pretty much always wins (although there's some nuance there as well, such as a single super-huge follow-up question slowing down the call, so shunting it to its own call could make sense, depending on the frequency that that answer is needed!)
正文 · AI 翻译
如何使用 Jev
• 无论你针对请求中的 `state` 部分提出多少个问题,这部分都只计费一次 • 因此,通常更划算的做法是把你可能想得到答案的所有问题都问出来,哪怕你还不确定自己是否需要这个答案 • 然后再用代码来筛选整理
把所有你可能需要的信息都纳入进来,再筛选出重要的部分!可靠的自动化意味着覆盖所有可能的情况