Commit 26ab08c8 by Jonathan Thomas

Improve creativeness with chat gpt temperature, improve prompts, better support…

Improve creativeness with chat gpt temperature, improve prompts, better support for GPT 3.5 and 4.0. Update model to gpt-3.5-turbo.
parent 7c8267cd
Pipeline #11867 passed with stage
in 21 seconds
...@@ -137,7 +137,7 @@ public class ChatDataManager { ...@@ -137,7 +137,7 @@ public class ChatDataManager {
// Get Entity details // Get Entity details
Entity entity = ServerEntityFinder.getEntityByUUID(player.getServerWorld(), UUID.fromString(entityId)); Entity entity = ServerEntityFinder.getEntityByUUID(player.getServerWorld(), UUID.fromString(entityId));
if (entity.getCustomName() == null) { if (entity.getCustomName() == null) {
contextData.put("entity_name", "Un-named"); contextData.put("entity_name", "");
} else { } else {
contextData.put("entity_name", entity.getCustomName().toString()); contextData.put("entity_name", entity.getCustomName().toString());
} }
...@@ -151,7 +151,9 @@ public class ChatDataManager { ...@@ -151,7 +151,9 @@ public class ChatDataManager {
public void generateMessage(ServerPlayerEntity player, String systemPrompt, String userMessage) { public void generateMessage(ServerPlayerEntity player, String systemPrompt, String userMessage) {
this.status = ChatStatus.PENDING; this.status = ChatStatus.PENDING;
// Add USER Message // Add USER Message
if (systemPrompt == "system-chat") {
this.addMessage(userMessage, ChatSender.USER); this.addMessage(userMessage, ChatSender.USER);
}
// Add PLAYER context information // Add PLAYER context information
Map<String, String> contextData = getPlayerContext(player); Map<String, String> contextData = getPlayerContext(player);
......
...@@ -37,10 +37,12 @@ public class ChatGPTRequest { ...@@ -37,10 +37,12 @@ public class ChatGPTRequest {
String model; String model;
List<ChatGPTRequestMessage> messages; List<ChatGPTRequestMessage> messages;
ResponseFormat response_format; ResponseFormat response_format;
float temperature;
public ChatGPTRequestPayload(String model, List<ChatGPTRequestMessage> messages, Boolean jsonMode) { public ChatGPTRequestPayload(String model, List<ChatGPTRequestMessage> messages, Boolean jsonMode, float temperature) {
this.model = model; this.model = model;
this.messages = messages; this.messages = messages;
this.temperature = temperature;
if (jsonMode) { if (jsonMode) {
this.response_format = new ResponseFormat("json_object"); this.response_format = new ResponseFormat("json_object");
} else { } else {
...@@ -114,7 +116,7 @@ public class ChatGPTRequest { ...@@ -114,7 +116,7 @@ public class ChatGPTRequest {
} }
// Convert JSON to String // Convert JSON to String
ChatGPTRequestPayload payload = new ChatGPTRequestPayload("gpt-3.5-turbo-1106", messages, jsonMode); ChatGPTRequestPayload payload = new ChatGPTRequestPayload("gpt-3.5-turbo", messages, jsonMode, 1.0f);
Gson gsonInput = new Gson(); Gson gsonInput = new Gson();
String jsonInputString = gsonInput.toJson(payload); String jsonInputString = gsonInput.toJson(payload);
......
You are a RPG dungeon master, crafting a new character sheet in the following format. Be very creative with each new You are a RPG dungeon master, crafting a new character sheet in the following format. Be very creative with each new
character. These characters will be inhabiting and participating in an epic fantasy adventure which takes place in character. These characters will be inhabiting and participating in an epic fantasy adventure which takes place in
Minecraft. Please limit traits to a few choices and keep them short and concise. Please avoid any specific races or Minecraft. Please limit traits to a few choices and keep them short and concise. Please follow the character sheet
classes. Please follow the character sheet format below, and ONLY output this character sheet without any intro text. format below, and ONLY output this character sheet without any intro text. Please use the existing attributes
(if any are filled out below).
- Name: Please name each character including a short initial greeting (as spoken by
the character using their personality traits) which introduces their unique quest and furthers the story. Use creative
and original names, and NEVER base names solely on their entity type. For example, avoid childish names such as
Bessie the Cow, Cluck the Chicken, Shelly the Turtle, and instead lean toward fantasy names.
- Name: {{entity_name}}
- Type: {{entity_type}}
- Personality: - Personality:
- Speaking Style / Tone: - Speaking Style / Tone:
- Likes: - Likes:
......
Please respond directly to the player, as if the response was written by the following Minecraft entity. Please respond directly to the player, as if the response was written by the following Minecraft entity.
Please do NOT break the 4th wall and try and leverage the entity's character sheet below as much as Please do NOT break the 4th wall and leverage the entity's character sheet below as much as
possible. possible. Try and keep response to 1 to 2 sentences (very brief).
Entity Character Sheet: Entity Character Sheet:
- Type / Species: {{entity_type}}
{{entity_character_sheet}} {{entity_character_sheet}}
Player Character Sheet: Player Character Sheet:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment