Class GoogleAiGeminiDecisionResponseMetadata
java.lang.Object
dev.langchain4j.model.decision.response.DecisionResponseMetadata
dev.langchain4j.model.googleai.GoogleAiGeminiDecisionResponseMetadata
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
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescription@Nullable StringGemini's explanation of why it blocked the input, ornullwhen the input was not blocked or Gemini gave no explanation.@Nullable StringWhy Gemini blocked the input, as reported by Gemini, for example"safety"or"prohibited_content", ornullwhen the input was not blocked.builder()booleaninthashCode()@Nullable SuccessfulHttpResponseThe raw HTTP response of the Gemini Decisions API, for example to read a field that this class does not expose yet, ornullwhen Gemini rejected blocked input with an HTTP 400 error, which is not a successful response.toString()Methods inherited from class DecisionResponseMetadata
modelName, tokenUsage
-
Method Details
-
blockReason
Why Gemini blocked the input, as reported by Gemini, for example"safety"or"prohibited_content", ornullwhen the input was not blocked. The value is in lower case, as the Decisions API reports it, unlikeGoogleAiGeminiChatResponseMetadata.blockReason(). -
blockMessage
Gemini's explanation of why it blocked the input, ornullwhen the input was not blocked or Gemini gave no explanation. -
rawHttpResponse
The raw HTTP response of the Gemini Decisions API, for example to read a field that this class does not expose yet, ornullwhen Gemini rejected blocked input with an HTTP 400 error, which is not a successful response. -
equals
- Overrides:
equalsin classDecisionResponseMetadata
-
hashCode
public int hashCode()- Overrides:
hashCodein classDecisionResponseMetadata
-
toString
- Overrides:
toStringin classDecisionResponseMetadata
-
builder
-