mirror of
				https://github.com/discourse/discourse-ai.git
				synced 2025-10-31 06:28:48 +00:00 
			
		
		
		
	Given latest GPT 3.5 16k which is both better steered and supports functions we can now support rich bot integration. Clunky system message based steering is removed and instead we use the function framework provided by Open AI
		
			
				
	
	
		
			25 lines
		
	
	
		
			623 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			623 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # frozen_string_literal: true
 | |
| 
 | |
| RSpec.describe DiscourseAi::AiBot::AnthropicBot do
 | |
|   describe "#update_with_delta" do
 | |
|     def bot_user
 | |
|       User.find(DiscourseAi::AiBot::EntryPoint::GPT4_ID)
 | |
|     end
 | |
| 
 | |
|     subject { described_class.new(bot_user) }
 | |
| 
 | |
|     describe "get_delta" do
 | |
|       it "can properly remove Assistant prefix" do
 | |
|         context = {}
 | |
|         reply = +""
 | |
| 
 | |
|         reply << subject.get_delta({ completion: "Hello " }, context)
 | |
|         expect(reply).to eq("Hello ")
 | |
| 
 | |
|         reply << subject.get_delta({ completion: "Hello world" }, context)
 | |
|         expect(reply).to eq("Hello world")
 | |
|       end
 | |
|     end
 | |
|   end
 | |
| end
 |