summaryrefslogtreecommitdiff
path: root/logic
diff options
context:
space:
mode:
Diffstat (limited to 'logic')
-rw-r--r--logic/cartridge/streaming.rb4
-rw-r--r--logic/providers/maritaca/tokens.rb14
-rw-r--r--logic/providers/ollama/tokens.rb14
3 files changed, 30 insertions, 2 deletions
diff --git a/logic/cartridge/streaming.rb b/logic/cartridge/streaming.rb
index 23e88ac..b04dc6e 100644
--- a/logic/cartridge/streaming.rb
+++ b/logic/cartridge/streaming.rb
@@ -8,9 +8,9 @@ module NanoBot
module Streaming
def self.enabled?(cartridge, interface)
provider_stream = case Helpers::Hash.fetch(cartridge, %i[provider id])
- when 'openai', 'mistral', 'cohere'
+ when 'openai', 'mistral', 'cohere', 'ollama'
Helpers::Hash.fetch(cartridge, %i[provider settings stream])
- when 'google'
+ when 'google', 'maritaca'
Helpers::Hash.fetch(cartridge, %i[provider options stream])
end
diff --git a/logic/providers/maritaca/tokens.rb b/logic/providers/maritaca/tokens.rb
new file mode 100644
index 0000000..1ae2219
--- /dev/null
+++ b/logic/providers/maritaca/tokens.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+module NanoBot
+ module Logic
+ module Maritaca
+ 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/ollama/tokens.rb b/logic/providers/ollama/tokens.rb
new file mode 100644
index 0000000..45500fb
--- /dev/null
+++ b/logic/providers/ollama/tokens.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+module NanoBot
+ module Logic
+ module Ollama
+ module Tokens
+ def self.apply_policies!(_cartridge, payload)
+ payload[:messages] = payload[:messages].map { |message| message.except(:_meta) }
+ payload
+ end
+ end
+ end
+ end
+end