Skip to content

Commit 8421473

Browse files
committed
Finalize sending an agent message easier with no websocket connection necessary
1 parent 989d257 commit 8421473

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/llama_bot_rails.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require "llama_bot_rails/version"
22
require "llama_bot_rails/engine"
3+
require "llama_bot_rails/llama_bot"
34

45
module LlamaBotRails
56
class << self
@@ -23,5 +24,9 @@ def add_instruction_to_agent_prompt!(new_instruction)
2324
FileUtils.mkdir_p(agent_prompt_path.dirname)
2425
File.write(agent_prompt_path, "\n#{new_instruction}", mode: 'a')
2526
end
27+
28+
def send_agent_message(agent_params)
29+
LlamaBot.send_agent_message(agent_params)
30+
end
2631
end
2732
end

spec/lib/llama_bot_rails/llama_bot_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
require 'llama_bot_rails/llama_bot'
33

44
RSpec.describe LlamaBotRails::LlamaBot do
5+
6+
describe '.send_agent_message' do
7+
it 'sends an agent message' do
8+
result = described_class.send_agent_message(message: 'Hello', thread_id: '123')
9+
expect(result).to be_a(Enumerator)
10+
end
11+
end
12+
513
describe '.get_threads' do
614
context 'when the request is successful' do
715
before do

0 commit comments

Comments
 (0)