Skip to content

Commit 177f37a

Browse files
committed
Merge remote-tracking branch 'origin/master' into jupyter-llm-8500
2 parents 4794655 + 84ff159 commit 177f37a

File tree

9 files changed

+308
-219
lines changed

9 files changed

+308
-219
lines changed

src/packages/frontend/frame-editors/latex-editor/build.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export const Build: React.FC<Props> = React.memo((props) => {
143143
// const y: ExecOutput | undefined = job_infos.get(stage)?.toJS();
144144

145145
if (!x) return;
146-
const value = x.stdout ?? "" + x.stderr ?? "";
146+
const value = (x.stdout ?? "") + (x.stderr ?? "");
147147
if (!value) return;
148148
// const time: number | undefined = x.get("time");
149149
// const time_str = time ? `(${(time / 1000).toFixed(1)} seconds)` : "";
@@ -235,7 +235,7 @@ export const Build: React.FC<Props> = React.memo((props) => {
235235
if (!info || info.type !== "async" || info.status !== "running") return;
236236
const stats_str = getResourceUsage(info.stats, "last");
237237
const start = info.start;
238-
logTail = tail(info.stdout ?? "" + info.stderr ?? "", 6);
238+
logTail = tail((info.stdout ?? "") + (info.stderr ?? ""), 6);
239239
isLongRunning ||=
240240
typeof start === "number" &&
241241
webapp_client.server_time() - start > WARN_LONG_RUNNING_S * 1000;

src/packages/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@
2323
"undici@<5.28.3": "^5.28.4",
2424
"postcss@<8.4.31": "^8.4.31",
2525
"retry-request@<7.0.1": "^7.0.2",
26-
"@langchain/core": "^0.3.46",
27-
"langchain": "^0.3.11",
26+
"@langchain/core": "^0.3.68",
27+
"langchain": "^0.3.30",
2828
"katex@<0.16.9": "^0.16.10",
2929
"nanoid@<3.3.8": "^3.3.8",
3030
"[email protected]": "2.1.3",
31-
"[email protected]": "3.0.9"
31+
"[email protected]": "3.0.9",
32+
"@types/[email protected]": "2.48.13",
33+
"@types/[email protected]": "2.6.13",
34+
"[email protected]": "^1.11.0"
3235
},
3336
"onlyBuiltDependencies": [
3437
"websocket-sftp",

src/packages/pnpm-lock.yaml

Lines changed: 62 additions & 158 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/packages/server/llm/index.ts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -398,22 +398,28 @@ export async function evaluateOpenAI({
398398

399399
export function normalizeOpenAIModel(model): OpenAIModel {
400400
// the *-8k variants are artificial – the input is already limited/truncated to 8k
401-
// convert *-preview and all *-8k to "gpt-4-turbo"
402-
if (model.startsWith("gpt-4-turbo")) {
403-
model = "gpt-4-turbo";
404-
} else if (model.startsWith("gpt-4o-mini")) {
405-
model = "gpt-4o-mini";
406-
} else if (model.startsWith("gpt-4o")) {
407-
model = "gpt-4o";
408-
} else if (model.startsWith("o1-mini")) {
409-
model = "o1-mini";
410-
} else if (model.startsWith("o1")) {
411-
model = "o1";
412-
} else if (model.startsWith("gpt-4.1-mini")) {
413-
model = "gpt-4.1-mini";
414-
} else if (model.startsWith("gpt-4.1")) {
415-
model = "gpt-4.1";
401+
// convert *-preview and all *-8k to their base model names
402+
const modelPrefixes = [
403+
"gpt-5-mini",
404+
"gpt-5",
405+
"gpt-4o-mini",
406+
"gpt-4o",
407+
"gpt-4-turbo",
408+
"gpt-4.1-mini",
409+
"gpt-4.1",
410+
"o4-mini",
411+
"o3",
412+
"o1-mini",
413+
"o1",
414+
];
415+
416+
for (const prefix of modelPrefixes) {
417+
if (model.startsWith(prefix)) {
418+
model = prefix;
419+
break;
420+
}
416421
}
422+
417423
if (!isOpenAIModel(model)) {
418424
throw new Error(`Internal problem normalizing OpenAI model name: ${model}`);
419425
}

src/packages/server/llm/test/models.test.ts

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,23 @@ test_llm("openai")("OpenAI", () => {
151151
LLM_TIMEOUT,
152152
);
153153

154-
test("o1", async () => {
155-
await llmOpenAI("o1-8k");
154+
test("o3 works", async () => {
155+
await llmOpenAI("o3-8k");
156156
});
157157

158-
test("o1 mini works", async () => {
159-
await llmOpenAI("o1-mini-8k");
158+
test("o4-mini works", async () => {
159+
await llmOpenAI("o4-mini-8k");
160+
});
161+
162+
test("gpt-5 works", async () => {
163+
await llmOpenAI("gpt-5-8k");
164+
});
165+
166+
test("gpt-5-mini works", async () => {
167+
await llmOpenAI("gpt-5-mini-8k");
160168
});
161169
});
162170

163-
// ATTN: does not work everywhere around, geolocation matters
164171
test_llm("google")("Google GenAI", () => {
165172
test(
166173
"gemini 1.5 pro works",
@@ -200,48 +207,61 @@ test_llm("google")("Google GenAI", () => {
200207
});
201208

202209
test_llm("mistralai")("Mistral AI", () => {
203-
const small: MistralModel = "mistral-small-latest";
204210
const medium: MistralModel = "mistral-medium-latest";
205211
const large: MistralModel = "mistral-large-latest";
212+
const devstral: MistralModel = "devstral-medium-2507";
213+
//const magistral: MistralModel = "magistral-medium-latest";
206214

207215
test("model", () => {
208-
expect(isMistralModel(small)).toBe(true);
209216
expect(isMistralModel(medium)).toBe(true);
210217
expect(isMistralModel(large)).toBe(true);
218+
expect(isMistralModel(devstral)).toBe(true);
219+
//expect(isMistralModel(magistral)).toBe(true);
211220
});
212221

213222
test(
214-
"small",
223+
"medium",
215224
async () => {
216225
const answer = USE_NEWER_LC_IMPL
217-
? await evaluateWithLangChain({ model: small, ...QUERY })
218-
: await evaluateMistral({ model: small, ...QUERY });
226+
? await evaluateWithLangChain({ model: medium, ...QUERY })
227+
: await evaluateMistral({ model: medium, ...QUERY });
219228
checkAnswer(answer);
220229
},
221230
LLM_TIMEOUT,
222231
);
223232

224233
test(
225-
"medium",
234+
"large",
226235
async () => {
227236
const answer = USE_NEWER_LC_IMPL
228-
? await evaluateWithLangChain({ model: medium, ...QUERY })
229-
: await evaluateMistral({ model: medium, ...QUERY });
237+
? await evaluateWithLangChain({ model: large, ...QUERY })
238+
: await evaluateMistral({ model: large, ...QUERY });
230239
checkAnswer(answer);
231240
},
232241
LLM_TIMEOUT,
233242
);
234243

235244
test(
236-
"large",
245+
"devstral",
237246
async () => {
238247
const answer = USE_NEWER_LC_IMPL
239-
? await evaluateWithLangChain({ model: large, ...QUERY })
240-
: await evaluateMistral({ model: large, ...QUERY });
248+
? await evaluateWithLangChain({ model: devstral, ...QUERY })
249+
: await evaluateMistral({ model: devstral, ...QUERY });
241250
checkAnswer(answer);
242251
},
243252
LLM_TIMEOUT,
244253
);
254+
255+
// test(
256+
// "magistral",
257+
// async () => {
258+
// const answer = USE_NEWER_LC_IMPL
259+
// ? await evaluateWithLangChain({ model: magistral, ...QUERY })
260+
// : await evaluateMistral({ model: magistral, ...QUERY });
261+
// checkAnswer(answer);
262+
// },
263+
// LLM_TIMEOUT,
264+
// );
245265
});
246266

247267
test_llm("anthropic")("Anthropic", () => {

src/packages/server/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@
5555
"@google-cloud/storage-transfer": "^3.3.0",
5656
"@google/generative-ai": "^0.14.0",
5757
"@isaacs/ttlcache": "^1.4.1",
58-
"@langchain/anthropic": "^0.3.24",
59-
"@langchain/core": "^0.3.64",
60-
"@langchain/google-genai": "^0.2.15",
58+
"@langchain/anthropic": "^0.3.26",
59+
"@langchain/core": "^0.3.68",
60+
"@langchain/google-genai": "^0.2.16",
6161
"@langchain/mistralai": "^0.2.1",
6262
"@langchain/ollama": "^0.2.3",
63-
"@langchain/openai": "^0.6.1",
63+
"@langchain/openai": "^0.6.6",
6464
"@node-saml/passport-saml": "^5.1.0",
6565
"@passport-js/passport-twitter": "^1.0.8",
6666
"@passport-next/passport-google-oauth2": "^1.0.0",
@@ -97,7 +97,7 @@
9797
"nanoid": "^3.3.8",
9898
"node-zendesk": "^5.0.13",
9999
"nodemailer": "^6.9.16",
100-
"openai": "^4.104.0",
100+
"openai": "^5.12.1",
101101
"parse-domain": "^5.0.0",
102102
"passport": "^0.6.0",
103103
"passport-activedirectory": "^1.0.4",

src/packages/util/db-schema/llm-utils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ describe("llm", () => {
123123
expect(getModel("mistral-large-latest")).toEqual("mistral-large-latest");
124124
expect(getModel("gpt-4")).toEqual("gpt-4");
125125
expect(getModel(DEFAULT_MODEL)).toEqual(DEFAULT_MODEL);
126-
expect(getModel("mistral-medium-latest")).toEqual(DEFAULT_MODEL);
126+
expect(getModel("magistral-medium-latest")).toEqual(DEFAULT_MODEL);
127127
expect(getModel("mistral-large-latest")).toEqual("mistral-large-latest");
128128
expect(getModel("claude-3-5-haiku-8k")).toEqual("claude-3-5-haiku-8k");
129129
// anthropic service disabled

0 commit comments

Comments
 (0)