Class GoogleAiGeminiDecisionResponseMetadata

java.lang.Object
dev.langchain4j.model.decision.response.DecisionResponseMetadata
dev.langchain4j.model.googleai.GoogleAiGeminiDecisionResponseMetadata

@Experimental public class GoogleAiGeminiDecisionResponseMetadata extends DecisionResponseMetadata
The metadata of a DecisionResponse of a GoogleAiGeminiDecisionModel. In addition to the model name and the token usage, it says why Gemini blocked the input, if it did. Then the answer to every question is a RefusalAnswer. It also gives access to the raw HTTP response.

Gemini does not report the model in its response, so DecisionResponseMetadata.modelName() is the model name of the request.

DecisionResponse response = decisionModel.decide(request);
GoogleAiGeminiDecisionResponseMetadata metadata = (GoogleAiGeminiDecisionResponseMetadata) response.metadata();
String blockReason = metadata.blockReason(); // for example "safety", or null when the input was not blocked
Since:
1.24.0