-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
host.promiseQueue Causing Cache Misses and Repeated Requests #972
Comments
Feedback: The issue described is that To resolve this, you should ensure that each call to Additionally, consider using
|
Good one. I'll look into this next week. |
|
This works now: const innerPrompt = `Generate 2 word poem. ${Math.random()}`
await Promise.all(
Array(10)
.fill(0)
.map(async (_, i) => {
await runPrompt(innerPrompt, { cache: "inner", label: `run-${i}` })
})
) |
I modified the innerPrompt in the example to |
The sha is computed by takes the LLM request object and the LLM identifier for the same set of messages/provider, you get a cache hit (label is ignored which is the only different piece in this inner request). The first request that has a cache miss runs and the promise of the chat execution is maintained in the cache object. The next request that has a cache hit while the chat execution is still in progress will share the same promise. I'll run your example to see. Note: building a repository map seems to be a hot topic! |
(I've pushed v1.88.0 with the current changes) |
@anrgct also added |
You were right. @anrgct i fixed a race on the loading of the cache. Looks good on your sample now. |
"Added deepseek:deekseek-chat support" You're really attentive! Thank you! |
I am getting cache hits on every invocations now, at least on main. I will do a release shortly. |
v1.87.0, I found that
host.promiseQueue
causes the cache to miss, resulting in repeated requests.The text was updated successfully, but these errors were encountered: