File tree Expand file tree Collapse file tree 2 files changed +14
-54
lines changed Expand file tree Collapse file tree 2 files changed +14
-54
lines changed Original file line number Diff line number Diff line change 1
1
import { ParameterConfig } from '../types' ;
2
+ import { chatCompleteParams } from '../open-ai-base' ;
2
3
3
4
interface ChatChoice {
4
5
index : number ;
@@ -18,53 +19,15 @@ interface StreamChoice {
18
19
finish_reason : string | null ;
19
20
}
20
21
21
- export const NscaleChatCompleteConfig : { [ key : string ] : ParameterConfig } = {
22
- messages : {
23
- param : 'messages' ,
24
- required : true ,
25
- } ,
26
- model : {
27
- param : 'model' ,
28
- required : true ,
29
- } ,
30
- max_tokens : {
31
- param : 'max_tokens' ,
32
- } ,
33
- n : {
34
- param : 'n' ,
35
- } ,
36
- temperature : {
37
- param : 'temperature' ,
38
- default : 1 ,
39
- } ,
40
- top_p : {
41
- param : 'top_p' ,
42
- } ,
43
- stream : {
44
- param : 'stream' ,
45
- } ,
46
- logprobs : {
47
- param : 'logprobs' ,
48
- } ,
49
- top_logprobs : {
50
- param : 'top_logprobs' ,
51
- } ,
52
- frequency_penalty : {
53
- param : 'frequency_penalty' ,
54
- } ,
55
- presence_penalty : {
56
- param : 'presence_penalty' ,
57
- } ,
58
- response_format : {
59
- param : 'response_format' ,
60
- } ,
61
- stop : {
62
- param : 'stop' ,
63
- } ,
64
- logit_bias : {
65
- param : 'logit_bias' ,
66
- } ,
67
- } ;
22
+ export const NscaleChatCompleteConfig = chatCompleteParams ( [
23
+ 'functions' ,
24
+ 'function_call' ,
25
+ 'user' ,
26
+ 'seed' ,
27
+ 'tools' ,
28
+ 'tool_choice' ,
29
+ 'stream_options' ,
30
+ ] ) ;
68
31
69
32
export const NscaleChatCompleteResponseTransform = ( response : any ) => {
70
33
return {
Original file line number Diff line number Diff line change 1
1
import { ProviderConfigs } from '../types' ;
2
2
import NscaleAPIConfig from './api' ;
3
- import {
4
- NscaleChatCompleteConfig ,
5
- NscaleChatCompleteResponseTransform ,
6
- NscaleChatCompleteStreamChunkTransform ,
7
- } from './chatComplete' ;
3
+ import { NscaleChatCompleteConfig } from './chatComplete' ;
8
4
import {
9
5
NscaleImageGenerateConfig ,
10
6
NscaleImageGenerateResponseTransform ,
11
7
} from './imageGenerate' ;
8
+ import { responseTransformers } from '../open-ai-base' ;
9
+ import { NSCALE } from '../../globals' ;
12
10
13
11
const NscaleConfig : ProviderConfigs = {
14
12
chatComplete : NscaleChatCompleteConfig ,
15
13
imageGenerate : NscaleImageGenerateConfig ,
16
14
api : NscaleAPIConfig ,
17
15
responseTransforms : {
18
- chatComplete : NscaleChatCompleteResponseTransform ,
19
- 'stream-chatComplete' : NscaleChatCompleteStreamChunkTransform ,
16
+ ...responseTransformers ( NSCALE , { chatComplete : true } ) ,
20
17
imageGenerate : NscaleImageGenerateResponseTransform ,
21
18
} ,
22
19
} ;
You can’t perform that action at this time.
0 commit comments