Add a test for the fix functionality.
This commit is contained in:
parent
8aab8e2ec8
commit
6d2a3d6ac5
@ -41,6 +41,28 @@ You always try to say something positive about the current day and the Fjærkroa
|
|||||||
print(f"\n{response}")
|
print(f"\n{response}")
|
||||||
self.assertAIResponse(response, AIResponse('test', True, None, None, False))
|
self.assertAIResponse(response, AIResponse('test', True, None, None, False))
|
||||||
|
|
||||||
|
async def test_fix1(self) -> None:
|
||||||
|
old_config = self.bot.airesponder.config
|
||||||
|
config = {k: v for k, v in old_config.items()}
|
||||||
|
config['fix-model'] = 'gpt-3.5-turbo'
|
||||||
|
config['fix-description'] = 'You are an AI which fixes JSON documents. User send you JSON document, possibly invalid, and you fix it as good as you can and return as answer'
|
||||||
|
self.bot.airesponder.config = config
|
||||||
|
response = await self.bot.airesponder.send(AIMessage("lala", "who are you?"))
|
||||||
|
self.bot.airesponder.config = old_config
|
||||||
|
print(f"\n{response}")
|
||||||
|
self.assertAIResponse(response, AIResponse('test', True, None, None, False))
|
||||||
|
|
||||||
|
async def test_fix2(self) -> None:
|
||||||
|
old_config = self.bot.airesponder.config
|
||||||
|
config = {k: v for k, v in old_config.items()}
|
||||||
|
config['fix-model'] = 'gpt-3.5-turbo'
|
||||||
|
config['fix-description'] = 'You are an AI which fixes JSON documents. User send you JSON document, possibly invalid, and you fix it as good as you can and return as answer'
|
||||||
|
self.bot.airesponder.config = config
|
||||||
|
response = await self.bot.airesponder.send(AIMessage("lala", "Can I access Apple Music API from Python?"))
|
||||||
|
self.bot.airesponder.config = old_config
|
||||||
|
print(f"\n{response}")
|
||||||
|
self.assertAIResponse(response, AIResponse('test', True, None, None, False))
|
||||||
|
|
||||||
async def test_history(self) -> None:
|
async def test_history(self) -> None:
|
||||||
self.bot.airesponder.history = []
|
self.bot.airesponder.history = []
|
||||||
response = await self.bot.airesponder.send(AIMessage("lala", "which date is today?"))
|
response = await self.bot.airesponder.send(AIMessage("lala", "which date is today?"))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user