Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zod validation errors when using streaming with functions/tools #13

Closed
jpaquim opened this issue Aug 13, 2024 · 3 comments · Fixed by #16
Closed

Zod validation errors when using streaming with functions/tools #13

jpaquim opened this issue Aug 13, 2024 · 3 comments · Fixed by #16

Comments

@jpaquim
Copy link

jpaquim commented Aug 13, 2024

Started getting this error after the upgrade (after fixing any breaking changes I could identify):

ZodError: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "null",
    "path": [
      "data",
      "choices",
      0,
      "delta",
      "content"
    ],
    "message": "Expected string, received null"
  },
  {
    "code": "invalid_literal",
    "expected": "function",
    "path": [
      "data",
      "choices",
      0,
      "delta",
      "tool_calls",
      0,
      "type"
    ],
    "message": "Invalid literal value, expected \"function\""
  }
]
    at get error [as error] (<dir>/node_modules/.pnpm/[email protected]/node_modules/zod/lib/types.js:55:31)
    at ZodObject.parse (<dir>/node_modules/.pnpm/[email protected]/node_modules/zod/lib/types.js:160:22)
    at decoder (<dir>/node_modules/.pnpm/@[email protected][email protected]/node_modules/@mistralai/mistralai/funcs/chatStream.js:96:31)
    at parseEvent (<dir>/node_modules/.pnpm/@[email protected][email protected]/node_modules/@mistralai/mistralai/lib/event-streams.js:149:12)
    at [Symbol.asyncIterator] (<dir>/node_modules/.pnpm/@[email protected][email protected]/node_modules/@mistralai/mistralai/lib/event-streams.js:42:35)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.start (<dir>/src/lib/server/streams.ts:13:28)
@GaspardBT
Copy link
Collaborator

GaspardBT commented Aug 16, 2024

Thank you for testing and reporting this issue.
This PR #15 will address the issue "message": "Invalid literal value, expected \"function\"", the other one will be address by #16

@jpaquim
Copy link
Author

jpaquim commented Aug 20, 2024

Thank you @GaspardBT 👍 do you happen to have an estimate for when these changes will be published to npm?

@GaspardBT
Copy link
Collaborator

GaspardBT commented Aug 20, 2024

It will be once this PR is merged 👍 (soon hopefully)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants