prompt reworking
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.springframework.ai.core.prompts;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -107,4 +107,5 @@ public class PromptTemplate extends AbstractPromptTemplate {
|
||||
"All template variables were not replaced. Missing variable names are " + missingEntries);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user