cohere-ai / cohere-typescript

The Cohere TypeScript SDK
https://docs.cohere.ai
MIT License
127 stars 18 forks source link

cohere node failed with eur character #25

Closed sangdth closed 2 years ago

sangdth commented 2 years ago

If the prompt text contains character, it will throw error:

Response:  { message: 'invalid json syntax' }
(node:61) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of undefined
    at /sandbox/index.js:20:57
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:61) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

Link to reproduce: https://codesandbox.io/s/reproduce-cohere-problem-fyuviv?file=/index.js

Character $ works fine.

Update: Look like pound character £ also failed.

kravse commented 2 years ago

Thanks for reporting this @sangdth. There was a bug with how we were encoding requests that should be fixed now in v. 3.0.2. Let me know if you have any further trouble.

sangdth commented 2 years ago

Thanks for the quick update. I can confirm it works with € and £ now.