mirror of
https://github.com/neuml/txtai.git
synced 2026-10-12 02:19:52 +00:00
Fix OpenAI chat message selection
This commit is contained in:
@@ -122,6 +122,24 @@ class TestOpenAI(unittest.TestCase):
|
||||
|
||||
self.assertIsNotNone(response["choices"][0]["message"]["content"])
|
||||
|
||||
def testChatLatestMessage(self):
|
||||
"""
|
||||
Test a chat completion with multiple messages
|
||||
"""
|
||||
|
||||
response = self.client.post(
|
||||
"/v1/chat/completions",
|
||||
json={
|
||||
"messages": [
|
||||
{"role": "system", "content": "You are a helpful assistant"},
|
||||
{"role": "user", "content": "Hello"},
|
||||
],
|
||||
"model": "segmentation",
|
||||
},
|
||||
).json()
|
||||
|
||||
self.assertEqual(response["choices"][0]["message"]["content"], "Hello")
|
||||
|
||||
def testChatPipeline(self):
|
||||
"""
|
||||
Test a chat completion with a pipeline
|
||||
|
||||
Reference in New Issue
Block a user