Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PromptTemplate added ChatOptions support #516

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,22 @@ public Prompt create() {
return new Prompt(messages);
}

@Override
public Prompt create(ChatOptions modelOptions) {
List<Message> messages = createMessages();
return new Prompt(messages, modelOptions);
}

@Override
public Prompt create(Map<String, Object> model) {
List<Message> messages = createMessages(model);
return new Prompt(messages);
}

@Override
public Prompt create(Map<String, Object> model, ChatOptions modelOptions) {
List<Message> messages = createMessages(model);
return new Prompt(messages, modelOptions);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,21 @@ public Prompt create() {
return new Prompt(render(new HashMap<>()));
}

@Override
public Prompt create(ChatOptions modelOptions) {
return new Prompt(render(new HashMap<>()), modelOptions);
}

@Override
public Prompt create(Map<String, Object> model) {
return new Prompt(render(model));
}

@Override
public Prompt create(Map<String, Object> model, ChatOptions modelOptions) {
return new Prompt(render(model), modelOptions);
}

public Set<String> getInputVariables() {
TokenStream tokens = this.st.impl.tokens;
Set<String> inputVariables = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public interface PromptTemplateActions extends PromptTemplateStringActions {

Prompt create();

Prompt create(ChatOptions modelOptions);

Prompt create(Map<String, Object> model);

Prompt create(Map<String, Object> model, ChatOptions modelOptions);

}