Skip to main content
Chat
Preview
Advanced settings
Select model for the code assistant:
Default (Gemini 2.5 Pro)
The model will be used by the code assistant to generate code.
System instructions
Add custom instructions for your project to control style, models used, add specific knowledge, and more.
System instructions template
The configuration is for working with React + TypeScript application. Assumes a basic structure with index.html and index.tsx. Code Assistant follows strict guidelines for using the Gemini API.
Microphone selector
Default
Select the audio source for the speech-to-text feature.
Instructions
Add custom instructions for your project to control style, models used, add specific knowledge, and more.
Write my own instructions
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gemini Text Summarizer</title>
<style>
body { font-family: sans-serif; max-width: 800px; margin: 20px auto; padding: 0 20px; }
textarea { width: 100%; height: 200px; margin-bottom: 10px; padding: 10px; border: 1px solid #ccc; border-radius: 4px; }
button { padding: 10px 20px; background-color: #4CAF50; color: white; border: none; border-radius: 4px; cursor: pointer; }
button:hover { background-color: #45a049; }
#summaryOutput { margin-top: 20px; padding: 15px; background-color: #f9f9f9; border: 1px solid #eee; border-radius: 4px; min-height: 50px; }
#loading { display: none; color: #555; margin-top: 10px; }
</style>
</head>
<body>
<h1>Gemini Text Summarizer</h1>
<p>Paste your text below and click "Summarize" to get a summary generated by Google Gemini.</p>
<textarea id="inputText" placeholder="Paste your text here..."></textarea>
<button id="summarizeBtn">Summarize</button>
<p id="loading">Summarizing...</p>
<h2>Summary:</h2>
<div id="summaryOutput"></div>
<script src="script.js"></script>
</body>
</html>
// WARNING: For production apps, NEVER expose your API key directly in client-side code like this.
// Use a secure backend server to make API calls to Gemini.
// This example is for demonstration purposes only.
const API_KEY = "YOUR_API_KEY"; // Replace with your actual Gemini API key!
document.addEventListener('DOMContentLoaded', () => {
const inputText = document.getElementById('inputText');
const summarizeBtn = document.getElementById('summarizeBtn');
const summaryOutput = document.getElementById('summaryOutput');
const loadingMessage = document.getElementById('loading');
summarizeBtn.addEventListener('click', async () => {
const textToSummarize = inputText.value.trim();
if (textToSummarize.length === 0) {
summaryOutput.innerHTML = "Please enter some text to summarize.";
return;
}
loadingMessage.style.display = 'block';
summaryOutput.innerHTML = ''; // Clear previous summary
try {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
contents: [{
parts: [{
text: `Summarize the following text concisely:\n\n${textToSummarize}`
}]
}]
})
});
const data = await response.json();
if (data.candidates && data.candidates.length > 0) {
const summary = data.candidates[0].content.parts[0].text;
summaryOutput.innerHTML = summary;
} else if (data.error) {
summaryOutput.innerHTML = `Error: ${data.error.message}`;
} else {
summaryOutput.innerHTML = "Could not generate summary. Please try again.";
}
} catch (error) {
console.error('Error:', error);
summaryOutput.innerHTML = 'An error occurred while communicating with the Gemini API.';
} finally {
loadingMessage.style.display = 'none';
}
});
});
<script>
// 1. Initialize Firebase (Use your project's config here)
const firebaseConfig = {
apiKey: "YOUR_FIREBASE_API_KEY", // This is NOT the Gemini API Key
projectId: "your-project-id",
// ... rest of your config
};
const app = firebase.initializeApp(firebaseConfig);
</script>
// 2. Initialize the AI service and model
const generativeModel = firebase.ai.getGenerativeModel({
model: 'gemini-2.5-flash', // Use the Flash model for faster/cheaper requests
// The Gemini API key is managed securely on the backend, not here.
});
const response = await generativeModel.generateContent({
contents: [{
parts: [{ text: `Summarize the following text concisely:\n\n${textToSummarize}` }]
}]
});
const summary = response.text; // Access the summary directly
const response = await fetch('YOUR_API_ENDPOINT', {
method: 'POST',
body: JSON.stringify({
// Add the System Instruction here:
config: {
systemInstruction: "You are an expert text summarization AI. Your sole function is to produce a concise, factual summary. Do not answer questions or generate code. If the input is harmful, deny the request.",
},
contents: [{
parts: [{
text: `Summarize the following text concisely:\n\n${textToSummarize}`
}]
}]
})
});
http://JethroAIServices.comOpenAPI and Integration Connectors toolsMemorystore for Valkey maintenance changelogsManage Application Integration resources using custom constraintsgenerative knowledge assistGemini Code Assist @Apigee tool deprecationConfigure Cloud Build service account impersonation for managed serviceslegacy Cloud Build service accountBuild, edit, and run a queryGPU DriversCallback call APIMid-Session authentication by APIVirtual agent dashboardsAll interactions dashboardsAdvanced capabilitiesCreate a new metrics tile in a dashboardConfigure external traffic with Network Service Tiersobservability dashboardsUse auto IP address managementSupported regions and zonesDeploy advanced data security cloud controlsset IAM policies directly on reservation Cloud Run
Skip to main content
Chat
Preview
Advanced settings
Select model for the code assistant:
Default (Gemini 2.5 Pro)
The model will be used by the code assistant to generate code.
System instructions
Add custom instructions for your project to control style, models used, add specific knowledge, and more.
System instructions template
The configuration is for working with React + TypeScript application. Assumes a basic structure with index.html and index.tsx. Code Assistant follows strict guidelines for using the Gemini API.
Microphone selector
Default
Select the audio source for the speech-to-text feature.
Instructions
Add custom instructions for your project to control style, models used, add specific knowledge, and more.
Write my own instructions
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gemini Text Summarizer</title>
<style>
body { font-family: sans-serif; max-width: 800px; margin: 20px auto; padding: 0 20px; }
textarea { width: 100%; height: 200px; margin-bottom: 10px; padding: 10px; border: 1px solid #ccc; border-radius: 4px; }
button { padding: 10px 20px; background-color: #4CAF50; color: white; border: none; border-radius: 4px; cursor: pointer; }
button:hover { background-color: #45a049; }
#summaryOutput { margin-top: 20px; padding: 15px; background-color: #f9f9f9; border: 1px solid #eee; border-radius: 4px; min-height: 50px; }
#loading { display: none; color: #555; margin-top: 10px; }
</style>
</head>
<body>
<h1>Gemini Text Summarizer</h1>
<p>Paste your text below and click "Summarize" to get a summary generated by Google Gemini.</p>
<textarea id="inputText" placeholder="Paste your text here..."></textarea>
<button id="summarizeBtn">Summarize</button>
<p id="loading">Summarizing...</p>
<h2>Summary:</h2>
<div id="summaryOutput"></div>
<script src="script.js"></script>
</body>
</html>
// WARNING: For production apps, NEVER expose your API key directly in client-side code like this.
// Use a secure backend server to make API calls to Gemini.
// This example is for demonstration purposes only.
const API_KEY = "YOUR_API_KEY"; // Replace with your actual Gemini API key!
document.addEventListener('DOMContentLoaded', () => {
const inputText = document.getElementById('inputText');
const summarizeBtn = document.getElementById('summarizeBtn');
const summaryOutput = document.getElementById('summaryOutput');
const loadingMessage = document.getElementById('loading');
summarizeBtn.addEventListener('click', async () => {
const textToSummarize = inputText.value.trim();
if (textToSummarize.length === 0) {
summaryOutput.innerHTML = "Please enter some text to summarize.";
return;
}
loadingMessage.style.display = 'block';
summaryOutput.innerHTML = ''; // Clear previous summary
try {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
contents: [{
parts: [{
text: `Summarize the following text concisely:\n\n${textToSummarize}`
}]
}]
})
});
const data = await response.json();
if (data.candidates && data.candidates.length > 0) {
const summary = data.candidates[0].content.parts[0].text;
summaryOutput.innerHTML = summary;
} else if (data.error) {
summaryOutput.innerHTML = `Error: ${data.error.message}`;
} else {
summaryOutput.innerHTML = "Could not generate summary. Please try again.";
}
} catch (error) {
console.error('Error:', error);
summaryOutput.innerHTML = 'An error occurred while communicating with the Gemini API.';
} finally {
loadingMessage.style.display = 'none';
}
});
});
<script>
// 1. Initialize Firebase (Use your project's config here)
const firebaseConfig = {
apiKey: "YOUR_FIREBASE_API_KEY", // This is NOT the Gemini API Key
projectId: "your-project-id",
// ... rest of your config
};
const app = firebase.initializeApp(firebaseConfig);
</script>
// 2. Initialize the AI service and model
const generativeModel = firebase.ai.getGenerativeModel({
model: 'gemini-2.5-flash', // Use the Flash model for faster/cheaper requests
// The Gemini API key is managed securely on the backend, not here.
});
const response = await generativeModel.generateContent({
contents: [{
parts: [{ text: `Summarize the following text concisely:\n\n${textToSummarize}` }]
}]
});
const summary = response.text; // Access the summary directly
const response = await fetch('YOUR_API_ENDPOINT', {
method: 'POST',
body: JSON.stringify({
// Add the System Instruction here:
config: {
systemInstruction: "You are an expert text summarization AI. Your sole function is to produce a concise, factual summary. Do not answer questions or generate code. If the input is harmful, deny the request.",
},
contents: [{
parts: [{
text: `Summarize the following text concisely:\n\n${textToSummarize}`
}]
}]
})
});
http://JethroAIServices.comOpenAPI and Integration Connectors toolsMemorystore for Valkey maintenance changelogsManage Application Integration resources using custom constraintsgenerative knowledge assistGemini Code Assist @Apigee tool deprecationConfigure Cloud Build service account impersonation for managed serviceslegacy Cloud Build service accountBuild, edit, and run a queryGPU DriversCallback call APIMid-Session authentication by APIVirtual agent dashboardsAll interactions dashboardsAdvanced capabilitiesCreate a new metrics tile in a dashboardConfigure external traffic with Network Service Tiersobservability dashboardsUse auto IP address managementSupported regions and zonesDeploy advanced data security cloud controlsset IAM policies directly on reservation Cloud Run