add chatcompletion stream delta refusal and logprobs (#882)
* add chatcompletion stream refusal and logprobs * fix slice to struct * add integration test * fix lint * fix lint * fix: the object should be pointer --------- Co-authored-by: genglixia <genglixia@enjoypartytime.com>
This commit is contained in:
@@ -10,13 +10,33 @@ type ChatCompletionStreamChoiceDelta struct {
|
||||
Role string `json:"role,omitempty"`
|
||||
FunctionCall *FunctionCall `json:"function_call,omitempty"`
|
||||
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
|
||||
Refusal string `json:"refusal,omitempty"`
|
||||
}
|
||||
|
||||
type ChatCompletionStreamChoiceLogprobs struct {
|
||||
Content []ChatCompletionTokenLogprob `json:"content,omitempty"`
|
||||
Refusal []ChatCompletionTokenLogprob `json:"refusal,omitempty"`
|
||||
}
|
||||
|
||||
type ChatCompletionTokenLogprob struct {
|
||||
Token string `json:"token"`
|
||||
Bytes []int64 `json:"bytes,omitempty"`
|
||||
Logprob float64 `json:"logprob,omitempty"`
|
||||
TopLogprobs []ChatCompletionTokenLogprobTopLogprob `json:"top_logprobs"`
|
||||
}
|
||||
|
||||
type ChatCompletionTokenLogprobTopLogprob struct {
|
||||
Token string `json:"token"`
|
||||
Bytes []int64 `json:"bytes"`
|
||||
Logprob float64 `json:"logprob"`
|
||||
}
|
||||
|
||||
type ChatCompletionStreamChoice struct {
|
||||
Index int `json:"index"`
|
||||
Delta ChatCompletionStreamChoiceDelta `json:"delta"`
|
||||
FinishReason FinishReason `json:"finish_reason"`
|
||||
ContentFilterResults ContentFilterResults `json:"content_filter_results,omitempty"`
|
||||
Index int `json:"index"`
|
||||
Delta ChatCompletionStreamChoiceDelta `json:"delta"`
|
||||
Logprobs *ChatCompletionStreamChoiceLogprobs `json:"logprobs,omitempty"`
|
||||
FinishReason FinishReason `json:"finish_reason"`
|
||||
ContentFilterResults ContentFilterResults `json:"content_filter_results,omitempty"`
|
||||
}
|
||||
|
||||
type PromptFilterResult struct {
|
||||
|
||||
Reference in New Issue
Block a user