FIX: include_usage is not available in the Azure API. (#648)

Follow-up #618
This commit is contained in:
Roman Rizzi 2024-05-28 16:55:43 -03:00 committed by GitHub
parent b487de933d
commit bd1490a536
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -107,7 +107,10 @@ module DiscourseAi
if @streaming_mode
payload[:stream] = true
payload[:stream_options] = { include_usage: true }
# Usage is not available in Azure yet.
# We'll fallback to guess this using the tokenizer.
payload[:stream_options] = { include_usage: true } if model_uri.host.exclude?("azure")
end
payload[:tools] = dialect.tools if dialect.tools.present?