-
Notifications
You must be signed in to change notification settings - Fork 40
FEATURE: Add support for Mistral models #919
Conversation
| module DiscourseAi | ||
| module Completions | ||
| module Endpoints | ||
| class Mistral < OpenAi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the provider_id be overridden? As-is, this currently returns the one for OpenAi.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh sure ... good catch will fix
tyb-talks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor question on provider_id for the endpoint, but otherwise looks ok.
tyb-talks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just spotted something I missed earlier in the OpenAi endpoint:
def prepare_payload(prompt, model_params, dialect)
payload = default_options.merge(model_params).merge(messages: prompt)
if @streaming_mode
payload[:stream] = true
# Usage is not available in Azure yet.
# We'll fallback to guess this using the tokenizer.
payload[:stream_options] = { include_usage: true } if llm_model.provider == "open_ai"
end
tyb-talks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😅 actually it's fine, it just omits those params if it's not from OpenAi. 🤔 If the logic in the inherited endpoint changes more specifically for OpenAi though, it would also affect this Mistral endpoint. Still fine for now.
|
Yeah this is safe by "side effect" cause mistral just sends this info anyway. |
|
thanks for the review @tyb-talks 🤗 |
Adds support for mistral models (pixtral and mistral large now have presets)
Also corrects token accounting in AWS bedrock models