File tree Expand file tree Collapse file tree 5 files changed +34
-9
lines changed Expand file tree Collapse file tree 5 files changed +34
-9
lines changed Original file line number Diff line number Diff line change @@ -606,6 +606,9 @@ export const AnthropicChatCompleteStreamChunkTransform: (
606606 streamState ,
607607 strictOpenAiCompliance
608608) => {
609+ if ( streamState . toolIndex == undefined ) {
610+ streamState . toolIndex = - 1 ;
611+ }
609612 let chunk = responseChunk . trim ( ) ;
610613 if (
611614 chunk . startsWith ( 'event: ping' ) ||
@@ -724,9 +727,7 @@ export const AnthropicChatCompleteStreamChunkTransform: (
724727 parsedChunk . type === 'content_block_start' &&
725728 parsedChunk . content_block ?. type === 'tool_use' ;
726729 if ( isToolBlockStart ) {
727- streamState . toolIndex = streamState . toolIndex
728- ? streamState . toolIndex + 1
729- : 0 ;
730+ streamState . toolIndex = streamState . toolIndex + 1 ;
730731 }
731732 const isToolBlockDelta : boolean =
732733 parsedChunk . type === 'content_block_delta' &&
Original file line number Diff line number Diff line change 11import { ProviderAPIConfig } from '../types' ;
22
33export const dashscopeAPIConfig : ProviderAPIConfig = {
4- getBaseURL : ( ) => 'https://dashscope.aliyuncs.com/compatible-mode/v1' ,
4+ getBaseURL : ( ) => 'https://dashscope-intl .aliyuncs.com/compatible-mode/v1' ,
55 headers ( { providerOptions } ) {
66 const { apiKey } = providerOptions ;
77 return { Authorization : `Bearer ${ apiKey } ` } ;
Original file line number Diff line number Diff line change @@ -8,7 +8,30 @@ import { ProviderConfigs } from '../types';
88import { dashscopeAPIConfig } from './api' ;
99
1010export const DashScopeConfig : ProviderConfigs = {
11- chatComplete : chatCompleteParams ( [ ] , { model : 'qwen-turbo' } ) ,
11+ chatComplete : chatCompleteParams (
12+ [ ] ,
13+ { model : 'qwen-turbo' } ,
14+ {
15+ top_k : {
16+ param : 'top_k' ,
17+ } ,
18+ repetition_penalty : {
19+ param : 'repetition_penalty' ,
20+ } ,
21+ stop : {
22+ param : 'stop' ,
23+ } ,
24+ enable_search : {
25+ param : 'enable_search' ,
26+ } ,
27+ enable_thinking : {
28+ param : 'enable_thinking' ,
29+ } ,
30+ thinking_budget : {
31+ param : 'thinking_budget' ,
32+ } ,
33+ }
34+ ) ,
1235 embed : embedParams ( [ ] , { model : 'text-embedding-v1' } ) ,
1336 api : dashscopeAPIConfig ,
1437 responseTransforms : responseTransformers ( DASHSCOPE , {
Original file line number Diff line number Diff line change @@ -806,6 +806,9 @@ export const VertexAnthropicChatCompleteStreamChunkTransform: (
806806 streamState ,
807807 strictOpenAiCompliance
808808) => {
809+ if ( streamState . toolIndex == undefined ) {
810+ streamState . toolIndex = - 1 ;
811+ }
809812 let chunk = responseChunk . trim ( ) ;
810813
811814 if (
@@ -916,9 +919,7 @@ export const VertexAnthropicChatCompleteStreamChunkTransform: (
916919 parsedChunk . type === 'content_block_start' &&
917920 parsedChunk . content_block ?. type === 'tool_use' ;
918921 if ( isToolBlockStart ) {
919- streamState . toolIndex = streamState . toolIndex
920- ? streamState . toolIndex + 1
921- : 0 ;
922+ streamState . toolIndex = streamState . toolIndex + 1 ;
922923 }
923924 const isToolBlockDelta : boolean =
924925 parsedChunk . type === 'content_block_delta' &&
Original file line number Diff line number Diff line change @@ -181,7 +181,7 @@ export const OpenAIChatCompleteJSONToStreamResponseTransform: (
181181 const streamChunkTemplate : Record < string , any > = {
182182 id,
183183 object : 'chat.completion.chunk' ,
184- created : Date . now ( ) ,
184+ created : Math . floor ( Date . now ( ) / 1000 ) ,
185185 model : model || '' ,
186186 system_fingerprint : system_fingerprint || null ,
187187 provider,
You can’t perform that action at this time.
0 commit comments