Skip to content

Commit

Permalink
Merge pull request #1 from lucasjones/master
Browse files Browse the repository at this point in the history
Add logprob support
  • Loading branch information
sashabaranov authored Sep 2, 2020
2 parents eb1cc60 + 5410948 commit 4fb04ab
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,27 @@ type CompletionRequest struct {

N int `json:"n,omitempty"`

LogProbs int `json:"logobs,omitempty"`
LogProbs int `json:"logprobs,omitempty"`

Echo bool `json:"echo,omitempty"`
Stop string `json:"stop,omitempty"`
Echo bool `json:"echo,omitempty"`
Stop []string `json:"stop,omitempty"`

PresencePenalty float32 `json:"presence_penalty,omitempty"`
FrequencyPenalty float32 `json:"frequency_penalty,omitempty"`
}

type Choice struct {
Text string `json:"text"`
Index int `json:"index"`
FinishReason string `json:"finish_reason"`
Text string `json:"text"`
Index int `json:"index"`
FinishReason string `json:"finish_reason"`
LogProbs LogprobResult `json:"logprobs"`
}

type LogprobResult struct {
Tokens []string `json:"tokens"`
TokenLogprobs []float32 `json:"token_logprobs"`
TopLogprobs []map[string]float32 `json:"top_logprobs"`
TextOffset []int `json:"text_offset"`
}

type CompletionResponse struct {
Expand Down

0 comments on commit 4fb04ab

Please sign in to comment.