[AUR-361] Setup pre-commit, pytest, GitHub actions, ssh-secret (#3)
Co-authored-by: trducng <trungduc1992@gmail.com>
This commit is contained in:
@@ -1,15 +1,10 @@
|
||||
from unittest.mock import patch
|
||||
|
||||
from langchain.chat_models import AzureChatOpenAI as AzureChatOpenAILC
|
||||
from langchain.schema.messages import (
|
||||
SystemMessage,
|
||||
HumanMessage,
|
||||
AIMessage,
|
||||
)
|
||||
from langchain.schema.messages import AIMessage, HumanMessage, SystemMessage
|
||||
|
||||
from kotaemon.llms.chats.openai import AzureChatOpenAI
|
||||
from kotaemon.llms.base import LLMInterface
|
||||
|
||||
from kotaemon.llms.chats.openai import AzureChatOpenAI
|
||||
|
||||
_openai_chat_completion_response = {
|
||||
"id": "chatcmpl-7qyuw6Q1CFCpcKsMdFkmUPUa7JP2x",
|
||||
@@ -49,7 +44,9 @@ def test_azureopenai_model(openai_completion):
|
||||
|
||||
# test for str input - stream mode
|
||||
output = model("hello world")
|
||||
assert isinstance(output, LLMInterface), "Output for single text is not LLMInterface"
|
||||
assert isinstance(
|
||||
output, LLMInterface
|
||||
), "Output for single text is not LLMInterface"
|
||||
openai_completion.assert_called()
|
||||
|
||||
# test for list[str] input - batch mode
|
||||
@@ -67,7 +64,9 @@ def test_azureopenai_model(openai_completion):
|
||||
]
|
||||
|
||||
output = model(messages)
|
||||
assert isinstance(output, LLMInterface), "Output for single text is not LLMInterface"
|
||||
assert isinstance(
|
||||
output, LLMInterface
|
||||
), "Output for single text is not LLMInterface"
|
||||
openai_completion.assert_called()
|
||||
|
||||
# test for list[list[message]] input - batch mode
|
||||
@@ -75,4 +74,3 @@ def test_azureopenai_model(openai_completion):
|
||||
assert isinstance(output, list), "Output for batch string is not a list"
|
||||
assert isinstance(output[0], LLMInterface), "Output for text is not LLMInterface"
|
||||
openai_completion.assert_called()
|
||||
|
||||
|
Reference in New Issue
Block a user