Contoh Permintaan
curl -X POST https://generativelanguage.googleapis.com/v1beta/interactions \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-H "Api-Revision: 2026-05-20" \
-d '{
"model": "gemini-3-flash-preview",
"input": [
{ "type": "user_input", "content": [{ "type": "text", "text": "Hello!" }] },
{ "type": "model_output", "content": [{ "type": "text", "text": "Hi there! How can I help you today?" }] },
{ "type": "user_input", "content": [{ "type": "text", "text": "What is the capital of France?" }] }
]
}'
from google import genai
client = genai.Client()
response = client.interactions.create(
model="gemini-3-flash-preview",
input=[
{ "type": "user_input", "content": [{ "type": "text", "text": "Hello!" }] },
{ "type": "model_output", "content": [{ "type": "text", "text": "Hi there! How can I help you today?" }] },
{ "type": "user_input", "content": [{ "type": "text", "text": "What is the capital of France?" }] }
]
)
print(response.steps[-1].content[0].text)
import {GoogleGenAI} from '@google/genai';
const ai = new GoogleGenAI({});
const interaction = await ai.interactions.create({
model: 'gemini-3-flash-preview',
input: [
{ type: 'user_input', content: [{ type: 'text', text: 'Hello' }] },
{ type: 'model_output', content: [{ type: 'text', text: 'Hi there! How can I help you today?' }] },
{ type: 'user_input', content: [{ type: 'text', text: 'What is the capital of France?' }] }
]
});
console.log(interaction.steps.at(-1).content[0].text);