Skip to content

Commit be03f9d

Browse files
committed
Add prompt_cache_key
1 parent def282e commit be03f9d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/api/providers/deepinfra.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,18 @@ export class DeepInfraHandler extends RouterProvider implements SingleCompletion
6161
_metadata?: ApiHandlerCreateMessageMetadata,
6262
): ApiStream {
6363
const { id: modelId, info, reasoningEffort: reasoning_effort } = await this.fetchModel()
64+
let prompt_cache_key = undefined;
65+
if (info.supportsPromptCache && _metadata?.taskId) {
66+
prompt_cache_key = _metadata.taskId;
67+
}
6468

6569
const requestOptions: OpenAI.Chat.Completions.ChatCompletionCreateParamsStreaming = {
6670
model: modelId,
6771
messages: [{ role: "system", content: systemPrompt }, ...convertToOpenAiMessages(messages)],
6872
stream: true,
6973
stream_options: { include_usage: true },
7074
reasoning_effort,
75+
prompt_cache_key,
7176
}
7277

7378
if (this.supportsTemperature(modelId)) {

0 commit comments

Comments
 (0)