prompt reworking

This commit is contained in:
Mark Pollack
2023-07-28 21:17:07 -04:00
parent 4159758fa3
commit f2b299f3da
8 changed files with 21 additions and 25 deletions

View File

@@ -14,7 +14,6 @@
* limitations under the License.
*/
package org.springframework.ai.core.prompts;
import java.util.Map;

View File

@@ -14,7 +14,6 @@
* limitations under the License.
*/
package org.springframework.ai.core.prompts;
import java.util.Map;
@@ -44,5 +43,4 @@ public class ChatPromptTemplate extends PromptTemplate {
return new Prompt(new ChatMessage(render(model), this.role));
}
}

View File

@@ -14,7 +14,6 @@
* limitations under the License.
*/
package org.springframework.ai.core.prompts;
public class FunctionPromptTemplate extends PromptTemplate {
@@ -25,5 +24,4 @@ public class FunctionPromptTemplate extends PromptTemplate {
super(template);
}
}

View File

@@ -107,4 +107,5 @@ public class PromptTemplate extends AbstractPromptTemplate {
"All template variables were not replaced. Missing variable names are " + missingEntries);
}
}
}

View File

@@ -14,7 +14,6 @@
* limitations under the License.
*/
package org.springframework.ai.core.prompts;
import java.util.Map;
@@ -36,4 +35,5 @@ public class SystemPromptTemplate extends PromptTemplate {
public Prompt create(Map<String, Object> model) {
return new Prompt(new SystemMessage(render(model)));
}
}

View File

@@ -22,7 +22,8 @@ public interface Message {
String getContent();
//TODO investigate use of "function_name" and "name" - maybe cna be first class representation vs. map.
// TODO investigate use of "function_name" and "name" - maybe cna be first class
// representation vs. map.
Map<String, Object> getProperties();
MessageType getMessageType();

View File

@@ -14,25 +14,25 @@
* limitations under the License.
*/
package org.springframework.ai.core.prompts;
import org.junit.jupiter.api.Test;
public class ChatTests {
// @Test
// void testChat() {
//
// String customerStyle = "American English in a calm and respectful tone";
// String customerEmail = "Arrr, I be fuming that me blender lid "
// + "flew off and splattered me kitchen walls "
// + "with smoothie! And to make matters worse, "
// + "the warranty don't cover the cost of "
// + "cleaning up me kitchen. I need yer help "
// + "right now, matey!";
// ChatOpenAi chatOpenAi = new ChatOpenAi();
// chatOpenAi
//
// }
// @Test
// void testChat() {
//
// String customerStyle = "American English in a calm and respectful tone";
// String customerEmail = "Arrr, I be fuming that me blender lid "
// + "flew off and splattered me kitchen walls "
// + "with smoothie! And to make matters worse, "
// + "the warranty don't cover the cost of "
// + "cleaning up me kitchen. I need yer help "
// + "right now, matey!";
// ChatOpenAi chatOpenAi = new ChatOpenAi();
// chatOpenAi
//
// }
}

View File

@@ -56,8 +56,6 @@ class PromptTests {
assertThat(prompt.getMessages()).isNotEmpty().hasSize(1);
System.out.println(prompt.getContents());
String systemTemplate = "You are a helpful assistant that translates {input_language} to {output_language}.";
// system_message_prompt = SystemMessagePromptTemplate.from_template(template)
@@ -81,7 +79,8 @@ class PromptTests {
PromptTemplate promptTemplate = new SystemPromptTemplate(systemTemplate);
Prompt systemPrompt = promptTemplate.create(systemModel);
promptTemplate = new PromptTemplate(humanTemplate); // creates a Prompt with HumanMessage
promptTemplate = new PromptTemplate(humanTemplate); // creates a Prompt with
// HumanMessage
Prompt humanPrompt = promptTemplate.create(humanModel);
// ChatPromptTemplate chatPromptTemplate = new ChatPromptTemplate(systemPrompt,