Skip to content

Commit

Permalink
prompt reworking
Browse files Browse the repository at this point in the history
  • Loading branch information
markpollack committed Jul 29, 2023
1 parent 4159758 commit f2b299f
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/


package org.springframework.ai.core.prompts;

import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/


package org.springframework.ai.core.prompts;

import java.util.Map;
Expand Down Expand Up @@ -44,5 +43,4 @@ public Prompt create(Map<String, Object> model) {
return new Prompt(new ChatMessage(render(model), this.role));
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/


package org.springframework.ai.core.prompts;

public class FunctionPromptTemplate extends PromptTemplate {
Expand All @@ -25,5 +24,4 @@ public FunctionPromptTemplate(String template) {
super(template);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,5 @@ protected void validate(Map<String, Object> model) {
"All template variables were not replaced. Missing variable names are " + missingEntries);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/


package org.springframework.ai.core.prompts;

import java.util.Map;
Expand All @@ -36,4 +35,5 @@ public Prompt create() {
public Prompt create(Map<String, Object> model) {
return new Prompt(new SystemMessage(render(model)));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
// }

}
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ void newApiPlaygroundTests() {
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)

Expand All @@ -81,7 +79,8 @@ void newApiPlaygroundTests() {
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,
Expand Down

0 comments on commit f2b299f

Please sign in to comment.