service/SystemMessage.java

langchain4j · langchain4j/src/main/java/dev/langchain4j/service/SystemMessage.java · java · Apache-2.0
ai, tag:knn-classified

Annotation to specify system prompt or template for AI service methods or interfaces.

// Source: https://github.com/langchain4j/langchain4j | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package dev.langchain4j.service;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.util.function.Function;

/**
 * Specifies either a complete system message (prompt) or a system message template to be used each time an AI service is invoked.
 * <br>
 * An example:
 * <pre>
 * interface Assistant {
 *
 *     {@code @SystemMessage}("You are a helpful assistant")
 *     String ch

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key