Skip to content

Cohere command model

Ahmad Albarqawi edited this page Mar 5, 2023 · 1 revision

Cohere.ai provides a fine-tuned command model to generate advanced text like a blog post.

Helper function for cohere blog post generation:

publicstaticvoidwriteBlogArticle(Stringkey, Stringinstruction, Stringmodel) {
RemoteLanguageModellang = newRemoteLanguageModel(key, SupportedLangModels.cohere);
LanguageModelInputinput = newLanguageModelInput.Builder(instruction).
setMaxTokens(600).setModel("command-xlarge-20221108").setTemperature(0.8f).build();
try {
System.out.println(lang.generateText(input));
} catch (IOExceptione) {
e.printStackTrace();
}
}

Model parameters and method execution:

Stringkey = "<add-key-from-cohere.ai>";
Stringinstruction = "Write a blog outline for a blog titled \\\"The Art of Effective Communication: Tips and Tricks for Better Interactions\\\"";
Stringmodel = "command-xlarge-20221108";
writeBlogArticle(key, instruction, model);

Clone this wiki locally