diff --git a/eval_protocol/types/remote_rollout_processor.py b/eval_protocol/types/remote_rollout_processor.py index 89967729..21a821e0 100644 --- a/eval_protocol/types/remote_rollout_processor.py +++ b/eval_protocol/types/remote_rollout_processor.py @@ -21,7 +21,7 @@ class InitRequest(BaseModel): """Request model for POST /init endpoint.""" model: str - messages: List[Message] = Field(min_length=1) + messages: Optional[List[Message]] = None tools: Optional[List[Dict[str, Any]]] = None model_base_url: Optional[str] = None diff --git a/tests/remote_server/remote_server.py b/tests/remote_server/remote_server.py index ea831f51..ba2df50a 100644 --- a/tests/remote_server/remote_server.py +++ b/tests/remote_server/remote_server.py @@ -30,6 +30,9 @@ def _worker(): try: metadata = {"langfuse_tags": create_langfuse_config_tags(req)} + if not req.messages: + raise ValueError("messages is required") + completion_kwargs = { "model": req.model, "messages": req.messages, diff --git a/typescript/index.ts b/typescript/index.ts index 59f7a8af..d15fd97c 100644 --- a/typescript/index.ts +++ b/typescript/index.ts @@ -41,7 +41,7 @@ const metadataSchema = z export const initRequestSchema = z.object({ model: z.string(), - messages: z.array(messageSchema).min(1), + messages: z.array(messageSchema).optional(), tools: z.array(toolSchema).optional().nullable(), metadata: metadataSchema, model_base_url: z.string().optional().nullable(), @@ -80,6 +80,10 @@ export function initRequestToCompletionParams( }, })); + if (!initRequest.messages) { + throw new Error("messages is required"); + } + const completionParams = toolsToOpenAI ? { model: initRequest.model, diff --git a/typescript/package.json b/typescript/package.json index f39bd1ef..8fed21df 100644 --- a/typescript/package.json +++ b/typescript/package.json @@ -2,7 +2,7 @@ "name": "eval-protocol", "module": "index.ts", "type": "module", - "version": "0.1.3", + "version": "0.1.4", "devDependencies": { "@types/bun": "latest", "openai": "^5.23.0" diff --git a/typescript/pnpm-lock.yaml b/typescript/pnpm-lock.yaml new file mode 100644 index 00000000..fde6dccf --- /dev/null +++ b/typescript/pnpm-lock.yaml @@ -0,0 +1,98 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + typescript: + specifier: ^5 + version: 5.9.2 + zod: + specifier: ^4.1.11 + version: 4.1.11 + devDependencies: + '@types/bun': + specifier: latest + version: 1.2.22(@types/react@19.1.14) + openai: + specifier: ^5.23.0 + version: 5.23.1(zod@4.1.11) + +packages: + + '@types/bun@1.2.22': + resolution: {integrity: sha512-5A/KrKos2ZcN0c6ljRSOa1fYIyCKhZfIVYeuyb4snnvomnpFqC0tTsEkdqNxbAgExV384OETQ//WAjl3XbYqQA==} + + '@types/node@24.5.2': + resolution: {integrity: sha512-FYxk1I7wPv3K2XBaoyH2cTnocQEu8AOZ60hPbsyukMPLv5/5qr7V1i8PLHdl6Zf87I+xZXFvPCXYjiTFq+YSDQ==} + + '@types/react@19.1.14': + resolution: {integrity: sha512-ukd93VGzaNPMAUPy0gRDSC57UuQbnH9Kussp7HBjM06YFi9uZTFhOvMSO2OKqXm1rSgzOE+pVx1k1PYHGwlc8Q==} + + bun-types@1.2.22: + resolution: {integrity: sha512-hwaAu8tct/Zn6Zft4U9BsZcXkYomzpHJX28ofvx7k0Zz2HNz54n1n+tDgxoWFGB4PcFvJXJQloPhaV2eP3Q6EA==} + peerDependencies: + '@types/react': ^19 + + csstype@3.1.3: + resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} + + openai@5.23.1: + resolution: {integrity: sha512-APxMtm5mln4jhKhAr0d5zP9lNsClx4QwJtg8RUvYSSyxYCTHLNJnLEcSHbJ6t0ori8Pbr9HZGfcPJ7LEy73rvQ==} + hasBin: true + peerDependencies: + ws: ^8.18.0 + zod: ^3.23.8 + peerDependenciesMeta: + ws: + optional: true + zod: + optional: true + + typescript@5.9.2: + resolution: {integrity: sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==} + engines: {node: '>=14.17'} + hasBin: true + + undici-types@7.12.0: + resolution: {integrity: sha512-goOacqME2GYyOZZfb5Lgtu+1IDmAlAEu5xnD3+xTzS10hT0vzpf0SPjkXwAw9Jm+4n/mQGDP3LO8CPbYROeBfQ==} + + zod@4.1.11: + resolution: {integrity: sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg==} + +snapshots: + + '@types/bun@1.2.22(@types/react@19.1.14)': + dependencies: + bun-types: 1.2.22(@types/react@19.1.14) + transitivePeerDependencies: + - '@types/react' + + '@types/node@24.5.2': + dependencies: + undici-types: 7.12.0 + + '@types/react@19.1.14': + dependencies: + csstype: 3.1.3 + + bun-types@1.2.22(@types/react@19.1.14): + dependencies: + '@types/node': 24.5.2 + '@types/react': 19.1.14 + + csstype@3.1.3: {} + + openai@5.23.1(zod@4.1.11): + optionalDependencies: + zod: 4.1.11 + + typescript@5.9.2: {} + + undici-types@7.12.0: {} + + zod@4.1.11: {}