-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.ts
134 lines (110 loc) · 2.89 KB
/
config.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/** Continue config */
/** Fetch Secrets */
// @ts-ignore - can't find type definitions here
import { execSync } from "child_process";
const runShellCommand = (command: string): string => {
try {
return execSync(command, { encoding: "utf8" }).trim();
} catch (error) {
console.error("Error:", error);
return "";
}
};
const siliconFlowKey = runShellCommand(
"op read op://dev/silicon-flow/continue"
);
const voyageKey = runShellCommand("op read 'op://dev/voyage-ai/credential'");
const anthropicKey = runShellCommand("op read 'op://dev/anthropic/continue'");
/** Model Definitions */
const promptCode =
"You are an expert software developer. You give helpful and concise responses.";
const promptChat = "You are a helpful assistant.";
/** Chat Models */
const SiliconFlow: Partial<ModelDescription> & { provider: string } = {
provider: "siliconflow",
apiKey: siliconFlowKey,
};
const DSV3: ModelDescription = {
...SiliconFlow,
title: "DeepSeek V3",
model: "deepseek-ai/DeepSeek-V3",
systemMessage: promptCode,
};
const DSV3Pro: ModelDescription = {
...SiliconFlow,
title: "DeepSeek V3 - Pro",
model: "Pro/deepseek-ai/DeepSeek-V3",
systemMessage: promptCode,
};
const DSV3Chat: ModelDescription = {
...DSV3,
title: "DeepSeek V3 - Chat",
systemMessage: promptChat,
};
const DSR1: ModelDescription = {
...SiliconFlow,
title: "DeepSeek R1",
model: "deepseek-ai/DeepSeek-R1",
systemMessage: promptCode,
};
const DSR1Pro: ModelDescription = {
...SiliconFlow,
title: "DeepSeek R1 - Pro",
model: "Pro/deepseek-ai/DeepSeek-R1",
systemMessage: promptCode,
};
const DSR1Chat: ModelDescription = {
...DSR1,
title: "DeepSeek R1 - Chat",
systemMessage: promptChat,
};
const DSV25: ModelDescription = {
...SiliconFlow,
title: "DeepSeek V2.5",
model: "deepseek-ai/DeepSeek-V2.5",
};
const ClaudeSonnet: ModelDescription = {
title: "Claude 3.5 Sonnet",
provider: "anthropic",
model: "claude-3-5-sonnet-latest",
apiKey: anthropicKey,
systemMessage: promptCode,
cacheBehavior: {
cacheSystemMessage: true,
cacheConversation: true,
},
};
/** Embeddings Provider */
const BGEM3: EmbeddingsProviderDescription = {
...SiliconFlow,
model: "BAAI/bge-m3",
};
const VoyageCode3: EmbeddingsProviderDescription = {
provider: "voyage",
model: "voyage-code-3",
apiKey: voyageKey,
};
/** Reranker */
const BGERerankerV2M3: RerankerDescription = {
name: "bge",
params: {
model: "BAAI/reranker-v2-m3",
apiKey: siliconFlowKey,
},
};
const VoyageRerank2: RerankerDescription = {
name: "voyage",
params: {
model: "rerank-2",
apiKey: voyageKey,
},
};
export function modifyConfig(config: Config): Config {
[DSV3, DSR1, ClaudeSonnet, DSV3Chat, DSR1Chat].forEach((model) =>
config.models.push(model)
);
config.tabAutocompleteModel = DSV25;
config.embeddingsProvider = BGEM3;
config.reranker = VoyageRerank2;
return config;
}