We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 2561e3a + 8960c49 commit dbcb0f1Copy full SHA for dbcb0f1
1 file changed
src/providers/deepinfra/chatComplete.ts
@@ -113,6 +113,11 @@ interface DeepInfraStreamChunk {
113
index: number;
114
finish_reason: string | null;
115
}[];
116
+ usage?: {
117
+ prompt_tokens: number;
118
+ completion_tokens: number;
119
+ total_tokens: number;
120
+ };
121
}
122
123
export const DeepInfraChatCompleteResponseTransform: (
@@ -208,6 +213,13 @@ export const DeepInfraChatCompleteStreamChunkTransform: (
208
213
finish_reason: parsedChunk.choices[0].finish_reason,
209
214
},
210
215
],
216
+ usage: parsedChunk.usage
217
+ ? {
218
+ prompt_tokens: parsedChunk.usage.prompt_tokens,
219
+ completion_tokens: parsedChunk.usage.completion_tokens,
220
+ total_tokens: parsedChunk.usage.total_tokens,
221
+ }
222
+ : undefined,
211
223
})}` + '\n\n'
212
224
);
225
};
0 commit comments