File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed
Expand file tree Collapse file tree 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' ;
21import {
32 createCallbacksTransformer ,
43 readableFromAsyncIterable ,
54 type AIStreamCallbacksAndOptions ,
65} from './ai-stream' ;
76import { createStreamDataTransformer } from './stream-data' ;
87
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+
937async function * streamable ( stream : AsyncIterable < ChatCompletionResponseChunk > ) {
1038 for await ( const chunk of stream ) {
1139 const content = chunk . choices [ 0 ] ?. delta ?. content ;
You can’t perform that action at this time.
0 commit comments