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

fix: add beta assistant header to CreateMessage call #566

Conversation

floodfx
Copy link
Contributor

@floodfx floodfx commented Nov 13, 2023

Describe the change
Calling the CreateMessage method currently fails with the following error message: You must provide the 'OpenAI-Beta' header to access the Assistants API. Please try again by setting the header 'OpenAI-Beta: assistants=v1'.

Describe your solution
I've updated the CreateMessage call in messages.go to include the withBetaAssistantV1() request option.

Tests
It was unclear how to update the tests as I didn't see a way to test the header was set. I have tested that the call succeeds in my application now.

Copy link

codecov bot commented Nov 13, 2023

Codecov Report

Merging #566 (42c7fa0) into master (515de02) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #566   +/-   ##
=======================================
  Coverage   98.35%   98.35%           
=======================================
  Files          24       24           
  Lines        1276     1276           
=======================================
  Hits         1255     1255           
  Misses         15       15           
  Partials        6        6           
Files Coverage Δ
messages.go 100.00% <100.00%> (ø)

@urjitbhatia
Copy link
Contributor

Good catch, I probably forgot to add it for that call.

@sashabaranov sashabaranov merged commit fe67abb into sashabaranov:master Nov 15, 2023
3 checks passed
@sashabaranov
Copy link
Owner

Thank you for the PR!

maerlyn5 pushed a commit to prassoai/go-openai that referenced this pull request Nov 22, 2023
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.

3 participants