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

Update openai-fetch and handle refusal responses #51

Closed
wants to merge 3 commits into from

Conversation

rileytomasek
Copy link
Contributor

@rileytomasek rileytomasek commented Oct 13, 2024

  • Add build step before typecheck in CI workflow
  • Catch tokenizer error without console output
  • Update openai-fetch to 3.3.1 and handle refusals

This allows us to keep the message types stricter and avoid having to continually check for refusals by parsing all responses from the API and throwing a RefusalError if the model sends a message with a refusal.

This commit updates the `openai-fetch` dependency to version 3.3.1.
It also introduces handling for message refusals by throwing a
`RefusalError` when a refusal is returned. This includes changes in
`chat.ts`, test enhancements, and updates to message types and checks.
Copy link

vercel bot commented Oct 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dexter ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 13, 2024 3:59pm

Copy link
Collaborator

@transitive-bullshit transitive-bullshit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like not having to deal with optional content everywhere downstream and throwing a refusal error.

@rileytomasek
Copy link
Contributor Author

haha you just beat me @transitive-bullshit. i opened #52, which does a whole bunch more than just this, but i decided to not throw errors and instead export a convenient guard function. it felt like too much of a slippery slope throwing because it means that the Msg type no longer has parity with openai's chat message.

@rileytomasek rileytomasek deleted the upgrade-openai-fetch branch November 11, 2024 17:06
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 this pull request may close these issues.

2 participants