Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
CreatureChat
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Public
CreatureChat
Commits
bb682ebe
Commit
bb682ebe
authored
Jun 12, 2024
by
Jonathan Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor of test modules, and adding a check for API_KEY env variable before each test.
parent
74dca102
Pipeline
#12446
passed with stage
in 1 minute 45 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
BehaviorTests.java
src/test/java/com/owlmaddie/tests/BehaviorTests.java
+8
-3
EntityTestData.java
src/test/java/com/owlmaddie/utils/EntityTestData.java
+1
-1
No files found.
src/test/java/com/owlmaddie/
Prompt
Tests.java
→
src/test/java/com/owlmaddie/
tests/Behavior
Tests.java
View file @
bb682ebe
package
com
.
owlmaddie
;
package
com
.
owlmaddie
.
tests
;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
...
...
@@ -7,6 +7,7 @@ import com.owlmaddie.chat.ChatGPTRequest;
import
com.owlmaddie.commands.ConfigurationHandler
;
import
com.owlmaddie.message.MessageParser
;
import
com.owlmaddie.message.ParsedMessage
;
import
com.owlmaddie.utils.EntityTestData
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
import
org.slf4j.Logger
;
...
...
@@ -27,14 +28,16 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
fail
;
/**
* The {@code
Prompt
Tests} class tests a variety of LLM prompts and expected outputs from specific characters
* The {@code
Behavior
Tests} class tests a variety of LLM prompts and expected outputs from specific characters
* and personality types. For example, an aggressive character will attack, a nervous character will flee, etc...
*/
public
class
Prompt
Tests
{
public
class
Behavior
Tests
{
static
String
PROMPT_PATH
=
"src/main/resources/data/creaturechat/prompts/"
;
static
String
RESOURCE_PATH
=
"src/test/resources/data/creaturechat/"
;
static
String
API_KEY
=
""
;
static
String
API_URL
=
""
;
String
NO_API_KEY
=
"No API_KEY environment variable has been set."
;
ConfigurationHandler
.
Config
config
=
null
;
String
systemChatContents
=
null
;
...
...
@@ -71,6 +74,8 @@ public class PromptTests {
if
(
API_URL
!=
null
&&
!
API_URL
.
isEmpty
())
{
config
.
setUrl
(
API_URL
);
}
// Verify API key is set correctly
assertNotNull
(
API_KEY
,
NO_API_KEY
);
// Load system chat prompt
systemChatContents
=
readFileContents
(
systemChatPath
);
...
...
src/test/java/com/owlmaddie/EntityTestData.java
→
src/test/java/com/owlmaddie/
utils/
EntityTestData.java
View file @
bb682ebe
package
com
.
owlmaddie
;
package
com
.
owlmaddie
.
utils
;
import
com.google.gson.Gson
;
import
com.google.gson.reflect.TypeToken
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment