Loading...
Loading...
Guidelines for Gemini API development. Used to pre-define architecture in the planning phase and verify code patterns in the coding/debugging phase.
npx skill4agent add drgarbage/ag-course-index gemini-agent-dev-supportsearch_docsllms.txt@google/genaigoogle-genailocalhostfile://input.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
if (e.isComposing || e.keyCode === 229) return;
if (!e.shiftKey) {
e.preventDefault();
handleSend();
}
}
});input.valueloading === trueinput.value.trim() === ""new GoogleGenAI({}).models.list();const systemInstruction = `Current local time: ${new Date().toLocaleString()}`;// API Key Validation (verify by listing models via SDK)
async function validateApiKey(apiKey) {
try {
const ai = new GoogleGenAI({ apiKey });
await ai.models.list();
return true;
} catch {
return false;
}
}import { GoogleGenAI } from '@google/genai';
const ai = new GoogleGenAI({});
function adaptGenerateContent(options) {
// call tools seperately
// call official tools seperately
}
function withOfficial(options) {
// append official tools
}
async function callGemini(modelName, userInput, tools = [], enableSearch = false) {
const options = {
model: modelName,
contents: userInput,
config: { tools }
}
return checkAllowToolCombine(modelName) ?
await adaptGenerateContent(options) :
await ai.model.generateContent(options);
}systemInstruction"Tool google_search is disabled. Do not attempt to call it."{
"functionResponse": {
"name": "unknown_or_failed_tool",
"response": {
"error": "Error message for model auto-correction."
}
}
}functionCallsfunctionCallfunctionResponsethoughtsignature{
"error": {
"code": "API_LIMIT_EXCEEDED",
"message": "Friendly error summary in Traditional Chinese.",
"details": {
"status": 429,
"reason": "rate_limit_exceeded",
"debug_info": "Debug stack trace without API keys."
}
}
}import { marked } from 'marked';
import DOMPurify from 'dompurify';
const safetyHtml = DOMPurify.sanitize(marked.parse(markdown));| ID | Item | Result | Evidence |
|---|---|---|---|
| S1 | SDK / Tooling | PASS / FAIL / N/A | [code line or test screenshot link] |
[file path][test execution logs]