[AUR-361] Setup pre-commit, pytest, GitHub actions, ssh-secret (#3)

Co-authored-by: trducng <trungduc1992@gmail.com>
This commit is contained in:
ian_Cin
2023-08-30 07:22:01 +07:00
committed by GitHub
parent c3c25db48c
commit 5241edbc46
19 changed files with 268 additions and 54 deletions

View File

@@ -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()