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

add chatcompletion stream delta refusal and logprobs #882

Merged
merged 6 commits into from
Oct 29, 2024

Conversation

Yu0u
Copy link
Contributor

@Yu0u Yu0u commented Oct 17, 2024

Describe the change
Like #844, In ChatCompletionStream.delta the refusal and logprobs field is missing

Provide OpenAI documentation link
Provide a relevant API doc from https://platform.openai.com/docs/api-reference

Describe your solution
Add Refusal and Logprobs Fields

Tests
n/a

Additional context
n/a

Copy link

codecov bot commented Oct 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.85%. Comparing base (774fc9d) to head (52cdd83).
Report is 66 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #882      +/-   ##
==========================================
+ Coverage   98.46%   98.85%   +0.39%     
==========================================
  Files          24       26       +2     
  Lines        1364     1749     +385     
==========================================
+ Hits         1343     1729     +386     
+ Misses         15       14       -1     
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

chat_stream.go Outdated Show resolved Hide resolved
chat_stream.go Outdated
ContentFilterResults ContentFilterResults `json:"content_filter_results,omitempty"`
Index int `json:"index"`
Delta ChatCompletionStreamChoiceDelta `json:"delta"`
Logprobs ChatCompletionStreamChoiceLogprobs `json:"logprobs,omitempty"`
Copy link
Owner

Choose a reason for hiding this comment

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

Sorry, one more quirk here: it's an object or null, so this should be a pointer probably

Suggested change
Logprobs ChatCompletionStreamChoiceLogprobs `json:"logprobs,omitempty"`
Logprobs *ChatCompletionStreamChoiceLogprobs `json:"logprobs,omitempty"`

Copy link
Contributor Author

@Yu0u Yu0u Oct 29, 2024

Choose a reason for hiding this comment

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

Ok, I modified it here. @sashabaranov

Copy link
Owner

@sashabaranov sashabaranov left a comment

Choose a reason for hiding this comment

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

Thank you!

@sashabaranov sashabaranov merged commit d10f1b8 into sashabaranov:master Oct 29, 2024
1 check passed
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