File tree 2 files changed +34
-1
lines changed
2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' ai ' : patch
3
+ ---
4
+
5
+ Fix: remove mistral lib type dependency.
Original file line number Diff line number Diff line change 1
- import { ChatCompletionResponseChunk } from '@mistralai/mistralai' ;
2
1
import {
3
2
createCallbacksTransformer ,
4
3
readableFromAsyncIterable ,
5
4
type AIStreamCallbacksAndOptions ,
6
5
} from './ai-stream' ;
7
6
import { createStreamDataTransformer } from './stream-data' ;
8
7
8
+ interface ChatCompletionResponseChunk {
9
+ id : string ;
10
+ object : 'chat.completion.chunk' ;
11
+ created : number ;
12
+ model : string ;
13
+ choices : ChatCompletionResponseChunkChoice [ ] ;
14
+ }
15
+
16
+ interface ChatCompletionResponseChunkChoice {
17
+ index : number ;
18
+ delta : {
19
+ role ?: string ;
20
+ content ?: string ;
21
+ tool_calls ?: ToolCalls [ ] ;
22
+ } ;
23
+ finish_reason : string ;
24
+ }
25
+
26
+ interface FunctionCall {
27
+ name : string ;
28
+ arguments : string ;
29
+ }
30
+
31
+ interface ToolCalls {
32
+ id : 'null' ;
33
+ type : 'function' ;
34
+ function : FunctionCall ;
35
+ }
36
+
9
37
async function * streamable ( stream : AsyncIterable < ChatCompletionResponseChunk > ) {
10
38
for await ( const chunk of stream ) {
11
39
const content = chunk . choices [ 0 ] ?. delta ?. content ;
You can’t perform that action at this time.
0 commit comments