-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from fractalego/development
Development
- Loading branch information
Showing
44 changed files
with
540 additions
and
306 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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Copyright (c) 2023 [email protected] | ||
Copyright (c) 2024 [email protected] | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
|
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
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,62 @@ | ||
import os | ||
from unittest import TestCase | ||
|
||
from wafl.connectors.prompt_template import PromptCreator | ||
from wafl.interface.conversation import Conversation, Utterance | ||
|
||
_path = os.path.dirname(__file__) | ||
|
||
|
||
class TestPrompts(TestCase): | ||
def test_utterance(self): | ||
utterance = Utterance( | ||
text="Hello", speaker="user", timestamp="2022-01-01T00:00:00" | ||
) | ||
self.assertEqual( | ||
utterance.to_dict(), | ||
{"text": "Hello", "speaker": "user", "timestamp": "2022-01-01T00:00:00"}, | ||
) | ||
|
||
def test_conversation(self): | ||
utterance1 = Utterance(text="Hello", speaker="user", timestamp=2) | ||
utterance2 = Utterance(text="Hi", speaker="bot", timestamp=1) | ||
conversation = Conversation(utterances=[utterance1, utterance2]) | ||
self.assertEqual( | ||
conversation.to_dict(), | ||
[ | ||
{ | ||
"text": "Hello", | ||
"speaker": "user", | ||
"timestamp": 2, | ||
}, | ||
{ | ||
"text": "Hi", | ||
"speaker": "bot", | ||
"timestamp": 1, | ||
}, | ||
], | ||
) | ||
|
||
def test_prompt(self): | ||
utterance1 = Utterance(text="Hello", speaker="user", timestamp=2) | ||
utterance2 = Utterance(text="Hi", speaker="bot", timestamp=1) | ||
conversation = Conversation(utterances=[utterance1, utterance2]) | ||
prompt = PromptCreator.create(system_prompt="Hello", conversation=conversation) | ||
self.assertEqual( | ||
prompt.to_dict(), | ||
{ | ||
"system_prompt": "Hello", | ||
"conversation": [ | ||
{ | ||
"text": "Hello", | ||
"speaker": "user", | ||
"timestamp": 2, | ||
}, | ||
{ | ||
"text": "Hi", | ||
"speaker": "bot", | ||
"timestamp": 1, | ||
}, | ||
], | ||
}, | ||
) |
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
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.