FIX: Don't echo prompt back on HF/TGI (#338)
* FIX: Don't echo prompt back on HF/TGI * teeeeests
This commit is contained in:
parent
d8267d8da0
commit
252efdf142
|
@ -33,6 +33,7 @@ module DiscourseAi
|
|||
token_limit = SiteSetting.ai_hugging_face_token_limit || 4_000
|
||||
|
||||
payload[:parameters][:max_new_tokens] = token_limit - prompt_size(prompt)
|
||||
payload[:parameters][:return_full_text] = false
|
||||
|
||||
payload[:stream] = true if @streaming_mode
|
||||
end
|
||||
|
|
|
@ -40,6 +40,7 @@ module ::DiscourseAi
|
|||
parameters[:max_new_tokens] = token_limit - prompt_size
|
||||
parameters[:temperature] = temperature if temperature
|
||||
parameters[:repetition_penalty] = repetition_penalty if repetition_penalty
|
||||
parameters[:return_full_text] = false
|
||||
|
||||
payload[:stream] = true if block_given?
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ RSpec.describe DiscourseAi::Completions::Endpoints::HuggingFace do
|
|||
.tap do |payload|
|
||||
payload[:parameters][:max_new_tokens] = (SiteSetting.ai_hugging_face_token_limit || 4_000) -
|
||||
model.prompt_size(prompt)
|
||||
payload[:parameters][:return_full_text] = false
|
||||
end
|
||||
.to_json
|
||||
end
|
||||
|
@ -29,6 +30,7 @@ RSpec.describe DiscourseAi::Completions::Endpoints::HuggingFace do
|
|||
payload[:parameters][:max_new_tokens] = (SiteSetting.ai_hugging_face_token_limit || 4_000) -
|
||||
model.prompt_size(prompt)
|
||||
payload[:stream] = true
|
||||
payload[:parameters][:return_full_text] = false
|
||||
end
|
||||
.to_json
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue