Skip to content

Commit 17f8146

Browse files
author
Dylan Huang
committed
handle optional messages
1 parent c76b606 commit 17f8146

3 files changed

Lines changed: 106 additions & 1 deletion

File tree

tests/remote_server/remote_server.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ def _worker():
3030
try:
3131
metadata = {"langfuse_tags": create_langfuse_config_tags(req)}
3232

33+
if not req.messages:
34+
raise ValueError("messages is required")
35+
3336
completion_kwargs = {
3437
"model": req.model,
3538
"messages": req.messages,

typescript/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const metadataSchema = z
4141

4242
export const initRequestSchema = z.object({
4343
model: z.string(),
44-
messages: z.array(messageSchema).min(1),
44+
messages: z.array(messageSchema).optional(),
4545
tools: z.array(toolSchema).optional().nullable(),
4646
metadata: metadataSchema,
4747
model_base_url: z.string().optional().nullable(),
@@ -80,6 +80,10 @@ export function initRequestToCompletionParams(
8080
},
8181
}));
8282

83+
if (!initRequest.messages) {
84+
throw new Error("messages is required");
85+
}
86+
8387
const completionParams = toolsToOpenAI
8488
? {
8589
model: initRequest.model,

typescript/pnpm-lock.yaml

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

0 commit comments

Comments
 (0)