-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#from dotenv import load_dotenv | ||
#load_dotenv() | ||
|
||
from cardinal.collector import MsgCollector | ||
from cardinal.common import HumanMessage, AssistantMessage | ||
|
||
def test_msg_collector(): | ||
collector = MsgCollector(storage_name="test", drop_old=True) | ||
messages = [HumanMessage(content="hi"), AssistantMessage(content="hi there")] | ||
collector.collect(messages) | ||
messages = [HumanMessage(content="foo"), AssistantMessage(content="foo too")] | ||
collector.collect(messages) | ||
res = "[[HumanMessage(content='hi', role=<Role.USER: 'user'>), AssistantMessage(content='hi there', role=<Role.ASSISTANT: 'assistant'>)], [HumanMessage(content='foo', role=<Role.USER: 'user'>), AssistantMessage(content='foo too', role=<Role.ASSISTANT: 'assistant'>)]]" | ||
assert(str(collector.dump()) == res) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from cardinal.common import HumanMessage | ||
from cardinal.model import ChatOpenAI | ||
import pytest | ||
|
||
|
||
@pytest.mark.skip(reason='todo') | ||
def test_chat_openai(): | ||
chat_openai = ChatOpenAI() | ||
messages = [HumanMessage(content="Say this is a test")] | ||
print(chat_openai.chat(messages)) | ||
|
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.