-
Notifications
You must be signed in to change notification settings - Fork 39
/
types.ts
115 lines (108 loc) 路 2.36 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/**
* Cohere: Models for text generation
* @export
*/
export enum CohereModel {
CommandR = 'command-r',
Command = 'command',
CommandLight = 'command-light'
}
/**
* Cohere: Models for use in embeddings
* @export
*/
export enum CohereEmbedModel {
EmbedEnglishV30 = 'embed-english-v3.0',
EmbedEnglishLightV30 = 'embed-english-light-v3.0',
EmbedMultiLingualV30 = 'embed-multilingual-v3.0',
EmbedMultiLingualLightV30 = 'embed-multilingual-light-v3.0'
}
/**
* Cohere: Specify how and if the token likelihoods are returned with the response.
* @export
*/
export enum CohereReturnLikelihoods {
GENERATION = 'GENERATION',
ALL = 'ALL',
NONE = 'NONE'
}
/**
* Cohere: Model options for text generation
* @export
*/
export type CohereConfig = {
model: CohereModel;
embedModel: CohereEmbedModel;
maxTokens: number;
temperature: number;
topK: number;
topP: number;
frequencyPenalty?: number;
presencePenalty?: number;
stopSequences?: string[];
endSequences?: string[];
returnLikelihoods?: CohereReturnLikelihoods;
logitBias?: Map<string, number>;
truncate?: string;
};
export type CohereChatRequest = {
message: string;
preamble?: string;
chat_history: { role: 'CHATBOT' | 'SYSTEM' | 'USER'; message: string }[];
model: CohereModel | string;
max_tokens: number;
temperature: number;
k: number;
p: number;
frequency_penalty?: number;
presence_penalty?: number;
end_sequences?: readonly string[];
stop_sequences?: string[];
return_likelihoods?: CohereReturnLikelihoods;
logit_bias?: Map<string, number>;
tools?: {
name: string;
description: string;
parameter_definitions: Record<
string,
{
description: string;
type: string;
required: boolean;
}
>;
}[];
tool_results?: {
call: {
name: string;
parameters: object;
};
outputs: object[];
}[];
};
export type CohereChatResponse = {
generation_id: string;
text: string;
finish_reason:
| 'COMPLETE'
| 'ERROR'
| 'ERROR_TOXIC'
| 'ERROR_LIMIT'
| 'USER_CANCEL'
| 'MAX_TOKENS';
tool_calls: {
name: string;
parameters: object;
}[];
};
export type CohereEmbedRequest = {
texts: readonly string[];
model: CohereModel | string;
truncate: string;
};
export type CohereEmbedResponse = {
id: string;
texts: string[];
model: string;
embeddings: number[][];
};