generateContent 方法来创建响应。Authorization: Bearer ********************{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Hello"
}
]
},
{
"role": "model",
"parts": [
{
"text": "Great to meet you. What would you like to know?"
}
]
},
{
"role": "user",
"parts": [
{
"text": "I have two dogs in my house. How many paws are in my house?"
}
]
}
]
}{
"candidates": [
{
"content": {
"role": "model",
"parts": [
{
"text": "That's an easy one! Each dog has 4 paws, so:\n\n2 dogs * 4 paws/dog = **8 paws**"
}
]
},
"finishReason": "STOP",
"index": 0,
"safetyRatings": []
}
],
"usageMetadata": {
"promptTokenCount": 32,
"candidatesTokenCount": 147,
"totalTokenCount": 179,
"thoughtsTokenCount": 0,
"promptTokensDetails": null
}
}