feat: add plugins and providers support #70
pr-validation.yaml
on: pull_request
validate
/
validate
45s
Annotations
7 errors
|
validate / validate
Process completed with exit code 1.
|
|
tests/e2e/chat.test.ts > Chat E2E Tests > chat.send() - Streaming > should include finish_reason in final chunk:
src/models/operations/sendchatcompletionrequest.ts#L27
ZodError: [
{
"expected": "array",
"code": "invalid_type",
"path": [
"data",
"choices",
0,
"finish_reason"
],
"message": "Invalid input: expected array, received null"
}
]
❯ src/models/operations/sendchatcompletionrequest.ts:27:66
❯ parseMessage src/lib/event-streams.ts:132:10
❯ Object.pull src/lib/event-streams.ts:31:26
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { _zod: { traits: { constructor: 'Function<Set>', has: 'Function<has>', add: 'Function<add>', delete: 'Function<delete>', clear: 'Function<clear>', entries: 'Function<entries>', forEach: 'Function<forEach>', size: 2, values: 'Function<values>', keys: 'Function<values>', union: 'Function<union>', intersection: 'Function<intersection>', difference: 'Function<difference>', symmetricDifference: 'Function<symmetricDifference>', isSubsetOf: 'Function<isSubsetOf>', isSupersetOf: 'Function<isSupersetOf>', isDisjointFrom: 'Function<isDisjointFrom>' }, constr: 'Function<ZodError>', def: [ { expected: 'array', code: 'invalid_type', path: [ 'data', 'choices', +0, 'finish_reason' ], message: 'Invalid input: expected array, received null' } ], deferred: [] }, issues: [ { expected: 'array', code: 'invalid_type', path: [ 'data', 'choices', +0, 'finish_reason' ], message: 'Invalid input: expected array, received null' } ], format: 'Function<value>', flatten: 'Function<value>', addIssue: 'Function<value>', addIssues: 'Function<value>', isEmpty: false }
|
|
tests/e2e/chat.test.ts > Chat E2E Tests > chat.send() - Streaming > should stream complete content progressively:
src/models/operations/sendchatcompletionrequest.ts#L27
ZodError: [
{
"expected": "array",
"code": "invalid_type",
"path": [
"data",
"choices",
0,
"finish_reason"
],
"message": "Invalid input: expected array, received null"
}
]
❯ src/models/operations/sendchatcompletionrequest.ts:27:66
❯ parseMessage src/lib/event-streams.ts:132:10
❯ Object.pull src/lib/event-streams.ts:31:26
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { _zod: { traits: { constructor: 'Function<Set>', has: 'Function<has>', add: 'Function<add>', delete: 'Function<delete>', clear: 'Function<clear>', entries: 'Function<entries>', forEach: 'Function<forEach>', size: 2, values: 'Function<values>', keys: 'Function<values>', union: 'Function<union>', intersection: 'Function<intersection>', difference: 'Function<difference>', symmetricDifference: 'Function<symmetricDifference>', isSubsetOf: 'Function<isSubsetOf>', isSupersetOf: 'Function<isSupersetOf>', isDisjointFrom: 'Function<isDisjointFrom>' }, constr: 'Function<ZodError>', def: [ { expected: 'array', code: 'invalid_type', path: [ 'data', 'choices', +0, 'finish_reason' ], message: 'Invalid input: expected array, received null' } ], deferred: [] }, issues: [ { expected: 'array', code: 'invalid_type', path: [ 'data', 'choices', +0, 'finish_reason' ], message: 'Invalid input: expected array, received null' } ], format: 'Function<value>', flatten: 'Function<value>', addIssue: 'Function<value>', addIssues: 'Function<value>', isEmpty: false }
|
|
tests/e2e/chat.test.ts > Chat E2E Tests > chat.send() - Streaming > should successfully stream chat responses:
src/models/operations/sendchatcompletionrequest.ts#L27
ZodError: [
{
"expected": "array",
"code": "invalid_type",
"path": [
"data",
"choices",
0,
"finish_reason"
],
"message": "Invalid input: expected array, received null"
}
]
❯ src/models/operations/sendchatcompletionrequest.ts:27:66
❯ parseMessage src/lib/event-streams.ts:132:10
❯ Object.pull src/lib/event-streams.ts:31:26
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { _zod: { traits: { constructor: 'Function<Set>', has: 'Function<has>', add: 'Function<add>', delete: 'Function<delete>', clear: 'Function<clear>', entries: 'Function<entries>', forEach: 'Function<forEach>', size: 2, values: 'Function<values>', keys: 'Function<values>', union: 'Function<union>', intersection: 'Function<intersection>', difference: 'Function<difference>', symmetricDifference: 'Function<symmetricDifference>', isSubsetOf: 'Function<isSubsetOf>', isSupersetOf: 'Function<isSupersetOf>', isDisjointFrom: 'Function<isDisjointFrom>' }, constr: 'Function<ZodError>', def: [ { expected: 'array', code: 'invalid_type', path: [ 'data', 'choices', +0, 'finish_reason' ], message: 'Invalid input: expected array, received null' } ], deferred: [] }, issues: [ { expected: 'array', code: 'invalid_type', path: [ 'data', 'choices', +0, 'finish_reason' ], message: 'Invalid input: expected array, received null' } ], format: 'Function<value>', flatten: 'Function<value>', addIssue: 'Function<value>', addIssues: 'Function<value>', isEmpty: false }
|
|
tests/e2e/chat.test.ts > Chat E2E Tests > chat.send() - Non-streaming > should respect max_tokens parameter:
src/lib/matchers.ts#L344
ResponseValidationError: Response validation failed
❯ safeParseResponse src/lib/matchers.ts:344:7
❯ matchFunc src/lib/matchers.ts:307:9
❯ $do src/funcs/chatSend.ts:203:20
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { statusCode: 200, body: '{"id":"gen-1763491016-qwWCq3RFFtQElDgNtoAs","provider":"Cloudflare","model":"meta-llama/llama-3.2-1b-instruct","object":"chat.completion","created":1763491016,"choices":[{"logprobs":null,"finish_reason":"stop","native_finish_reason":"stop","index":0,"message":{"role":"assistant","content":"Once upon a time, in a small village nestled","refusal":null,"reasoning":null}}],"usage":{"prompt_tokens":19,"completion_tokens":10,"total_tokens":29}}', headers: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, contentType: 'application/json', rawResponse: { constructor: 'Function<Response>', type: 'basic', url: 'https://openrouter.ai/api/v1/chat/completions', redirected: false, status: 200, ok: true, statusText: 'OK', headers: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, body: { constructor: 'Function<ReadableStream>', locked: true, cancel: 'Function<cancel>', getReader: 'Function<getReader>', pipeThrough: 'Function<pipeThrough>', pipeTo: 'Function<pipeTo>', tee: 'Function<tee>', values: 'Function<values>' }, bodyUsed: true, clone: 'Function<clone>', blob: 'Function<blob>', arrayBuffer: 'Function<arrayBuffer>', text: 'Function<text>', json: 'Function<json>', formData: 'Function<formData>', bytes: 'Function<bytes>' }, rawValue: { id: 'gen-1763491016-qwWCq3RFFtQElDgNtoAs', provider: 'Cloudflare', model: 'meta-llama/llama-3.2-1b-instruct', object: 'chat.completion', created: 1763491016, choices: [ { logprobs: null, finish_reason: 'stop', native_finish_reason: 'stop', index: +0, message: { role: 'assistant', content: 'Once upon a time, in a small village nestled', refusal: null, reasoning: null } } ], usage: { prompt_tokens: 19, completion_tokens: 10, total_tokens: 29 } }, rawMessage: 'Response validation failed', pretty: 'Function<pretty>' }
Caused by: ZodError: [
{
"code": "invalid_union",
"errors": [
[
{
"expected": "array",
"code": "invalid_type",
"path": [
"choices",
0,
"finish_reason"
],
"message": "Invalid input: expected array, received string"
}
],
[
{
"code": "custom",
"path": [],
"message": "Invalid input"
}
]
],
"path": [],
"message": "Invalid input"
}
]
❯ safeParseResponse.request.request src/lib/matchers.ts:309:42
❯ safeParseResponse src/lib/matchers.ts:341:15
❯ matchFunc src/lib/matchers.ts:307:9
❯ $do src/funcs/chatSend.ts:203:20
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { _zod: { traits: { constructor: 'Function<Set>', has: 'Function<has>', add: 'Function<add>', delete: 'Function<delete>', clear: 'Function<clear>', entries: 'Function<entries>', forEach: 'Function<forEach>', size: 2, values: 'Function<values>', keys: 'Function<values>', union: 'Function<union>', intersection: 'Function<intersection>', difference: 'Function<difference>', symmetricDifference: 'Function<symmetricDifference>', isSubsetOf: 'Function<isSubsetOf>', isSupersetOf: 'Function<isSupersetOf>', isDisjointFrom: 'Function<isDisjointFrom>' }, constr: 'Function<ZodError>', def: [ { code: 'invalid_union', errors: [ [ { expected: 'array', code: 'invalid_type', path: [ 'choices', +0, 'finish_reason' ], message: 'Invalid input: expected array, received string' } ], [ { code: 'custom', path:
|
|
tests/e2e/chat.test.ts > Chat E2E Tests > chat.send() - Non-streaming > should handle multi-turn conversations:
src/lib/matchers.ts#L344
ResponseValidationError: Response validation failed
❯ safeParseResponse src/lib/matchers.ts:344:7
❯ matchFunc src/lib/matchers.ts:307:9
❯ $do src/funcs/chatSend.ts:203:20
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { statusCode: 200, body: '{"id":"gen-1763491015-x0uMl2yaMV801uSY7iMM","provider":"Cloudflare","model":"meta-llama/llama-3.2-1b-instruct","object":"chat.completion","created":1763491015,"choices":[{"logprobs":null,"finish_reason":"stop","native_finish_reason":"stop","index":0,"message":{"role":"assistant","content":"I remember! Your name is Alice.","refusal":null,"reasoning":null}}],"usage":{"prompt_tokens":41,"completion_tokens":9,"total_tokens":50}}', headers: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, contentType: 'application/json', rawResponse: { constructor: 'Function<Response>', type: 'basic', url: 'https://openrouter.ai/api/v1/chat/completions', redirected: false, status: 200, ok: true, statusText: 'OK', headers: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, body: { constructor: 'Function<ReadableStream>', locked: true, cancel: 'Function<cancel>', getReader: 'Function<getReader>', pipeThrough: 'Function<pipeThrough>', pipeTo: 'Function<pipeTo>', tee: 'Function<tee>', values: 'Function<values>' }, bodyUsed: true, clone: 'Function<clone>', blob: 'Function<blob>', arrayBuffer: 'Function<arrayBuffer>', text: 'Function<text>', json: 'Function<json>', formData: 'Function<formData>', bytes: 'Function<bytes>' }, rawValue: { id: 'gen-1763491015-x0uMl2yaMV801uSY7iMM', provider: 'Cloudflare', model: 'meta-llama/llama-3.2-1b-instruct', object: 'chat.completion', created: 1763491015, choices: [ { logprobs: null, finish_reason: 'stop', native_finish_reason: 'stop', index: +0, message: { role: 'assistant', content: 'I remember! Your name is Alice.', refusal: null, reasoning: null } } ], usage: { prompt_tokens: 41, completion_tokens: 9, total_tokens: 50 } }, rawMessage: 'Response validation failed', pretty: 'Function<pretty>' }
Caused by: ZodError: [
{
"code": "invalid_union",
"errors": [
[
{
"expected": "array",
"code": "invalid_type",
"path": [
"choices",
0,
"finish_reason"
],
"message": "Invalid input: expected array, received string"
}
],
[
{
"code": "custom",
"path": [],
"message": "Invalid input"
}
]
],
"path": [],
"message": "Invalid input"
}
]
❯ safeParseResponse.request.request src/lib/matchers.ts:309:42
❯ safeParseResponse src/lib/matchers.ts:341:15
❯ matchFunc src/lib/matchers.ts:307:9
❯ $do src/funcs/chatSend.ts:203:20
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { _zod: { traits: { constructor: 'Function<Set>', has: 'Function<has>', add: 'Function<add>', delete: 'Function<delete>', clear: 'Function<clear>', entries: 'Function<entries>', forEach: 'Function<forEach>', size: 2, values: 'Function<values>', keys: 'Function<values>', union: 'Function<union>', intersection: 'Function<intersection>', difference: 'Function<difference>', symmetricDifference: 'Function<symmetricDifference>', isSubsetOf: 'Function<isSubsetOf>', isSupersetOf: 'Function<isSupersetOf>', isDisjointFrom: 'Function<isDisjointFrom>' }, constr: 'Function<ZodError>', def: [ { code: 'invalid_union', errors: [ [ { expected: 'array', code: 'invalid_type', path: [ 'choices', +0, 'finish_reason' ], message: 'Invalid input: expected array, received string' } ], [ { code: 'custom', path: [], message: 'Invalid input'
|
|
tests/e2e/chat.test.ts > Chat E2E Tests > chat.send() - Non-streaming > should successfully send a chat request and get a response:
src/lib/matchers.ts#L344
ResponseValidationError: Response validation failed
❯ safeParseResponse src/lib/matchers.ts:344:7
❯ matchFunc src/lib/matchers.ts:307:9
❯ $do src/funcs/chatSend.ts:203:20
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { statusCode: 200, body: '{"id":"gen-1763491015-NNb5EwaniGB1Djm7JU2M","provider":"Cloudflare","model":"meta-llama/llama-3.2-1b-instruct","object":"chat.completion","created":1763491015,"choices":[{"logprobs":null,"finish_reason":"stop","native_finish_reason":"stop","index":0,"message":{"role":"assistant","content":"Hello, World!","refusal":null,"reasoning":null}}],"usage":{"prompt_tokens":21,"completion_tokens":5,"total_tokens":26}}', headers: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, contentType: 'application/json', rawResponse: { constructor: 'Function<Response>', type: 'basic', url: 'https://openrouter.ai/api/v1/chat/completions', redirected: false, status: 200, ok: true, statusText: 'OK', headers: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, body: { constructor: 'Function<ReadableStream>', locked: true, cancel: 'Function<cancel>', getReader: 'Function<getReader>', pipeThrough: 'Function<pipeThrough>', pipeTo: 'Function<pipeTo>', tee: 'Function<tee>', values: 'Function<values>' }, bodyUsed: true, clone: 'Function<clone>', blob: 'Function<blob>', arrayBuffer: 'Function<arrayBuffer>', text: 'Function<text>', json: 'Function<json>', formData: 'Function<formData>', bytes: 'Function<bytes>' }, rawValue: { id: 'gen-1763491015-NNb5EwaniGB1Djm7JU2M', provider: 'Cloudflare', model: 'meta-llama/llama-3.2-1b-instruct', object: 'chat.completion', created: 1763491015, choices: [ { logprobs: null, finish_reason: 'stop', native_finish_reason: 'stop', index: +0, message: { role: 'assistant', content: 'Hello, World!', refusal: null, reasoning: null } } ], usage: { prompt_tokens: 21, completion_tokens: 5, total_tokens: 26 } }, rawMessage: 'Response validation failed', pretty: 'Function<pretty>' }
Caused by: Caused by: ZodError: [
{
"code": "invalid_union",
"errors": [
[
{
"expected": "array",
"code": "invalid_type",
"path": [
"choices",
0,
"finish_reason"
],
"message": "Invalid input: expected array, received string"
}
],
[
{
"code": "custom",
"path": [],
"message": "Invalid input"
}
]
],
"path": [],
"message": "Invalid input"
}
]
❯ safeParseResponse.request.request src/lib/matchers.ts:309:42
❯ safeParseResponse src/lib/matchers.ts:341:15
❯ matchFunc src/lib/matchers.ts:307:9
❯ $do src/funcs/chatSend.ts:203:20
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { _zod: { traits: { constructor: 'Function<Set>', has: 'Function<has>', add: 'Function<add>', delete: 'Function<delete>', clear: 'Function<clear>', entries: 'Function<entries>', forEach: 'Function<forEach>', size: 2, values: 'Function<values>', keys: 'Function<values>', union: 'Function<union>', intersection: 'Function<intersection>', difference: 'Function<difference>', symmetricDifference: 'Function<symmetricDifference>', isSubsetOf: 'Function<isSubsetOf>', isSupersetOf: 'Function<isSupersetOf>', isDisjointFrom: 'Function<isDisjointFrom>' }, constr: 'Function<ZodError>', def: [ { code: 'invalid_union', errors: [ [ { expected: 'array', code: 'invalid_type', path: [ 'choices', +0, 'finish_reason' ], message: 'Invalid input: expected array, received string' } ], [ { code: 'custom', path: [], message: 'Invalid input' } ] ], path: [], message
|