Genkit JS API reference
Preparing search index...
genkit
/
ModelResponseData
Type Alias ModelResponseData
ModelResponseData
:
{
custom
?:
unknown
;
finishMessage
?:
string
;
finishReason
:
|
"length"
|
"stop"
|
"other"
|
"unknown"
|
"interrupted"
|
"blocked"
|
"aborted"
;
latencyMs
?:
number
;
message
?:
{
content
:
(
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
:
string
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
:
{
contentType
?:
string
;
url
:
string
}
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
:
{
input
?:
unknown
;
name
:
string
;
partial
?:
boolean
;
ref
?:
string
;
}
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
:
{
name
:
string
;
output
?:
unknown
;
ref
?:
string
}
&
{
content
?:
(
(...)
|
(...)
|
(...)
|
(...)
|
(...)
|
(...)
|
(...)
|
(...)
)
[]
;
}
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
:
Record
<
string
,
any
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
:
string
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
:
{
uri
:
string
}
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
)
[]
;
metadata
?:
Record
<
string
,
unknown
>
;
role
:
"user"
|
"model"
|
"tool"
|
"system"
;
}
;
operation
?:
{
action
?:
string
;
done
?:
boolean
;
error
?:
z
.
objectOutputType
<
{
message
:
z
.
ZodString
}
,
z
.
ZodTypeAny
,
"passthrough"
,
>
;
id
:
string
;
metadata
?:
Record
<
string
,
any
>
;
output
?:
any
;
}
;
raw
?:
unknown
;
request
?:
{
candidates
?:
number
;
config
?:
any
;
docs
?:
{
content
:
(
|
{
custom
?:
Record
<
(...)
,
(...)
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
(...)
,
(...)
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
:
string
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
(...)
,
(...)
>
;
data
?:
unknown
;
media
:
{
contentType
?:
(...)
|
(...)
;
url
:
string
}
;
metadata
?:
Record
<
(...)
,
(...)
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
(...)
,
(...)
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
(...)
,
(...)
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
:
{
input
?:
unknown
;
name
:
string
;
partial
?:
(...)
|
(...)
|
(...)
;
ref
?:
(...)
|
(...)
;
}
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
(...)
,
(...)
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
(...)
,
(...)
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
:
{
name
:
...
;
output
?:
...
;
ref
?:
...
}
&
{
content
?:
...
;
}
;
}
|
{
custom
?:
Record
<
(...)
,
(...)
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
(...)
,
(...)
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
:
Record
<
string
,
any
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
(...)
,
(...)
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
(...)
,
(...)
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
(...)
,
(...)
>
;
reasoning
:
string
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
(...)
,
(...)
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
(...)
,
(...)
>
;
reasoning
?:
undefined
;
resource
:
{
uri
:
string
}
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
)
[]
;
metadata
?:
Record
<
string
,
any
>
;
}
[]
;
messages
:
{
content
:
(
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
:
string
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
:
{
contentType
?:
string
;
url
:
string
}
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
:
{
input
?:
unknown
;
name
:
string
;
partial
?:
boolean
;
ref
?:
string
;
}
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
:
{
name
:
string
;
output
?:
unknown
;
ref
?:
(...)
|
(...)
}
&
{
content
?:
(...)
|
(...)
;
}
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
:
Record
<
string
,
any
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
:
string
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
:
{
uri
:
string
}
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
)
[]
;
metadata
?:
Record
<
string
,
unknown
>
;
role
:
"user"
|
"model"
|
"tool"
|
"system"
;
}
[]
;
output
?:
{
constrained
?:
boolean
;
contentType
?:
string
;
format
?:
string
;
schema
?:
Record
<
string
,
any
>
;
}
;
toolChoice
?:
"required"
|
"auto"
|
"none"
;
tools
?:
{
description
:
string
;
inputSchema
?:
Record
<
string
,
any
>
|
null
;
metadata
?:
Record
<
string
,
any
>
;
name
:
string
;
outputSchema
?:
Record
<
string
,
any
>
|
null
;
}
[]
;
}
;
usage
?:
{
cachedContentTokens
?:
number
;
custom
?:
Record
<
string
,
number
>
;
inputAudioFiles
?:
number
;
inputCharacters
?:
number
;
inputImages
?:
number
;
inputTokens
?:
number
;
inputVideos
?:
number
;
outputAudioFiles
?:
number
;
outputCharacters
?:
number
;
outputImages
?:
number
;
outputTokens
?:
number
;
outputVideos
?:
number
;
thoughtsTokens
?:
number
;
totalTokens
?:
number
;
}
;
}
Model response data.
Type Declaration
Optional
custom
?:
unknown
Optional
finishMessage
?:
string
finishReason
:
"length"
|
"stop"
|
"other"
|
"unknown"
|
"interrupted"
|
"blocked"
|
"aborted"
Optional
latencyMs
?:
number
Optional
message
?:
{
content
:
(
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
:
string
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
:
{
contentType
?:
string
;
url
:
string
}
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
:
{
input
?:
unknown
;
name
:
string
;
partial
?:
boolean
;
ref
?:
string
;
}
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
:
{
name
:
string
;
output
?:
unknown
;
ref
?:
string
}
&
{
content
?:
(
(...)
|
(...)
|
(...)
|
(...)
|
(...)
|
(...)
|
(...)
|
(...)
)
[]
;
}
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
:
Record
<
string
,
any
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
:
string
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
:
{
uri
:
string
}
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
)
[]
;
metadata
?:
Record
<
string
,
unknown
>
;
role
:
"user"
|
"model"
|
"tool"
|
"system"
;
}
Optional
operation
?:
{
action
?:
string
;
done
?:
boolean
;
error
?:
z
.
objectOutputType
<
{
message
:
z
.
ZodString
}
,
z
.
ZodTypeAny
,
"passthrough"
,
>
;
id
:
string
;
metadata
?:
Record
<
string
,
any
>
;
output
?:
any
;
}
Optional
raw
?:
unknown
Optional
request
?:
{
candidates
?:
number
;
config
?:
any
;
docs
?:
{
content
:
(
|
{
custom
?:
Record
<
(...)
,
(...)
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
(...)
,
(...)
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
:
string
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
(...)
,
(...)
>
;
data
?:
unknown
;
media
:
{
contentType
?:
(...)
|
(...)
;
url
:
string
}
;
metadata
?:
Record
<
(...)
,
(...)
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
(...)
,
(...)
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
(...)
,
(...)
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
:
{
input
?:
unknown
;
name
:
string
;
partial
?:
(...)
|
(...)
|
(...)
;
ref
?:
(...)
|
(...)
;
}
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
(...)
,
(...)
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
(...)
,
(...)
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
:
{
name
:
...
;
output
?:
...
;
ref
?:
...
}
&
{
content
?:
...
}
;
}
|
{
custom
?:
Record
<
(...)
,
(...)
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
(...)
,
(...)
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
:
Record
<
string
,
any
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
(...)
,
(...)
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
(...)
,
(...)
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
(...)
,
(...)
>
;
reasoning
:
string
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
(...)
,
(...)
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
(...)
,
(...)
>
;
reasoning
?:
undefined
;
resource
:
{
uri
:
string
}
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
)
[]
;
metadata
?:
Record
<
string
,
any
>
;
}
[]
;
messages
:
{
content
:
(
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
:
string
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
:
{
contentType
?:
string
;
url
:
string
}
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
:
{
input
?:
unknown
;
name
:
string
;
partial
?:
boolean
;
ref
?:
string
;
}
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
:
{
name
:
string
;
output
?:
unknown
;
ref
?:
(...)
|
(...)
}
&
{
content
?:
(...)
|
(...)
;
}
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
:
Record
<
string
,
any
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
:
string
;
resource
?:
undefined
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
|
{
custom
?:
Record
<
string
,
unknown
>
;
data
?:
unknown
;
media
?:
undefined
;
metadata
?:
Record
<
string
,
unknown
>
;
reasoning
?:
undefined
;
resource
:
{
uri
:
string
}
;
text
?:
undefined
;
toolRequest
?:
undefined
;
toolResponse
?:
undefined
;
}
)
[]
;
metadata
?:
Record
<
string
,
unknown
>
;
role
:
"user"
|
"model"
|
"tool"
|
"system"
;
}
[]
;
output
?:
{
constrained
?:
boolean
;
contentType
?:
string
;
format
?:
string
;
schema
?:
Record
<
string
,
any
>
;
}
;
toolChoice
?:
"required"
|
"auto"
|
"none"
;
tools
?:
{
description
:
string
;
inputSchema
?:
Record
<
string
,
any
>
|
null
;
metadata
?:
Record
<
string
,
any
>
;
name
:
string
;
outputSchema
?:
Record
<
string
,
any
>
|
null
;
}
[]
;
}
Optional
usage
?:
{
cachedContentTokens
?:
number
;
custom
?:
Record
<
string
,
number
>
;
inputAudioFiles
?:
number
;
inputCharacters
?:
number
;
inputImages
?:
number
;
inputTokens
?:
number
;
inputVideos
?:
number
;
outputAudioFiles
?:
number
;
outputCharacters
?:
number
;
outputImages
?:
number
;
outputTokens
?:
number
;
outputVideos
?:
number
;
thoughtsTokens
?:
number
;
totalTokens
?:
number
;
}
Settings
Member Visibility
Protected
Inherited
External
Theme
OS
Light
Dark
Genkit JS API reference
Loading...
Model response data.