类 Response<T>
java.lang.Object
dev.langchain4j.model.output.Response<T>
- 类型参数:
T- The type of content generated by the model.
Represents the response from various types of models, including language, chat, embedding, and moderation models.
This class encapsulates the generated content, token usage statistics, and finish reason.
-
构造器概要
构造器构造器说明Create a new Response.Response(T content, TokenUsage tokenUsage, FinishReason finishReason) Create a new Response. -
方法概要
修饰符和类型方法说明content()Get the content.booleanGet the finish reason.static <T> Response<T>from(T content) Create a new Response.static <T> Response<T>from(T content, TokenUsage tokenUsage) Create a new Response.static <T> Response<T>from(T content, TokenUsage tokenUsage, FinishReason finishReason) Create a new Response.inthashCode()Get the token usage statistics.toString()
-
构造器详细资料
-
Response
Create a new Response.Will contain
nullTokenUsageandFinishReason- 参数:
content- the content to wrap.
-
Response
Create a new Response.- 参数:
content- the content to wrap.tokenUsage- the token usage statistics, ornull.finishReason- the finish reason, ornull.
-
-
方法详细资料
-
content
Get the content.- 返回:
- the content.
-
tokenUsage
Get the token usage statistics.- 返回:
- the token usage statistics, or
null.
-
finishReason
Get the finish reason.- 返回:
- the finish reason, or
null.
-
equals
-
hashCode
public int hashCode() -
toString
-
from
Create a new Response.- 类型参数:
T- the type of content.- 参数:
content- the content to wrap.- 返回:
- the new Response.
-
from
Create a new Response.- 类型参数:
T- the type of content.- 参数:
content- the content to wrap.tokenUsage- the token usage statistics.- 返回:
- the new Response.
-
from
Create a new Response.- 类型参数:
T- the type of content.- 参数:
content- the content to wrap.tokenUsage- the token usage statistics.finishReason- the finish reason.- 返回:
- the new Response.
-