Class GoogleAiGeminiChatResponseMetadata
java.lang.Object
dev.langchain4j.model.chat.response.ChatResponseMetadata
dev.langchain4j.model.googleai.GoogleAiGeminiChatResponseMetadata
Gemini-specific metadata for
ChatResponse.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionThe reason Gemini refused to process the prompt, for example"SAFETY","PROHIBITED_CONTENT","BLOCKLIST"or"IMAGE_SAFETY".builder()booleaninthashCode()The safety assessments of the prompt, as reported by Gemini'spromptFeedback.The safety assessments of the generated content, one per harm category that Gemini evaluated.toString()Methods inherited from class ChatResponseMetadata
finishReason, id, modelName, toBuilder, tokenUsage
-
Method Details
-
groundingMetadata
-
urlContextMetadata
-
safetyRatings
The safety assessments of the generated content, one per harm category that Gemini evaluated.Use these to find out why generation stopped when
ChatResponseMetadata.finishReason()isFinishReason.CONTENT_FILTER. To inspect the safety of the prompt instead, usepromptSafetyRatings().- Returns:
- an unmodifiable list of safety ratings, empty when the response carries none
-
promptSafetyRatings
The safety assessments of the prompt, as reported by Gemini'spromptFeedback.These describe the request rather than the generated content, and are typically populated when Gemini refuses to answer at all. In that case
blockReason()is set andsafetyRatings()is empty.- Returns:
- an unmodifiable list of safety ratings for the prompt, empty when the response carries none
-
blockReason
The reason Gemini refused to process the prompt, for example"SAFETY","PROHIBITED_CONTENT","BLOCKLIST"or"IMAGE_SAFETY".When this is set, Gemini returned no content at all: the
AiMessagecarries no text,ChatResponseMetadata.finishReason()isFinishReason.CONTENT_FILTER, andpromptSafetyRatings()explains which harm categories were involved.- Returns:
- the block reason, or
nullwhen the prompt was not blocked
-
toBuilder
- Overrides:
toBuilderin classChatResponseMetadata
-
equals
- Overrides:
equalsin classChatResponseMetadata
-
hashCode
public int hashCode()- Overrides:
hashCodein classChatResponseMetadata
-
toString
- Overrides:
toStringin classChatResponseMetadata
-
builder
-