summaryrefslogtreecommitdiff
path: root/logic
diff options
context:
space:
mode:
Diffstat (limited to 'logic')
-rw-r--r--logic/cartridge/streaming.rb2
-rw-r--r--logic/providers/google/tokens.rb2
-rw-r--r--logic/providers/mistral/tokens.rb14
-rw-r--r--logic/providers/openai/tokens.rb2
4 files changed, 15 insertions, 5 deletions
diff --git a/logic/cartridge/streaming.rb b/logic/cartridge/streaming.rb
index 6949b3a..0b9b19f 100644
--- a/logic/cartridge/streaming.rb
+++ b/logic/cartridge/streaming.rb
@@ -8,7 +8,7 @@ module NanoBot
module Streaming
def self.enabled?(cartridge, interface)
provider_stream = case Helpers::Hash.fetch(cartridge, %i[provider id])
- when 'openai'
+ when 'openai', 'mistral'
Helpers::Hash.fetch(cartridge, %i[provider settings stream])
when 'google'
Helpers::Hash.fetch(cartridge, %i[provider options stream])
diff --git a/logic/providers/google/tokens.rb b/logic/providers/google/tokens.rb
index 3d5492f..0d74928 100644
--- a/logic/providers/google/tokens.rb
+++ b/logic/providers/google/tokens.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require 'openai'
-
module NanoBot
module Logic
module Google
diff --git a/logic/providers/mistral/tokens.rb b/logic/providers/mistral/tokens.rb
new file mode 100644
index 0000000..7aa64b7
--- /dev/null
+++ b/logic/providers/mistral/tokens.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+module NanoBot
+ module Logic
+ module Mistral
+ module Tokens
+ def self.apply_policies!(_cartridge, payload)
+ payload[:messages] = payload[:messages].map { |message| message.except(:_meta) }
+ payload
+ end
+ end
+ end
+ end
+end
diff --git a/logic/providers/openai/tokens.rb b/logic/providers/openai/tokens.rb
index 60efa60..828b774 100644
--- a/logic/providers/openai/tokens.rb
+++ b/logic/providers/openai/tokens.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require 'openai'
-
module NanoBot
module Logic
module OpenAI