Skip to content
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

缓存无法命中问题 #71

Open
scarecrow-x opened this issue Jan 8, 2025 · 0 comments
Open

缓存无法命中问题 #71

scarecrow-x opened this issue Jan 8, 2025 · 0 comments

Comments

@scarecrow-x
Copy link

多次反复提交相同的prompt返回的prompt_cache_hit_tokens一直为0
`const completion = await openai.chat.completions.create({
messages: [
{
role: "system",
content: "提供一个方案,解决mongoose并发更新的赛马问题",
},
],
model: "deepseek-chat",
});

await delay(5000);

const completion2 = await openai.chat.completions.create({
messages: [
{
role: "system",
content: "提供一个方案,解决mongoose并发更新的赛马问题",
},
{
role: "assistant",
content: completion.choices[0].message.content,
},
{
role: "system",
content: "我的场景是在一个高并发的场景下,如何保证更新的原子性?",
},
],
model: "deepseek-chat",
});

console.log(JSON.stringify(completion2.usage));
console.log(completion2.choices[0].message.content);

{"prompt_tokens":1015,"completion_tokens":1457,"total_tokens":2472,"prompt_cache_hit_tokens":0,"prompt_cache_miss_tokens":1015}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant