Il nostro modello multimodale più conveniente, che offre le prestazioni più rapide per attività leggere e ad alta frequenza. Gemini 3.1 Flash-Lite è ideale per attività agentiche ad alto volume, estrazione semplice di dati e applicazioni a latenza estremamente bassa in cui il budget e la velocità sono i vincoli principali.
gemini-3.1-flash-lite-preview
| Proprietà | Descrizione |
|---|---|
| Codice modello | gemini-3.1-flash-lite-preview |
| Tipi di dati supportati |
Input Testo, immagine, video, audio e PDF Output Testo |
| Limiti dei token[*] |
Limite di token di input 1.048.576 Limite di token di output 65.536 |
| Funzionalità |
Generazione di audio Non supportato API batch Supportato Memorizzazione nella cache Supportato Esecuzione del codice Supportato Uso del computer Non supportato Ricerca file Supportato Chiamata di funzione Supportato Grounding con Google Maps Non supportato Generazione di immagini Non supportato API Live Non supportato Fondatezza della Ricerca Supportato Output strutturati Supportato Pensieroso Supportato Contesto URL Supportato |
| Versioni |
|
| Ultimo aggiornamento | Marzo 2026 |
| Knowledge cutoff | Gennaio 2025 |
Guida per gli sviluppatori
Gemini 3.1 Flash-Lite è ideale per gestire attività semplici su larga scala. Ecco alcuni casi d'uso più adatti a Gemini 3.1 Flash-Lite:
Traduzione: traduzione rapida, economica e di grandi volumi, ad esempio l'elaborazione di messaggi di chat, recensioni e ticket di assistenza su larga scala. Puoi utilizzare le istruzioni di sistema per limitare l'output al solo testo tradotto senza commenti aggiuntivi:
text = "Hey, are you down to grab some pizza later? I'm starving!" response = client.models.generate_content( model="gemini-3.1-flash-lite-preview", config={ "system_instruction": "Only output the translated text" }, contents=f"Translate the following text to German: {text}" ) print(response.text)Trascrizione: elabora registrazioni, note vocali o qualsiasi contenuto audio in cui hai bisogno di una trascrizione di testo senza avviare una pipeline speech-to-text separata. Supporta input multimodali, quindi puoi passare direttamente i file audio per la trascrizione:
# URL = "https://storage.googleapis.com/generativeai-downloads/data/State_of_the_Union_Address_30_January_1961.mp3" # Upload the audio file to the GenAI File API uploaded_file = client.files.upload(file='sample.mp3') prompt = 'Generate a transcript of the audio.' response = client.models.generate_content( model="gemini-3.1-flash-lite-preview", contents=[prompt, uploaded_file] ) print(response.text)Attività agentiche e estrazione di dati leggere: estrazione di entità, classificazione e pipeline di elaborazione dei dati leggere supportate con output JSON strutturato. Ad esempio, l'estrazione di dati strutturati da una recensione di un cliente di e-commerce:
from pydantic import BaseModel, Field prompt = "Analyze the user review and determine the aspect, sentiment score, summary quote, and return risk" input_text = "The boots look amazing and the leather is high quality, but they run way too small. I'm sending them back." class ReviewAnalysis(BaseModel): aspect: str = Field(description="The feature mentioned (e.g., Price, Comfort, Style, Shipping)") summary_quote: str = Field(description="The specific phrase from the review about this aspect") sentiment_score: int = Field(description="1 to 5 (1=worst, 5=best)") is_return_risk: bool = Field(description="True if the user mentions returning the item") response = client.models.generate_content( model="gemini-3.1-flash-lite-preview", contents=[prompt, input_text], config={ "response_mime_type": "application/json", "response_json_schema": ReviewAnalysis.model_json_schema(), }, ) print(response.text)Elaborazione e riepilogo dei documenti: analizza i PDF e restituisce riepiloghi concisi, ad esempio per creare una pipeline di elaborazione dei documenti o per eseguire rapidamente il triage dei file in arrivo:
import httpx # Download a sample PDF document doc_url = "https://storage.googleapis.com/generativeai-downloads/data/med_gemini.pdf" doc_data = httpx.get(doc_url).content prompt = "Summarize this document" response = client.models.generate_content( model="gemini-3.1-flash-lite-preview", contents=[ types.Part.from_bytes( data=doc_data, mime_type='application/pdf', ), prompt ] ) print(response.text)Routing dei modelli: utilizza un modello a bassa latenza e a basso costo come classificatore che instrada le query al modello appropriato in base alla complessità dell'attività. Si tratta di un pattern reale in produzione: l'interfaccia a riga di comando di Gemini open source utilizza Flash-Lite per classificare la complessità delle attività e indirizzarle a Flash o Pro di conseguenza.
FLASH_MODEL = 'flash' PRO_MODEL = 'pro' CLASSIFIER_SYSTEM_PROMPT = f""" You are a specialized Task Routing AI. Your sole function is to analyze the user's request and classify its complexity. Choose between `{FLASH_MODEL}` (SIMPLE) or `{PRO_MODEL}` (COMPLEX). 1. `{FLASH_MODEL}`: A fast, efficient model for simple, well-defined tasks. 2. `{PRO_MODEL}`: A powerful, advanced model for complex, open-ended, or multi-step tasks. A task is COMPLEX if it meets ONE OR MORE of the following criteria: 1. High Operational Complexity (Est. 4+ Steps/Tool Calls) 2. Strategic Planning and Conceptual Design 3. High Ambiguity or Large Scope 4. Deep Debugging and Root Cause Analysis A task is SIMPLE if it is highly specific, bounded, and has Low Operational Complexity (Est. 1-3 tool calls). """ user_input = "I'm getting an error 'Cannot read property 'map' of undefined' when I click the save button. Can you fix it?" response_schema = { "type": "object", "properties": { "reasoning": { "type": "string", "description": "A brief, step-by-step explanation for the model choice, referencing the rubric." }, "model_choice": { "type": "string", "enum": [FLASH_MODEL, PRO_MODEL] } }, "required": ["reasoning", "model_choice"] } response = client.models.generate_content( model="gemini-3.1-flash-lite-preview", contents=user_input, config={ "system_instruction": CLASSIFIER_SYSTEM_PROMPT, "response_mime_type": "application/json", "response_json_schema": response_schema }, ) print(response.text)Thinking: per una maggiore precisione per le attività che traggono vantaggio da un ragionamento passo passo, configura la funzionalità Thinking in modo che il modello utilizzi risorse di calcolo aggiuntive per il ragionamento interno prima di produrre l'output finale:
response = client.models.generate_content( model="gemini-3.1-flash-lite-preview", contents="How does AI work?", config=types.GenerateContentConfig( thinking_config=types.ThinkingConfig(thinking_level="high") ), ) print(response.text)