API-ja Gemini mbështet gjenerimin e përmbajtjes me imazhe, audio, kod, mjete dhe më shumë. Për detaje mbi secilën prej këtyre veçorive, lexoni më tej dhe shikoni kodin shembullor të fokusuar në detyrë, ose lexoni udhëzuesit gjithëpërfshirës.
- Gjenerimi i tekstit
- Vizioni
- Audio
- Vendosje
- Kontekst i gjatë
- Ekzekutimi i kodit
- Modaliteti JSON
- Thirrja e funksionit
- Udhëzimet e sistemit
Metoda: models.generateContent
- Pika e Fundit
- Parametrat e shtegut
- Trupi i kërkesës
- Trupi i përgjigjes
- Fushat e autorizimit
- Shembull kërkese
Gjeneron një përgjigje modeli të dhënë nga një input GenerateContentRequest . Referojuni udhëzuesit të gjenerimit të tekstit për informacion të detajuar mbi përdorimin. Aftësitë e inputit ndryshojnë midis modeleve, duke përfshirë modelet e akorduara. Referojuni udhëzuesit të modelit dhe udhëzuesit të akordimit për detaje.
Pika e Fundit
postohttps: / /generativelanguage.googleapis.com /v1beta /{model=models /*}:generateContentParametrat e shtegut
string model E detyrueshme. Emri i Model që do të përdoret për gjenerimin e përfundimit.
Formati: models/{model} . Merr formën models/{model} .
Trupi i kërkesës
Trupi i kërkesës përmban të dhëna me strukturën e mëposhtme:
tools[]object ( Tool ) Opsionale. Një listë e Tools që Model mund të përdorë për të gjeneruar përgjigjen tjetër.
Një Tool është një pjesë kodi që i mundëson sistemit të bashkëveprojë me sisteme të jashtme për të kryer një veprim, ose një sërë veprimesh, jashtë njohurive dhe fushëveprimit të Model . Tool e mbështetura janë Function dhe codeExecution . Referojuni udhëzuesve të Thirrjes së Funksionit dhe Ekzekutimit të Kodit për të mësuar më shumë.
toolConfigobject ( ToolConfig ) Opsionale. Konfigurimi i mjetit për çdo Tool të specifikuar në kërkesë. Referojuni udhëzuesit të thirrjes së funksionit për një shembull përdorimi.
safetySettings[]object ( SafetySetting ) Opsionale. Një listë e instancave unike SafetySetting për bllokimin e përmbajtjes së pasigurt.
Kjo do të zbatohet në GenerateContentRequest.contents dhe GenerateContentResponse.candidates . Nuk duhet të ketë më shumë se një cilësim për secilin lloj SafetyCategory . API do të bllokojë çdo përmbajtje dhe përgjigje që nuk arrin pragjet e vendosura nga këto cilësime. Kjo listë mbivendos cilësimet fillestare për secilën SafetyCategory të specifikuar në safetyCettings. Nëse nuk ka SafetySetting për një SafetyCategory të caktuar të dhënë në listë, API do të përdorë cilësimin fillestar të sigurisë për atë kategori. Mbështeten kategoritë e dëmit HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT, HARM_CATEGORY_CIVIC_INTEGRITY, HARM_CATEGORY_JAILBREAK. Referojuni udhëzuesit për informacion të detajuar mbi cilësimet e sigurisë në dispozicion. Referojuni gjithashtu udhëzuesit për Sigurinë për të mësuar se si të përfshini konsideratat e sigurisë në aplikacionet tuaja të IA-së.
systemInstructionobject ( Content )Opsionale. Zhvilluesi ka vendosur udhëzimet e sistemit . Aktualisht, vetëm tekst.
generationConfigobject ( GenerationConfig )Opsionale. Opsione konfigurimi për gjenerimin e modelit dhe rezultatet.
string cachedContent Opsionale. Emri i përmbajtjes së ruajtur në memorien e përkohshme që do të përdoret si kontekst për të shërbyer parashikimin. Formati: cachedContents/{cachedContent}
serviceTierenum ( ServiceTier )Opsionale. Niveli i shërbimit të kërkesës.
storebooleanOpsionale. Konfiguron sjelljen e regjistrimit për një kërkesë të caktuar. Nëse vendoset, ai ka përparësi ndaj konfigurimit të regjistrimit në nivel projekti.
Shembull kërkese
Tekst
Python
Node.js
Shko
Guaskë
Java
Imazh
Python
Node.js
Shko
Guaskë
Java
Audio
Python
Node.js
Shko
Guaskë
Video
Python
Node.js
Shko
Guaskë
Python
Shko
Guaskë
Bisedë
Python
Node.js
Shko
Guaskë
Java
Memoria e përkohshme
Python
Node.js
Shko
Model i akorduar
Python
Modaliteti JSON
Python
Node.js
Shko
Guaskë
Java
Ekzekutimi i kodit
Python
Shko
Java
Thirrja e funksionit
Python
Shko
Node.js
Guaskë
Java
Konfigurimi i gjenerimit
Python
Node.js
Shko
Guaskë
Java
Cilësimet e Sigurisë
Python
Node.js
Shko
Guaskë
Java
Udhëzime për Sistemin
Python
Node.js
Shko
Guaskë
Java
Trupi i përgjigjes
Nëse është e suksesshme, trupi i përgjigjes përmban një instancë të GenerateContentResponse .
Metoda: models.streamGenerateContent
- Pika e Fundit
- Parametrat e shtegut
- Trupi i kërkesës
- Trupi i përgjigjes
- Fushat e autorizimit
- Shembull kërkese
Gjeneron një përgjigje të transmetuar nga modeli kur jepet një input GenerateContentRequest .
Pika e Fundit
postohttps: / /generativelanguage.googleapis.com /v1beta /{model=models /*}:streamGenerateContentParametrat e shtegut
string model E detyrueshme. Emri i Model që do të përdoret për gjenerimin e përfundimit.
Formati: models/{model} . Merr formën models/{model} .
Trupi i kërkesës
Trupi i kërkesës përmban të dhëna me strukturën e mëposhtme:
tools[]object ( Tool ) Opsionale. Një listë e Tools që Model mund të përdorë për të gjeneruar përgjigjen tjetër.
Një Tool është një pjesë kodi që i mundëson sistemit të bashkëveprojë me sisteme të jashtme për të kryer një veprim, ose një sërë veprimesh, jashtë njohurive dhe fushëveprimit të Model . Tool e mbështetura janë Function dhe codeExecution . Referojuni udhëzuesve të Thirrjes së Funksionit dhe Ekzekutimit të Kodit për të mësuar më shumë.
toolConfigobject ( ToolConfig ) Opsionale. Konfigurimi i mjetit për çdo Tool të specifikuar në kërkesë. Referojuni udhëzuesit të thirrjes së funksionit për një shembull përdorimi.
safetySettings[]object ( SafetySetting ) Opsionale. Një listë e instancave unike SafetySetting për bllokimin e përmbajtjes së pasigurt.
Kjo do të zbatohet në GenerateContentRequest.contents dhe GenerateContentResponse.candidates . Nuk duhet të ketë më shumë se një cilësim për secilin lloj SafetyCategory . API do të bllokojë çdo përmbajtje dhe përgjigje që nuk arrin pragjet e vendosura nga këto cilësime. Kjo listë mbivendos cilësimet fillestare për secilën SafetyCategory të specifikuar në safetyCettings. Nëse nuk ka SafetySetting për një SafetyCategory të caktuar të dhënë në listë, API do të përdorë cilësimin fillestar të sigurisë për atë kategori. Mbështeten kategoritë e dëmit HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT, HARM_CATEGORY_CIVIC_INTEGRITY, HARM_CATEGORY_JAILBREAK. Referojuni udhëzuesit për informacion të detajuar mbi cilësimet e sigurisë në dispozicion. Referojuni gjithashtu udhëzuesit për Sigurinë për të mësuar se si të përfshini konsideratat e sigurisë në aplikacionet tuaja të IA-së.
systemInstructionobject ( Content )Opsionale. Zhvilluesi ka vendosur udhëzimet e sistemit . Aktualisht, vetëm tekst.
generationConfigobject ( GenerationConfig )Opsionale. Opsione konfigurimi për gjenerimin e modelit dhe rezultatet.
string cachedContent Opsionale. Emri i përmbajtjes së ruajtur në memorien e përkohshme që do të përdoret si kontekst për të shërbyer parashikimin. Formati: cachedContents/{cachedContent}
serviceTierenum ( ServiceTier )Opsionale. Niveli i shërbimit të kërkesës.
storebooleanOpsionale. Konfiguron sjelljen e regjistrimit për një kërkesë të caktuar. Nëse vendoset, ai ka përparësi ndaj konfigurimit të regjistrimit në nivel projekti.
Shembull kërkese
Tekst
Python
Node.js
Shko
Guaskë
Java
Imazh
Python
Node.js
Shko
Guaskë
Java
Audio
Python
Shko
Guaskë
Video
Python
Node.js
Shko
Guaskë
Python
Shko
Guaskë
Bisedë
Python
Node.js
Shko
Guaskë
Trupi i përgjigjes
Nëse është i suksesshëm, trupi i përgjigjes përmban një rrjedhë instancash GenerateContentResponse .
GjeneroniPërgjigjePërmbajtjeje
Përgjigje nga modeli që mbështet përgjigje të shumëfishta kandidate.
Vlerësimet e sigurisë dhe filtrimi i përmbajtjes raportohen si për kërkesën në GenerateContentResponse.prompt_feedback ashtu edhe për secilin kandidat në finishReason dhe në safetyRatings . API: - Kthen ose të gjithë kandidatët e kërkuar ose asnjërin prej tyre - Nuk kthen asnjë kandidat vetëm nëse ka pasur diçka të gabuar me kërkesën (kontrolloni promptFeedback ) - Raporton reagime mbi secilin kandidat në finishReason dhe safetyRatings .
candidates[]object ( Candidate )Përgjigjet e kandidatëve nga modeli.
promptFeedbackobject ( PromptFeedback )Kthen reagimin e kërkesës në lidhje me filtrat e përmbajtjes.
usageMetadataobject ( UsageMetadata )Vetëm rezultate. Meta të dhëna mbi përdorimin e tokenëve nga kërkesat e gjenerimit.
string modelVersionVetëm rezultati. Versioni i modelit i përdorur për të gjeneruar përgjigjen.
string ID- responseIdVetëm rezultat. responseId përdoret për të identifikuar çdo përgjigje.
modelStatusobject ( ModelStatus )Vetëm rezultati. Statusi aktual i modelit të këtij modeli.
| Përfaqësimi JSON |
|---|
{ "candidates": [ { object ( |
Reagime të Shpejta
Një grup meta të dhënash reagimi të specifikuara në GenerateContentRequest.content .
blockReasonenum ( BlockReason )Opsionale. Nëse vendoset, kërkesa është bllokuar dhe nuk janë kthyer kandidatë. Riformulojeni kërkesën.
safetyRatings[]object ( SafetyRating )Vlerësime për sigurinë e kërkesës. Ka maksimumi një vlerësim për kategori.
| Përfaqësimi JSON |
|---|
{ "blockReason": enum ( |
BlockReason
Specifikon arsyen pse kërkesa u bllokua.
| Numërime | |
|---|---|
BLOCK_REASON_UNSPECIFIED | Vlerë e parazgjedhur. Kjo vlerë nuk përdoret. |
SAFETY | Kërkesa u bllokua për arsye sigurie. Inspektoni safetyRatings për të kuptuar se cila kategori sigurie e bllokoi atë. |
OTHER | Kërkesa u bllokua për arsye të panjohura. |
BLOCKLIST | Kërkesa u bllokua për shkak të termave që janë përfshirë nga lista e bllokimit të terminologjisë. |
PROHIBITED_CONTENT | Kërkesa u bllokua për shkak të përmbajtjes së ndaluar. |
IMAGE_SAFETY | Kandidatët u bllokuan për shkak të përmbajtjes së pasigurt të gjenerimit të imazheve. |
PërdorimiMeta të dhëna
Meta të dhëna mbi përdorimin e tokenit të kërkesës së gjenerimit.
integer promptTokenCount Numri i tokenëve në kërkesë. Kur vendoset cachedContent , kjo është ende madhësia totale efektive e kërkesës, që do të thotë se kjo përfshin numrin e tokenëve në përmbajtjen e ruajtur në memorien e përkohshme.
integer cachedContentTokenCountNumri i tokenëve në pjesën e ruajtur në memorje të kërkesës (përmbajtja e ruajtur në memorje)
integer candidatesTokenCountNumri total i tokenëve në të gjithë kandidatët e përgjigjeve të gjeneruara.
integer toolUsePromptTokenCountVetëm rezultat. Numri i tokenëve të pranishëm në kërkesën/kërkesat e përdorimit të mjetit.
thoughtsTokenCountintegerVetëm rezultati. Numri i tokenëve të mendimeve për modelet e të menduarit.
totalTokenCountintegerNumri total i tokenëve për kërkesën e gjenerimit (kërkesa + mendimet + kandidatët për përgjigje).
promptTokensDetails[]object ( ModalityTokenCount )Vetëm rezultati. Lista e modaliteteve që u përpunuan në të dhënat hyrëse të kërkesës.
cacheTokensDetails[]object ( ModalityTokenCount )Vetëm rezultati. Lista e modaliteteve të përmbajtjes së ruajtur në memorien e përkohshme në të dhënat hyrëse të kërkesës.
candidatesTokensDetails[]object ( ModalityTokenCount )Vetëm rezultati. Lista e modaliteteve që u kthyen në përgjigje.
toolUsePromptTokensDetails[]object ( ModalityTokenCount )Vetëm rezultate. Lista e modaliteteve që u përpunuan për hyrjet e kërkesave për përdorimin e mjetit.
serviceTierenum ( ServiceTier )Vetëm rezultate. Niveli i shërbimit të kërkesës.
| Përfaqësimi JSON |
|---|
{ "promptTokenCount": integer, "cachedContentTokenCount": integer, "candidatesTokenCount": integer, "toolUsePromptTokenCount": integer, "thoughtsTokenCount": integer, "totalTokenCount": integer, "promptTokensDetails": [ { object ( |
Statusi i Modelit
Statusi i modelit bazë. Kjo përdoret për të treguar fazën e modelit bazë dhe kohën e daljes nga përdorimi, nëse është e aplikueshme.
modelStageenum ( ModelStage )Faza e modelit themelor.
retirementTimestring ( Timestamp format)Koha në të cilën modeli do të hiqet nga përdorimi.
Përdor RFC 3339, ku rezultati i gjeneruar do të jetë gjithmonë i normalizuar sipas Z-së dhe do të përdorë 0, 3, 6 ose 9 shifra thyesore. Pranohen edhe zhvendosje të tjera përveç "Z". Shembuj: "2014-10-02T15:01:23Z" , "2014-10-02T15:01:23.045123456Z" ose "2014-10-02T15:01:23+05:30" .
string messageNjë mesazh që shpjegon statusin e modelit.
| Përfaqësimi JSON |
|---|
{
"modelStage": enum ( |
ModelStage
Përcakton fazën e modelit themelor.
| Numërime | |
|---|---|
MODEL_STAGE_UNSPECIFIED | Fazë modeli e papërcaktuar. |
UNSTABLE_EXPERIMENTAL | Modeli bazë i nënshtrohet shumë rregullimeve. |
EXPERIMENTAL | Modelet në këtë fazë janë vetëm për qëllime eksperimentale. |
PREVIEW | Modelet në këtë fazë janë më të pjekura se modelet eksperimentale. |
STABLE | Modelet në këtë fazë konsiderohen të qëndrueshme dhe gati për përdorim në prodhim. |
LEGACY | Nëse modeli është në këtë fazë, kjo do të thotë se ky model është në rrugën e daljes nga përdorimi në të ardhmen e afërt. Vetëm klientët ekzistues mund ta përdorin këtë model. |
DEPRECATED | Modelet në këtë fazë janë të vjetruara. Këto modele nuk mund të përdoren. |
RETIRED | Modelet në këtë fazë janë tërhequr. Këto modele nuk mund të përdoren. |
Kandidat
- Përfaqësimi JSON
- Arsyeja e Fundit
- Atribuimi i Tokëzimit
- ID e Burimit të Atribuimit
- Identifikuesi i Kalimit të Tokës
- SemanticRetrieverChunk
- Metadata e Grounding
- SearchEntryPoint
- GroundingChunk
- Uebi
- Imazh
- Konteksti i Marrë
- Meta të dhëna të personalizuara
- Lista e vargjeve
- Hartat
- Burimet e Përgjigjeve të Vendit
- Fragment Rishikimi
- Mbështetje për Tokëzim
- Segmenti
- Metadata e Rikthimit
- Rezultati i problemeve të regjistrimit
- Kandidatët Kryesorë
- Kandidat
- Metadata e Kontekstit Url
- Metadata Url
- Statusi i Rikthimit të Url-së
Një kandidat për përgjigje i gjeneruar nga modeli.
contentobject ( Content )Vetëm rezultat. Përmbajtja e gjeneruar u kthye nga modeli.
finishReasonenum ( FinishReason )Opsionale. Vetëm dalje. Arsyeja pse modeli ndaloi gjenerimin e tokenëve.
Nëse është bosh, modeli nuk ka ndaluar së gjeneruari tokena.
safetyRatings[]object ( SafetyRating )Lista e vlerësimeve për sigurinë e një kandidati për përgjigje.
Ka maksimumi një vlerësim për kategori.
citationMetadataobject ( CitationMetadata )Vetëm rezultate. Informacion mbi citatin për kandidatin e gjeneruar nga modeli.
Kjo fushë mund të mbushet me informacion recitimi për çdo tekst të përfshirë në content . Këto janë pasazhe që "recitohen" nga materiali i mbrojtur me të drejta autori në të dhënat e trajnimit të LLM-së themelore.
integer tokenCountVetëm rezultate. Numri i tokenëve për këtë kandidat.
groundingAttributions[]object ( GroundingAttribution )Vetëm rezultate. Informacion mbi atribuimin për burimet që kontribuan në një përgjigje të bazuar.
Kjo fushë plotësohet për thirrjet GenerateAnswer .
groundingMetadataobject ( GroundingMetadata )Vetëm rezultate. Metadata bazë për kandidatin.
Kjo fushë plotësohet për thirrjet GenerateContent .
number avgLogprobsVetëm rezultati. Rezultati mesatar i probabilitetit logaritmik të kandidatit.
logprobsResultobject ( LogprobsResult )Vetëm rezultate. Rezultatet e gjasës logaritmike për tokenët e përgjigjes dhe tokenët kryesorë
urlContextMetadataobject ( UrlContextMetadata )Vetëm rezultate. Meta të dhëna që lidhen me mjetin e rikthimit të kontekstit të url-së.
indexintegerVetëm rezultati. Indeksi i kandidatit në listën e kandidatëve të përgjigjes.
string finishMessage Opsionale. Vetëm rezultat. Detajon arsyen pse modeli ndaloi gjenerimin e tokenëve. Kjo plotësohet vetëm kur është vendosur finishReason .
| Përfaqësimi JSON |
|---|
{ "content": { object ( |
Arsyeja e Fundit
Përcakton arsyen pse modeli ndaloi gjenerimin e tokenëve.
| Numërime | |
|---|---|
FINISH_REASON_UNSPECIFIED | Vlerë e parazgjedhur. Kjo vlerë nuk përdoret. |
STOP | Pika natyrale e ndalimit të modelit ose sekuenca e dhënë e ndalimit. |
MAX_TOKENS | U arrit numri maksimal i tokenëve të specifikuar në kërkesë. |
SAFETY | Përmbajtja e kandidatit për përgjigje u raportua për arsye sigurie. |
RECITATION | Përmbajtja e kandidatit për përgjigje u sinjalizua për arsye recitimi. |
LANGUAGE | Përmbajtja e kandidatit për përgjigje u raportua për përdorim të një gjuhe të pambështetur. |
OTHER | Arsye e panjohur. |
BLOCKLIST | Gjenerimi i tokenëve ndaloi sepse përmbajtja përmban terma të ndaluar. |
PROHIBITED_CONTENT | Gjenerimi i tokenëve u ndalua për shkak se përmbante përmbajtje të ndaluar. |
SPII | Gjenerimi i tokenëve ndaloi sepse përmbajtja potencialisht përmban Informacion Personal të Identifikueshëm të Ndjeshëm (SPII). |
MALFORMED_FUNCTION_CALL | Thirrja e funksionit e gjeneruar nga modeli është e pavlefshme. |
IMAGE_SAFETY | Gjenerimi i tokenëve ndaloi sepse imazhet e gjeneruara përmbajnë shkelje të sigurisë. |
IMAGE_PROHIBITED_CONTENT | Gjenerimi i imazheve ndaloi sepse imazhet e gjeneruara kanë përmbajtje tjetër të ndaluar. |
IMAGE_OTHER | Gjenerimi i imazheve u ndal për shkak të problemeve të tjera të ndryshme. |
NO_IMAGE | Modeli pritej të gjeneronte një imazh, por asnjë nuk u gjenerua. |
IMAGE_RECITATION | Gjenerimi i imazheve u ndal për shkak të recitimit. |
UNEXPECTED_TOOL_CALL | Modeli gjeneroi një thirrje mjeti, por asnjë mjet nuk u aktivizua në kërkesë. |
TOO_MANY_TOOL_CALLS | Modeli thirri shumë mjete radhazi, kështu që sistemi doli nga ekzekutimi. |
MISSING_THOUGHT_SIGNATURE | Kërkesës i mungon të paktën një nënshkrim mendimi. |
MALFORMED_RESPONSE | Përfundoi për shkak të një përgjigjeje të keqformuar. |
ESCALATION | Kërkesa u filtrua nga një rregull përshkallëzimi. |
Atribuimi i Tokëzimit
Atribuimi për një burim që kontribuoi në një përgjigje.
sourceIdobject ( AttributionSourceId )Vetëm rezultati. Identifikues për burimin që kontribuon në këtë atribuim.
contentobject ( Content )Përmbajtja e burimit bazë që përbën këtë atribuim.
| Përfaqësimi JSON |
|---|
{ "sourceId": { object ( |
ID e Burimit të Atribuimit
Identifikues për burimin që kontribuon në këtë atribuim.
Union type sourcesource mund të jetë vetëm një nga të mëposhtmet: groundingPassageobject ( GroundingPassageId )Identifikues për një pasazh të brendshëm.
semanticRetrieverChunkobject ( SemanticRetrieverChunk ) Identifikues për një Chunk të marrë nëpërmjet Semantic Retriever.
| Përfaqësimi JSON |
|---|
{ // source "groundingPassage": { object ( |
Identifikuesi i Kalimit të Tokës
Identifikues për një pjesë brenda një GroundingPassage .
string passageId Vetëm rezultati. ID e pasazhit që përputhet me GroundingPassage.id të GenerateAnswerRequest .
integer partIndex Vetëm rezultati. Indeksi i pjesës brenda GroundingPassage.content të GenerateAnswerRequest .
| Përfaqësimi JSON |
|---|
{ "passageId": string, "partIndex": integer } |
SemanticRetrieverChunk
Identifikues për një Chunk të marrë nëpërmjet Semantic Retriever të specifikuar në GenerateAnswerRequest duke përdorur SemanticRetrieverConfig .
sourcestring Vetëm rezultati. Emri i burimit që përputhet me SemanticRetrieverConfig.source të kërkesës. Shembull: corpora/123 ose corpora/123/documents/abc
chunkstring Vetëm rezultati. Emri i Chunk që përmban tekstin e atribuuar. Shembull: corpora/123/documents/abc/chunks/xyz
| Përfaqësimi JSON |
|---|
{ "source": string, "chunk": string } |
Metadata e Grounding
Meta të dhënat i kthehen klientit kur aktivizohet tokëzimi.
groundingChunks[]object ( GroundingChunk )Lista e referencave mbështetëse të marra nga burimi i specifikuar i tokëzimit. Gjatë transmetimit, kjo përmban vetëm pjesët e tokëzimit që nuk janë përfshirë në meta të dhënat e tokëzimit të përgjigjeve të mëparshme.
groundingSupports[]object ( GroundingSupport )Lista e mbështetjes së tokëzimit.
webSearchQueries[]stringPyetje kërkimi në internet për kërkimin pasues në internet.
string imageSearchQueries[]Pyetjet e kërkimit të imazheve të përdorura për tokëzimin.
searchEntryPointobject ( SearchEntryPoint )Opsionale. Hyrje kërkimi në Google për kërkimet pasuese në internet.
retrievalMetadataobject ( RetrievalMetadata )Meta të dhënat që lidhen me rikuperimin në rrjedhën e tokëzimit.
string googleMapsWidgetContextTokenOpsionale. Emri i burimit të tokenit të kontekstit të vegël Google Maps që mund të përdoret me vegël PlacesContextElement për të paraqitur të dhëna kontekstuale. Plotësohet vetëm në rast se është aktivizuar bazamenti me Google Maps.
| Përfaqësimi JSON |
|---|
{ "groundingChunks": [ { object ( |
SearchEntryPoint
Pika hyrëse e kërkimit në Google.
string renderedContentOpsionale. Fragment përmbajtjeje uebi që mund të integrohet në një faqe uebi ose në një pamje uebi të aplikacionit.
sdkBlobstring ( bytes format)Opsionale. JSON i koduar me Base64 që përfaqëson një varg të tuple-it <term kërkimi, url kërkimi>.
Një varg i koduar me base64.
| Përfaqësimi JSON |
|---|
{ "renderedContent": string, "sdkBlob": string } |
GroundingChunk
Një GroundingChunk përfaqëson një segment të provave mbështetëse që mbështesin përgjigjen e modelit. Mund të jetë një pjesë nga uebi, një kontekst i marrë nga një skedar ose informacion nga Google Maps.
Union type chunk_typechunk_type mund të jetë vetëm një nga të mëposhtmet:webobject ( Web )Një copë tokëzimi nga rrjeti.
imageobject ( Image )Opsionale. Pjesë e tokëzimit nga kërkimi i imazhit.
retrievedContextobject ( RetrievedContext )Opsionale. Pjesa e tokëzimit nga konteksti e marrë nga mjeti i kërkimit të skedarëve.
mapsobject ( Maps )Opsionale. Pjesë tokëzimi nga Google Maps.
| Përfaqësimi JSON |
|---|
{ // chunk_type "web": { object ( |
Uebi
Pjesë nga uebi.
uristringVetëm rezultati. Referenca URI e copës.
string titleVetëm rezultati. Titulli i pjesës.
| Përfaqësimi JSON |
|---|
{ "uri": string, "title": string } |
Imazh
Pjesë nga kërkimi i imazheve.
string sourceUriURI-ja e faqes së internetit për atribuim.
string imageUriURL-ja e aseteve të imazhit.
string titleTitulli i faqes së internetit nga e cila është imazhi.
string domainDomeni rrënjë i faqes së internetit nga e cila është imazhi, p.sh. "example.com".
| Përfaqësimi JSON |
|---|
{ "sourceUri": string, "imageUri": string, "title": string, "domain": string } |
Konteksti i Marrë
Pjesë nga konteksti e marrë nga mjeti i kërkimit të skedarëve.
customMetadata[]object ( CustomMetadata )Opsionale. Meta të dhëna të ofruara nga përdoruesi rreth kontekstit të marrë.
uristringOpsionale. Referenca URI e dokumentit të rikthimit semantik.
string titleOpsionale. Titulli i dokumentit.
string textOpsionale. Teksti i pjesës.
string fileSearchStore Opsionale. Emri i FileSearchStore që përmban dokumentin. Shembull: fileSearchStores/123
integer pageNumberOpsionale. Numri i faqes së kontekstit të gjetur, nëse është i aplikueshëm.
mediaIdstringOpsionale. Emri i burimit media blob për rezultatet e kërkimit të skedarëve multimodalë. Formati: fileSearchStores/{file_search_store_id}/media/{blobId}
| Përfaqësimi JSON |
|---|
{
"customMetadata": [
{
object ( |
Meta të dhëna të personalizuara
Përdoruesi dha meta të dhëna rreth GroundingFact.
keystringÇelësi i meta të dhënave.
Union type valuevalue mund të jetë vetëm një nga të mëposhtmet: stringValuestringOpsionale. Vlera e vargut të meta të dhënave.
stringListValueobject ( StringList )Opsionale. Një listë vlerash vargjesh për metadatat.
numericValuenumber Opsionale. Vlera numerike e meta të dhënave. Diapazoni i pritur për këtë vlerë varet nga key specifik i përdorur.
| Përfaqësimi JSON |
|---|
{
"key": string,
// value
"stringValue": string,
"stringListValue": {
object ( |
Lista e vargjeve
Një listë me vlera të vargjeve.
string values[]Vlerat e vargut të listës.
| Përfaqësimi JSON |
|---|
{ "values": [ string ] } |
Hartat
Një pjesë e lidhjes së tokës nga Google Maps. Një pjesë e Maps korrespondon me një vend të vetëm.
uristringReferenca URI e vendit.
string titleTitulli i vendit.
string textPërshkrim me tekst i përgjigjes së vendit.
string placeId ID-ja e vendit, në formatin places/{placeId} . Një përdorues mund ta përdorë këtë ID për të kërkuar atë vend.
placeAnswerSourcesobject ( PlaceAnswerSources )Burime që ofrojnë përgjigje rreth karakteristikave të një vendi të caktuar në Google Maps.
| Përfaqësimi JSON |
|---|
{
"uri": string,
"title": string,
"text": string,
"placeId": string,
"placeAnswerSources": {
object ( |
Burimet e Përgjigjeve të Vendit
Përmbledhje burimesh që ofrojnë përgjigje rreth karakteristikave të një vendi të caktuar në Google Maps. Çdo mesazh i PlaceAnswerSources korrespondon me një vend specifik në Google Maps. Mjeti Google Maps përdori këto burime për t'iu përgjigjur pyetjeve rreth karakteristikave të vendit (p.sh.: "a ka Bar Foo Wifi" ose "a është Foo Bar i arritshëm për karroca me rrota?"). Aktualisht ne mbështesim vetëm fragmente rishikimesh si burime.
reviewSnippets[]object ( ReviewSnippet )Fragmente të vlerësimeve që përdoren për të gjeneruar përgjigje rreth karakteristikave të një vendi të caktuar në Google Maps.
| Përfaqësimi JSON |
|---|
{
"reviewSnippets": [
{
object ( |
Fragment Rishikimi
Përmban një fragment të një vlerësimi përdoruesi që përgjigjet një pyetjeje në lidhje me veçoritë e një vendi specifik në Google Maps.
string i ID-së reviewIdID-ja e fragmentit të rishikimit.
string googleMapsUriNjë lidhje që korrespondon me vlerësimin e përdoruesit në Google Maps.
string titleTitulli i rishikimit.
| Përfaqësimi JSON |
|---|
{ "reviewId": string, "googleMapsUri": string, "title": string } |
Mbështetje për Tokëzim
Mbështetje për tokëzim.
groundingChunkIndices[]integer Opsionale. Një listë indeksesh (në 'grounding_chunk' në response.candidate.grounding_metadata ) që specifikojnë citimet e shoqëruara me pretendimin. Për shembull [1,3,4] do të thotë që grounding_chunk[1], grounding_chunk[3], grounding_chunk[4] janë përmbajtja e marrë që i atribuohet pretendimit. Nëse përgjigja është duke u transmetuar, indekset groundingChunk i referohen indekseve në të gjitha përgjigjet. Është përgjegjësi e klientit të grumbullojë pjesët e tokëzimit nga të gjitha përgjigjet (duke ruajtur të njëjtin rend).
number confidenceScores[]Opsionale. Rezultati i besimit të referencave të mbështetjes. Varion nga 0 në 1. 1 është më i besueshmi. Kjo listë duhet të ketë të njëjtën madhësi si groundingChunkIndices.
renderedParts[]integer Vetëm rezultate. Indekson në fushën e parts të përmbajtjes së kandidatit. Këta indekse specifikojnë se cilat pjesë të renderuara janë të lidhura me këtë burim mbështetjeje.
segmentobject ( Segment )Segmenti i përmbajtjes të cilit i përket kjo mbështetje.
| Përfaqësimi JSON |
|---|
{
"groundingChunkIndices": [
integer
],
"confidenceScores": [
number
],
"renderedParts": [
integer
],
"segment": {
object ( |
Segmenti
Segment i përmbajtjes.
integer partIndexIndeksi i një objekti Part brenda objektit të tij mëmë Content.
integer startIndexIndeksi fillestar në Pjesën e dhënë, i matur në bajt. Zhvendosje nga fillimi i Pjesës, përfshirëse, duke filluar nga zero.
endIndexintegerIndeksi i fundit në Pjesën e dhënë, i matur në bajt. Zhvendosje nga fillimi i Pjesës, përjashtuese, duke filluar nga zero.
string textTeksti që korrespondon me segmentin nga përgjigjja.
| Përfaqësimi JSON |
|---|
{ "partIndex": integer, "startIndex": integer, "endIndex": integer, "text": string } |
Metadata e Rikthimit
Meta të dhënat që lidhen me rikuperimin në rrjedhën e tokëzimit.
number googleSearchDynamicRetrievalScoreOpsionale. Rezultati që tregon se sa të mundshme janë informacionet nga kërkimi në Google që mund të ndihmojnë në përgjigjen e pyetjes. Rezultati është në diapazonin [0, 1], ku 0 është më pak e mundshme dhe 1 është më e mundshme. Ky rezultat plotësohet vetëm kur aktivizohet bazamenti i kërkimit në Google dhe rikthimi dinamik. Do të krahasohet me pragun për të përcaktuar nëse do të aktivizohet kërkimi në Google.
| Përfaqësimi JSON |
|---|
{ "googleSearchDynamicRetrievalScore": number } |
Rezultati i problemeve të regjistrimit
Rezultati i Logprobs
topCandidates[]object ( TopCandidates )Gjatësia = numri total i hapave të dekodimit.
chosenCandidates[]object ( Candidate )Gjatësia = numri total i hapave të dekodimit. Kandidatët e zgjedhur mund të jenë ose jo në listën e kandidatëve kryesorë.
number logProbabilitySumShuma e probabiliteteve logaritmike për të gjitha tokenët.
| Përfaqësimi JSON |
|---|
{ "topCandidates": [ { object ( |
Kandidatët Kryesorë
Kandidatët me probabilitete logaritmike më të larta në çdo hap dekodifikimi.
candidates[]object ( Candidate )Renditur sipas probabilitetit logaritmik në rend zbritës.
| Përfaqësimi JSON |
|---|
{
"candidates": [
{
object ( |
Kandidat
Kandidat për shenjën dhe rezultatin logprobs.
string tokenVlera e vargut të tokenit të kandidatit.
integer tokenIdVlera e identifikimit të tokenit të kandidatit.
number logProbabilityProbabiliteti logaritmik i kandidatit.
| Përfaqësimi JSON |
|---|
{ "token": string, "tokenId": integer, "logProbability": number } |
Metadata e Kontekstit Url
Meta të dhëna që lidhen me mjetin e rikthimit të kontekstit të URL-së.
urlMetadata[]object ( UrlMetadata )Lista e kontekstit të URL-së.
| Përfaqësimi JSON |
|---|
{
"urlMetadata": [
{
object ( |
Metadata Url
Konteksti i rikthimit të një URL-je të vetme.
retrievedUrlstring marrëURL-ja u mor nga mjeti.
urlRetrievalStatusenum ( UrlRetrievalStatus )Statusi i rikthimit të URL-së.
| Përfaqësimi JSON |
|---|
{
"retrievedUrl": string,
"urlRetrievalStatus": enum ( |
Statusi i Rikthimit të Url-së
Statusi i rikthimit të URL-së.
| Numërime | |
|---|---|
URL_RETRIEVAL_STATUS_UNSPECIFIED | Vlerë e parazgjedhur. Kjo vlerë nuk përdoret. |
URL_RETRIEVAL_STATUS_SUCCESS | Marrja e URL-së është kryer me sukses. |
URL_RETRIEVAL_STATUS_ERROR | Marrja e URL-së dështoi për shkak të një gabimi. |
URL_RETRIEVAL_STATUS_PAYWALL | Marrja e URL-së dështoi sepse përmbajtja është pas murit të pagesës. |
URL_RETRIEVAL_STATUS_UNSAFE | Marrja e URL-së dështoi sepse përmbajtja është e pasigurt. |
Meta të dhënat e citimeve
Një koleksion i atribuimeve të burimit për një pjesë të përmbajtjes.
citationSources[]object ( CitationSource )Citime nga burime për një përgjigje specifike.
| Përfaqësimi JSON |
|---|
{
"citationSources": [
{
object ( |
Burimi i Citimit
Një citim nga një burim për një pjesë të një përgjigjeje specifike.
integer startIndexOpsionale. Fillimi i segmentit të përgjigjes që i atribuohet këtij burimi.
Indeksi tregon fillimin e segmentit, i matur në bajt.
endIndexintegerOpsionale. Fundi i segmentit të atribuuar, përjashtues.
uristringOpsionale. URI që i atribuohet si burim për një pjesë të tekstit.
string licenseOpsionale. Licencë për projektin GitHub që i atribuohet si burim për segmentin.
Informacioni i licencës kërkohet për citimet e kodit.
| Përfaqësimi JSON |
|---|
{ "startIndex": integer, "endIndex": integer, "uri": string, "license": string } |
Kategoria e Dëmit
Kategoria e një vlerësimi.
Këto kategori mbulojnë lloje të ndryshme dëmesh që zhvilluesit mund të dëshirojnë të rregullojnë.
| Numërime | |
|---|---|
HARM_CATEGORY_UNSPECIFIED | Kategoria është e paspecifikuar. |
HARM_CATEGORY_DEROGATORY | PaLM - Komente negative ose të dëmshme që synojnë identitetin dhe/ose atributin e mbrojtur. |
HARM_CATEGORY_TOXICITY | PaLM - Përmbajtje e pasjellshme, mungesë respekti ose profane. |
HARM_CATEGORY_VIOLENCE | PaLM - Përshkruan skenarë që përshkruajnë dhunën kundër një individi ose grupi, ose përshkrime të përgjithshme të gjakderdhjes. |
HARM_CATEGORY_SEXUAL | PaLM - Përmban referenca për akte seksuale ose përmbajtje të tjera të turpshme. |
HARM_CATEGORY_MEDICAL | PaLM - Promovon këshilla mjekësore të pakontrolluara. |
HARM_CATEGORY_DANGEROUS | PaLM - Përmbajtje e rrezikshme që promovon, lehtëson ose inkurajon akte të dëmshme. |
HARM_CATEGORY_HARASSMENT | Binjakët - Përmbajtje ngacmuese. |
HARM_CATEGORY_HATE_SPEECH | Binjakët - Gjuhë dhe përmbajtje urrejtjeje. |
HARM_CATEGORY_SEXUALLY_EXPLICIT | Binjakët - Përmbajtje me përmbajtje seksuale eksplicite. |
HARM_CATEGORY_DANGEROUS_CONTENT | Binjakët - Përmbajtje e rrezikshme. |
HARM_CATEGORY_CIVIC_INTEGRITY | Gemini - Përmbajtje që mund të përdoret për të dëmtuar integritetin qytetar. E JASHTËZAKONSHME: përdorni enableEnhancedCivicAnswers në vend të kësaj. |
HARM_CATEGORY_JAILBREAK | Gemini - Njoftime që përpiqen të anashkalojnë ose përmbysin udhëzimet e sigurisë së modelit (përpjekje për jailbreak). |
ModalityTokenCount
Përfaqëson informacionin e numërimit të tokenëve për një modalitet të vetëm.
modalityenum ( Modality )Modaliteti i lidhur me këtë numër tokenësh.
integer tokenCountNumri i tokenëve.
| Përfaqësimi JSON |
|---|
{
"modality": enum ( |
Modaliteti
Modaliteti i Pjesës së Përmbajtjes
| Numërime | |
|---|---|
MODALITY_UNSPECIFIED | Modalitet i papërcaktuar. |
TEXT | Tekst i thjeshtë. |
IMAGE | Imazh. |
VIDEO | Video. |
AUDIO | Audio. |
DOCUMENT | Dokument, p.sh. PDF. |
Vlerësimi i Sigurisë
Vlerësimi i sigurisë për një pjesë të përmbajtjes.
Vlerësimi i sigurisë përmban kategorinë e dëmit dhe nivelin e probabilitetit të dëmit në atë kategori për një pjesë të përmbajtjes. Përmbajtja klasifikohet për siguri në një numër kategorish dëmi dhe klasifikimi i probabilitetit të dëmit përfshihet këtu.
categoryenum ( HarmCategory )E detyrueshme. Kategoria për këtë vlerësim.
probabilityenum ( HarmProbability )E detyrueshme. Probabiliteti i dëmtimit për këtë përmbajtje.
boolean blockedA u bllokua kjo përmbajtje për shkak të këtij vlerësimi?
| Përfaqësimi JSON |
|---|
{ "category": enum ( |
Probabiliteti i dëmit
Probabiliteti që një pjesë e përmbajtjes të jetë e dëmshme.
Sistemi i klasifikimit jep probabilitetin që përmbajtja të jetë e pasigurt. Kjo nuk tregon ashpërsinë e dëmit për një pjesë të përmbajtjes.
| Numërime | |
|---|---|
HARM_PROBABILITY_UNSPECIFIED | Probabiliteti është i papërcaktuar. |
NEGLIGIBLE | Përmbajtja ka një shans të papërfillshëm për të qenë e pasigurt. |
LOW | Përmbajtja ka një shans të ulët për të qenë e pasigurt. |
MEDIUM | Përmbajtja ka një shans mesatar për të qenë e pasigurt. |
HIGH | Përmbajtja ka një probabilitet të lartë të jetë e pasigurt. |
Cilësimet e Sigurisë
Cilësimi i sigurisë, që ndikon në sjelljen e bllokimit të sigurisë.
Kalimi i një cilësimi sigurie për një kategori ndryshon probabilitetin e lejuar që përmbajtja të bllokohet.
categoryenum ( HarmCategory )E detyrueshme. Kategoria për këtë cilësim.
thresholdenum ( HarmBlockThreshold )E detyrueshme. Kontrollon pragun e probabilitetit në të cilin bllokohet dëmi.
| Përfaqësimi JSON |
|---|
{ "category": enum ( |
HarmBlockThreshold
Blloko në dhe përtej një probabiliteti të caktuar dëmtimi.
| Numërime | |
|---|---|
HARM_BLOCK_THRESHOLD_UNSPECIFIED | Pragu është i paspecifikuar. |
BLOCK_LOW_AND_ABOVE | Përmbajtja me NEGLIGIBËL do të lejohet. |
BLOCK_MEDIUM_AND_ABOVE | Përmbajtjet me NGA TË PAPËRFILLSHMET dhe TË ULËTA do të lejohen. |
BLOCK_ONLY_HIGH | Përmbajtje me NGA E PAPËRFILLSHME, E ULËT dhe MESATARE do të lejohet. |
BLOCK_NONE | I gjithë përmbajtja do të lejohet. |
OFF | Fikni filtrin e sigurisë. |
Niveli i Shërbimit
Niveli i shërbimit të kërkesës.
| Numërime | |
|---|---|
unspecified | Niveli i parazgjedhur i shërbimit, i cili është standard. |
standard | Niveli standard i shërbimit. |
flex | Niveli i shërbimit fleksibël. |
priority | Niveli i shërbimit me përparësi. |
Përmbajtja
- Përfaqësimi JSON
- Pjesë
- Pikë
- Thirrja e Funksionit
- FunksioniPërgjigja
- FunctionResponsePjesa
- FunksioniResponseBlob
- Planifikimi
- Të Dhënat e Skedarit
- Kodi i Ekzekutueshëm
- Gjuha
- Rezultati i Ekzekutimit të Kodit
- Rezultati
- ToolCall
- Lloji i mjetit
- ToolResponse
- Meta të dhëna video
- Rezolucioni i Medias
- Niveli
- Përpunimi i Medias
Lloji i të dhënave të strukturuara bazë që përmban përmbajtje shumëpjesëshe të një mesazhi.
Një Content përfshin një fushë role që përcakton prodhuesin e Content dhe një fushë parts që përmban të dhëna shumëpjesëshe që përmbajnë përmbajtjen e mesazhit të radhës.
parts[]object ( Part ) Parts të renditura që përbëjnë një mesazh të vetëm. Pjesët mund të kenë lloje të ndryshme MIME.
string roleOpsionale. Prodhuesi i përmbajtjes. Duhet të jetë ose 'përdorues' ose 'model'.
E dobishme për t'u vendosur për biseda me shumë kthesa, përndryshe mund të lihet bosh ose e pacaktuar.
| Përfaqësimi JSON |
|---|
{
"parts": [
{
object ( |
Pjesë
Një lloj të dhënash që përmban media që është pjesë e një mesazhi Content me shumë pjesë.
Një Part përbëhet nga të dhëna që kanë një lloj të dhënash të shoqëruar. Një Part mund të përmbajë vetëm një nga llojet e pranuara në Part.data .
Një Part duhet të ketë një lloj fiks IANA MIME që identifikon llojin dhe nëntipin e medias nëse fusha inlineData është e mbushur me bajt të papërpunuar.
thoughtbooleanOpsionale. Tregon nëse pjesa është menduar nga modeli.
thoughtSignaturestring ( bytes format)Opsionale. Një nënshkrim i errët për mendimin në mënyrë që të mund të ripërdoret në kërkesat pasuese.
Një varg i koduar me base64.
partMetadataobject ( Struct format)Meta të dhënat e personalizuara të shoqëruara me Pjesën. Agjentët që përdorin genai.Part si përfaqësim të përmbajtjes mund të kenë nevojë të mbajnë gjurmët e informacionit shtesë. Për shembull, mund të jetë emri i një skedari/burimi nga i cili buron Pjesa ose një mënyrë për të shumëfishuar rrjedha të shumëfishta Pjesësh.
mediaResolutionobject ( MediaResolution )Opsionale. Rezolucioni i medias për median hyrëse.
mediaProcessingenum ( MediaProcessing ) Optional. How the model processes this part's media for understanding. Only meaningful for video parts ( inlineData or fileData with video mime). Non-video parts ignore this field.
dataUnion typedata can be only one of the following:textstringInline text.
inlineDataobject ( Blob )Inline media bytes.
functionCallobject ( FunctionCall ) A predicted FunctionCall returned from the model that contains a string representing the FunctionDeclaration.name with the arguments and their values.
functionResponseobject ( FunctionResponse ) The result output of a FunctionCall that contains a string representing the FunctionDeclaration.name and a structured JSON object containing any output from the function is used as context to the model.
fileDataobject ( FileData )URI based data.
executableCodeobject ( ExecutableCode )Code generated by the model that is meant to be executed.
codeExecutionResultobject ( CodeExecutionResult ) Result of executing the ExecutableCode .
toolCallobject ( ToolCall )Server-side tool call. This field is populated when the model predicts a tool invocation that should be executed on the server. The client is expected to echo this message back to the API.
toolResponseobject ( ToolResponse ) The output from a server-side ToolCall execution. This field is populated by the client with the results of executing the corresponding ToolCall .
metadataUnion typemetadata can be only one of the following:videoMetadataobject ( VideoMetadata )Optional. Video metadata. The metadata should only be specified while the video data is presented in inlineData or fileData.
| JSON representation |
|---|
{ "thought": boolean, "thoughtSignature": string, "partMetadata": { object }, "mediaResolution": { object ( |
Blob
Raw media bytes.
Text should not be sent as raw bytes, use the 'text' field.
mimeTypestringThe IANA standard MIME type of the source data. Examples of supported types: - Images: image/png, image/jpeg, image/jpg, image/webp, image/heic, image/heif, image/gif, image/avif - Audio: audio/*, video/audio/s16le, video/audio/wav - Video: video/* - Text: text/plain, text/html, text/css, text/javascript, text/x-typescript, text/csv, text/markdown, text/x-python, text/xml, text/rtf, video/text/timestamp - Applications: application/x-javascript, application/x-typescript, application/x-python-code, application/json, application/x-ipynb+json, application/rtf, application/pdf For additional context, see Supported file formats . //
datastring ( bytes format)Raw bytes for media formats.
A base64-encoded string.
| JSON representation |
|---|
{ "mimeType": string, "data": string } |
FunctionCall
A predicted FunctionCall returned from the model that contains a string representing the FunctionDeclaration.name with the arguments and their values.
idstring Optional. Unique identifier of the function call. If populated, the client to execute the functionCall and return the response with the matching id .
namestringRequired. The name of the function to call. Must be az, AZ, 0-9, or contain underscores and dashes, with a maximum length of 128.
argsobject ( Struct format)Optional. The function parameters and values in JSON object format.
| JSON representation |
|---|
{ "id": string, "name": string, "args": { object } } |
FunctionResponse
The result output from a FunctionCall that contains a string representing the FunctionDeclaration.name and a structured JSON object containing any output from the function is used as context to the model. This should contain the result of a FunctionCall made based on model prediction.
idstring Optional. The identifier of the function call this response is for. Populated by the client to match the corresponding function call id .
namestringRequired. The name of the function to call. Must be az, AZ, 0-9, or contain underscores and dashes, with a maximum length of 128.
responseobject ( Struct format)Required. The function response in JSON object format. Callers can use any keys of their choice that fit the function's syntax to return the function output, eg "output", "result", etc. In particular, if the function call failed to execute, the response can have an "error" key to return error details to the model.
Multimedia can be included by using a subobject containing a single "$ref" key whose value is the inlineData.display_name of a FunctionResponsePart holding the multimedia. See https://ai.google.dev/gemini-api/docs/function-calling#multimodal .
parts[]object ( FunctionResponsePart ) Optional. Ordered Parts that constitute a function response. Parts may have different IANA MIME types.
willContinueboolean Optional. Signals that function call continues, and more responses will be returned, turning the function call into a generator. Is only applicable to NON_BLOCKING function calls, is ignored otherwise. If set to false, future responses will not be considered. It is allowed to return empty response with willContinue=False to signal that the function call is finished. This may still trigger the model generation. To avoid triggering the generation and finish the function call, additionally set scheduling to SILENT .
schedulingenum ( Scheduling )Optional. Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE.
| JSON representation |
|---|
{ "id": string, "name": string, "response": { object }, "parts": [ { object ( |
FunctionResponsePart
A datatype containing media that is part of a FunctionResponse message.
A FunctionResponsePart consists of data which has an associated datatype. A FunctionResponsePart can only contain one of the accepted types in FunctionResponsePart.data .
A FunctionResponsePart must have a fixed IANA MIME type identifying the type and subtype of the media if the inlineData field is filled with raw bytes.
dataUnion typedata can be only one of the following: inlineDataobject ( FunctionResponseBlob )Inline media bytes.
| JSON representation |
|---|
{
// data
"inlineData": {
object ( |
FunctionResponseBlob
Raw media bytes for function response.
Text should not be sent as raw bytes, use the 'FunctionResponse.response' field.
mimeTypestringThe IANA standard MIME type of the source data. Examples: - image/png - image/jpeg If an unsupported MIME type is provided, an error will be returned. For a complete list of supported types, see Supported file formats .
datastring ( bytes format)Raw bytes for media formats.
A base64-encoded string.
| JSON representation |
|---|
{ "mimeType": string, "data": string } |
Scheduling
Specifies how the response should be scheduled in the conversation.
| Enums | |
|---|---|
SCHEDULING_UNSPECIFIED | This value is unused. |
SILENT | Only add the result to the conversation context, do not interrupt or trigger generation. |
WHEN_IDLE | Add the result to the conversation context, and prompt to generate output without interrupting ongoing generation. |
INTERRUPT | Add the result to the conversation context, interrupt ongoing generation and prompt to generate output. |
FileData
URI based data.
mimeTypestringOptional. The IANA standard MIME type of the source data.
fileUristringRequired. URI.
| JSON representation |
|---|
{ "mimeType": string, "fileUri": string } |
ExecutableCode
Code generated by the model that is meant to be executed, and the result returned to the model.
Only generated when using the CodeExecution tool, in which the code will be automatically executed, and a corresponding CodeExecutionResult will also be generated.
idstring Optional. Unique identifier of the ExecutableCode part. The server returns the CodeExecutionResult with the matching id .
languageenum ( Language ) Required. Programming language of the code .
codestringRequired. The code to be executed.
| JSON representation |
|---|
{
"id": string,
"language": enum ( |
Gjuha
Supported programming languages for the generated code.
| Enums | |
|---|---|
LANGUAGE_UNSPECIFIED | Unspecified language. This value should not be used. |
PYTHON | Python >= 3.10, with numpy and simpy available. Python is the default language. |
CodeExecutionResult
Result of executing the ExecutableCode .
Generated only when the CodeExecution tool is used.
idstring Optional. The identifier of the ExecutableCode part this result is for. Only populated if the corresponding ExecutableCode has an id.
outcomeenum ( Outcome )Required. Outcome of the code execution.
outputstringOptional. Contains stdout when code execution is successful, stderr or other description otherwise.
| JSON representation |
|---|
{
"id": string,
"outcome": enum ( |
Rezultati
Enumeration of possible outcomes of the code execution.
| Enums | |
|---|---|
OUTCOME_UNSPECIFIED | Unspecified status. This value should not be used. |
OUTCOME_OK | Code execution completed successfully. output contains the stdout, if any. |
OUTCOME_FAILED | Code execution failed. output contains the stderr and stdout, if any. |
OUTCOME_DEADLINE_EXCEEDED | Code execution ran for too long, and was cancelled. There may or may not be a partial output present. |
ToolCall
A predicted server-side ToolCall returned from the model. This message contains information about a tool that the model wants to invoke. The client is NOT expected to execute this ToolCall . Instead, the client should pass this ToolCall back to the API in a subsequent turn within a Content message, along with the corresponding ToolResponse .
idstring Optional. Unique identifier of the tool call. The server returns the tool response with the matching id .
toolNamestringOptional. The name of the tool that was called.
toolTypeenum ( ToolType )Required. The type of tool that was called.
argsobject ( Struct format)Optional. The tool call arguments. Example: {"arg1" : "value1", "arg2" : "value2" , ...}
| JSON representation |
|---|
{
"id": string,
"toolName": string,
"toolType": enum ( |
ToolType
The type of tool in the function call.
| Enums | |
|---|---|
TOOL_TYPE_UNSPECIFIED | Unspecified tool type. |
GOOGLE_SEARCH_WEB | Google search tool, maps to Tool.google_search.search_types.web_search. |
GOOGLE_SEARCH_IMAGE | Image search tool, maps to Tool.google_search.search_types.image_search. |
URL_CONTEXT | URL context tool, maps to Tool.url_context. |
GOOGLE_MAPS | Google maps tool, maps to Tool.google_maps. |
FILE_SEARCH | File search tool, maps to Tool.file_search. |
ToolResponse
The output from a server-side ToolCall execution. This message contains the results of a tool invocation that was initiated by a ToolCall from the model. The client should pass this ToolResponse back to the API in a subsequent turn within a Content message, along with the corresponding ToolCall .
idstringOptional. The identifier of the tool call this response is for.
toolTypeenum ( ToolType ) Required. The type of tool that was called, matching the toolType in the corresponding ToolCall .
responseobject ( Struct format)Optional. The tool response.
| JSON representation |
|---|
{
"id": string,
"toolType": enum ( |
VideoMetadata
Deprecated: Use GenerateContentRequest.processing_options instead. Metadata describes the input video content.
startOffsetstring ( Duration format)Optional. The start offset of the video.
A duration in seconds with up to nine fractional digits, ending with ' s '. Example: "3.5s" .
endOffsetstring ( Duration format)Optional. The end offset of the video.
A duration in seconds with up to nine fractional digits, ending with ' s '. Example: "3.5s" .
fpsnumberOptional. The frame rate of the video sent to the model. If not specified, the default value will be 1.0. The fps range is (0.0, 24.0].
| JSON representation |
|---|
{ "startOffset": string, "endOffset": string, "fps": number } |
MediaResolution
Media resolution for tokenization.
valueUnion typevalue can be only one of the following:levelenum ( Level ) The tokenization quality used for given media.
| JSON representation |
|---|
{
// value
"level": enum ( |
Niveli
The media resolution level.
| Enums | |
|---|---|
MEDIA_RESOLUTION_UNSPECIFIED | Media resolution has not been set. |
MEDIA_RESOLUTION_LOW | Media resolution set to low. |
MEDIA_RESOLUTION_MEDIUM | Media resolution set to medium. |
MEDIA_RESOLUTION_HIGH | Media resolution set to high. |
MEDIA_RESOLUTION_ULTRA_HIGH | Media resolution set to ultra high. |
MediaProcessing
How the model processes input media for understanding.
| Enums | |
|---|---|
MEDIA_PROCESSING_UNSPECIFIED | Default. Uses model-specific processing (3.5 Pro+ -> AGENTIC , older models -> STATIC ). |
STATIC | Fixed-rate frame extraction. All frames placed in context. |
AGENTIC | Model-driven dynamic navigation. Recommended for most use cases. |
Mjedisi
An execution environment for an agent.
idstringRequired. Output only. The ID of the environment.
sources[]object ( Source )Sources to be mounted into the environment.
createdstringOutput only. The time at which the environment was created in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
updatedstringOutput only. The time at which the environment was last updated in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
lastAccessedstringOutput only. The time at which the environment was last accessed in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
statusenum ( Status )Output only. The status of the environment container.
fileCountstring ( int64 format)Output only. The number of files in the environment, output only.
sizeBytesstring ( int64 format)Output only. The total size of the environment files in bytes, output only.
networkUnion typenetwork can be only one of the following:networkAllowlistobject ( EnvironmentNetworkEgressAllowlist )Allow only specific domains.
networkModeenum ( NetworkMode )Network egress mode.
| JSON representation |
|---|
{ "id": string, "sources": [ { object ( |
Statusi
Status of the environment.
| Enums | |
|---|---|
STATUS_UNSPECIFIED | |
ACTIVE | |
EXPIRED | |
NetworkMode
Network egress mode for non-allowlist configurations.
| Enums | |
|---|---|
NETWORK_MODE_UNSPECIFIED | Default value. Unused. |
DISABLED | All network egress is blocked. |
Skema
The Schema object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. Represents a select subset of an OpenAPI 3.0 schema object .
typeenum ( Type )Required. Data type.
formatstringOptional. The format of the data. Any value is allowed, but most do not trigger any special functionality.
titlestringOptional. The title of the schema.
descriptionstringOptional. A brief description of the parameter. This could contain examples of use. Parameter description may be formatted as Markdown.
nullablebooleanOptional. Indicates if the value may be null.
enum[]stringOptional. Possible values of the element of Type.STRING with enum format. For example we can define an Enum Direction as : {type:STRING, format:enum, enum:["EAST", NORTH", "SOUTH", "WEST"]}
maxItemsstring ( int64 format)Optional. Maximum number of the elements for Type.ARRAY.
minItemsstring ( int64 format)Optional. Minimum number of the elements for Type.ARRAY.
propertiesmap (key: string, value: object ( Schema ))Optional. Properties of Type.OBJECT.
An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" } .
required[]stringOptional. Required properties of Type.OBJECT.
minPropertiesstring ( int64 format)Optional. Minimum number of the properties for Type.OBJECT.
maxPropertiesstring ( int64 format)Optional. Maximum number of the properties for Type.OBJECT.
minLengthstring ( int64 format)Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the Type.STRING
maxLengthstring ( int64 format)Optional. Maximum length of the Type.STRING
patternstringOptional. Pattern of the Type.STRING to restrict a string to a regular expression.
examplevalue ( Value format)Optional. Example of the object. Will only populated when the object is the root.
anyOf[]object ( Schema )Optional. The value should be validated against any (one or more) of the subschemas in the list.
propertyOrdering[]stringOptional. The order of the properties. Not a standard field in open api spec. Used to determine the order of the properties in the response.
defaultvalue ( Value format) Optional. Default value of the field. Per JSON Schema, this field is intended for documentation generators and doesn't affect validation. Thus it's included here and ignored so that developers who send schemas with a default field don't get unknown-field errors.
itemsobject ( Schema )Optional. Schema of the elements of Type.ARRAY.
minimumnumberOptional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the Type.INTEGER and Type.NUMBER
maximumnumberOptional. Maximum value of the Type.INTEGER and Type.NUMBER
| JSON representation |
|---|
{ "type": enum ( |
Lloji
Type contains the list of OpenAPI data types as defined by https://spec.openapis.org/oas/v3.0.3#data-types
| Enums | |
|---|---|
TYPE_UNSPECIFIED | Not specified, should not be used. |
STRING | String type. |
NUMBER | Number type. |
INTEGER | Integer type. |
BOOLEAN | Boolean type. |
ARRAY | Array type. |
OBJECT | Object type. |
NULL | Null type. |
Mjet
- JSON representation
- FunctionDeclaration
- Behavior
- GoogleSearchRetrieval
- DynamicRetrievalConfig
- Modaliteti
- CodeExecution
- GoogleSearch
- Interval
- SearchTypes
- WebSearch
- ImageSearch
- ComputerUse
- Mjedisi
- SafetyPolicy
- UrlContext
- FileSearch
- McpServer
- StreamableHttpTransport
- GoogleMaps
Tool details that the model may use to generate response.
A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.
Next ID: 17
functionDeclarations[]object ( FunctionDeclaration ) Optional. A list of FunctionDeclarations available to the model that can be used for function calling.
The model or system does not execute the function. Instead the defined function may be returned as a FunctionCall with arguments to the client side for execution. The model may decide to call a subset of these functions by populating FunctionCall in the response. The next conversation turn may contain a FunctionResponse with the Content.role "function" generation context for the next model turn.
googleSearchRetrievalobject ( GoogleSearchRetrieval )Optional. Retrieval tool that is powered by Google search.
codeExecutionobject ( CodeExecution )Optional. Enables the model to execute code as part of generation.
googleSearchobject ( GoogleSearch )Optional. GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google.
computerUseobject ( ComputerUse )Optional. Tool to support the model interacting directly with the computer. If enabled, it automatically populates computer-use specific Function Declarations.
urlContextobject ( UrlContext )Optional. Tool to support URL context retrieval.
fileSearchobject ( FileSearch )Optional. FileSearch tool type. Tool to retrieve knowledge from Semantic Retrieval corpora.
mcpServers[]object ( McpServer )Optional. MCP Servers to connect to.
googleMapsobject ( GoogleMaps )Optional. Tool that allows grounding the model's response with geospatial context related to the user's query.
| JSON representation |
|---|
{ "functionDeclarations": [ { object ( |
FunctionDeclaration
Structured representation of a function declaration as defined by the OpenAPI 3.03 specification . Included in this declaration are the function name and parameters. This FunctionDeclaration is a representation of a block of code that can be used as a Tool by the model and executed by the client.
namestringRequired. The name of the function. Must be az, AZ, 0-9, or contain underscores, colons, dots, and dashes, with a maximum length of 128.
descriptionstringRequired. A brief description of the function.
behaviorenum ( Behavior )Optional. Specifies the function Behavior. Currently only supported by the BidiGenerateContent method.
parametersobject ( Schema )Optional. Describes the parameters to this function. Reflects the Open API 3.03 Parameter Object string Key: the name of the parameter. Parameter names are case sensitive. Schema Value: the Schema defining the type used for the parameter.
parametersJsonSchemavalue ( Value format)Optional. Describes the parameters to the function in JSON Schema format. The schema must describe an object where the properties are the parameters to the function. For example:
{
"type": "object",
"properties": {
"name": { "type": "string" },
"age": { "type": "integer" }
},
"additionalProperties": false,
"required": ["name", "age"],
"propertyOrdering": ["name", "age"]
}
This field is mutually exclusive with parameters .
responseobject ( Schema )Optional. Describes the output from this function in JSON Schema format. Reflects the Open API 3.03 Response Object. The Schema defines the type used for the response value of the function.
responseJsonSchemavalue ( Value format)Optional. Describes the output from this function in JSON Schema format. The value specified by the schema is the response value of the function.
This field is mutually exclusive with response .
Behavior
Defines the function behavior. Defaults to BLOCKING .
| Enums | |
|---|---|
UNSPECIFIED | This value is unused. |
BLOCKING | If set, the system will wait to receive the function response before continuing the conversation. |
NON_BLOCKING | If set, the system will not wait to receive the function response. Instead, it will attempt to handle function responses as they become available while maintaining the conversation between the user and the model. |
GoogleSearchRetrieval
Tool to retrieve public web data for grounding, powered by Google.
dynamicRetrievalConfigobject ( DynamicRetrievalConfig )Specifies the dynamic retrieval configuration for the given source.
| JSON representation |
|---|
{
"dynamicRetrievalConfig": {
object ( |
DynamicRetrievalConfig
Describes the options to customize dynamic retrieval.
modeenum ( Mode )The mode of the predictor to be used in dynamic retrieval.
dynamicThresholdnumberThe threshold to be used in dynamic retrieval. If not set, a system default value is used.
| JSON representation |
|---|
{
"mode": enum ( |
Modaliteti
The mode of the predictor to be used in dynamic retrieval.
| Enums | |
|---|---|
MODE_UNSPECIFIED | Always trigger retrieval. |
MODE_DYNAMIC | Run retrieval only when system decides it is necessary. |
CodeExecution
This type has no fields.
Tool that executes code generated by the model, and automatically returns the result to the model.
See also ExecutableCode and CodeExecutionResult which are only generated when using this tool.
GoogleSearch
GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google.
timeRangeFilterobject ( Interval )Optional. Filter search results to a specific time range. If customers set a start time, they must set an end time (and vice versa).
searchTypesobject ( SearchTypes )Optional. The set of search types to enable. If not set, web search is enabled by default.
| JSON representation |
|---|
{ "timeRangeFilter": { object ( |
Interval
Represents a time interval, encoded as a Timestamp start (inclusive) and a Timestamp end (exclusive).
The start must be less than or equal to the end. When the start equals the end, the interval is empty (matches no time). When both start and end are unspecified, the interval matches any time.
startTimestring ( Timestamp format)Optional. Inclusive start of the interval.
If specified, a Timestamp matching this interval will have to be the same or after the start.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z" , "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30" .
endTimestring ( Timestamp format)Optional. Exclusive end of the interval.
If specified, a Timestamp matching this interval will have to be before the end.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z" , "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30" .
| JSON representation |
|---|
{ "startTime": string, "endTime": string } |
SearchTypes
Different types of search that can be enabled on the GoogleSearch tool.
webSearchobject ( WebSearch )Optional. Enables web search. Only text results are returned.
imageSearchobject ( ImageSearch )Optional. Enables image search. Image bytes are returned.
| JSON representation |
|---|
{ "webSearch": { object ( |
WebSearch
This type has no fields.
Standard web search for grounding and related configurations.
ImageSearch
This type has no fields.
Image search for grounding and related configurations.
ComputerUse
Computer Use tool type.
environmentenum ( Environment )Required. The environment being operated.
excludedPredefinedFunctions[]stringOptional. By default, predefined functions are included in the final model call. Some of them can be explicitly excluded from being automatically included. This can serve two purposes: 1. Using a more restricted / different action space. 2. Improving the definitions / instructions of predefined functions.
enablePromptInjectionDetectionbooleanOptional. Whether enable the prompt injection detection check on computer-use request.
disabledSafetyPolicies[]enum ( SafetyPolicy )Optional. Disabled safety policies for computer use.
| JSON representation |
|---|
{ "environment": enum ( |
Mjedisi
Represents the environment being operated, such as a web browser.
| Enums | |
|---|---|
ENVIRONMENT_UNSPECIFIED | Defaults to browser. |
ENVIRONMENT_BROWSER | Operates in a web browser. |
ENVIRONMENT_MOBILE | Operates in a mobile environment. |
ENVIRONMENT_DESKTOP | Operates in a desktop environment. |
SafetyPolicy
Predefined safety policies for computer use.
| Enums | |
|---|---|
SAFETY_POLICY_UNSPECIFIED | Unspecified safety policy. |
FINANCIAL_TRANSACTIONS | Safety policy for financial transactions. |
SENSITIVE_DATA_MODIFICATION | Safety policy for sensitive data modification. |
COMMUNICATION_TOOL | Safety policy for communication tools (eg Gmail, Chat, Meet). |
ACCOUNT_CREATION | Safety policy for account creation. |
DATA_MODIFICATION | Safety policy for data modification. |
USER_CONSENT_MANAGEMENT | Safety policy for user consent management. |
LEGAL_TERMS_AND_AGREEMENTS | Safety policy for legal terms and agreements. |
UrlContext
This type has no fields.
Tool to support URL context retrieval.
FileSearch
The FileSearch tool that retrieves knowledge from Semantic Retrieval corpora. Files are imported to Semantic Retrieval corpora using the ImportFile API.
fileSearchStoreNames[]string Required. The names of the fileSearchStores to retrieve from. Example: fileSearchStores/my-file-search-store-123
metadataFilterstringOptional. Metadata filter to apply to the semantic retrieval documents and chunks.
topKintegerOptional. The number of semantic retrieval chunks to retrieve.
| JSON representation |
|---|
{ "fileSearchStoreNames": [ string ], "metadataFilter": string, "topK": integer } |
McpServer
A MCPServer is a server that can be called by the model to perform actions. It is a server that implements the MCP protocol. Next ID: 6
namestringThe name of the MCPServer.
transportUnion typetransport can be only one of the following: streamableHttpTransportobject ( StreamableHttpTransport )A transport that can stream HTTP requests and responses.
| JSON representation |
|---|
{
"name": string,
// transport
"streamableHttpTransport": {
object ( |
StreamableHttpTransport
A transport that can stream HTTP requests and responses. Next ID: 6
urlstringThe full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp"
headersmap (key: string, value: string)Optional: Fields for authentication headers, timeouts, etc., if needed.
An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" } .
timeoutstring ( Duration format)HTTP timeout for regular operations.
A duration in seconds with up to nine fractional digits, ending with ' s '. Example: "3.5s" .
sseReadTimeoutstring ( Duration format)Timeout for SSE read operations.
A duration in seconds with up to nine fractional digits, ending with ' s '. Example: "3.5s" .
terminateOnClosebooleanWhether to close the client session when the transport closes.
| JSON representation |
|---|
{ "url": string, "headers": { string: string, ... }, "timeout": string, "sseReadTimeout": string, "terminateOnClose": boolean } |
GoogleMaps
The GoogleMaps Tool that provides geospatial context for the user's query.
enableWidgetbooleanOptional. Whether to return a widget context token in the GroundingMetadata of the response. Developers can use the widget context token to render a Google Maps widget with geospatial context related to the places that the model references in the response.
| JSON representation |
|---|
{ "enableWidget": boolean } |
REST Resource: auth_tokens
- Resource: AuthToken
- BidiGenerateContentSetup
- GenerationConfig
- Modality
- SpeechConfig
- VoiceConfig
- PrebuiltVoiceConfig
- MultiSpeakerVoiceConfig
- SpeakerVoiceConfig
- ThinkingConfig
- ThinkingLevel
- ImageConfig
- MediaResolution
- ResponseFormatConfig
- TextResponseFormat
- MimeType
- AudioResponseFormat
- MimeType
- Dërgim
- ImageResponseFormat
- MimeType
- Dërgim
- AspectRatio
- ImageSize
- TranslationConfig
- AudioTranscriptionConfig
- LanguageAuto
- LanguageHints
- RealtimeInputConfig
- AutomaticActivityDetection
- StartSensitivity
- EndSensitivity
- ActivityHandling
- TurnCoverage
- SessionResumptionConfig
- ContextWindowCompressionConfig
- SlidingWindow
- HistoryConfig
- Metodat
Resource: AuthToken
A request to create an ephemeral authentication token.
namestringOutput only. Identifier. The token itself.
expireTimestring ( Timestamp format)Optional. Input only. Immutable. An optional time after which, when using the resulting token, messages in BidiGenerateContent sessions will be rejected. (Gemini may preemptively close the session after this time.)
If not set then this defaults to 30 minutes in the future. If set, this value must be less than 20 hours in the future.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z" , "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30" .
newSessionExpireTimestring ( Timestamp format)Optional. Input only. Immutable. The time after which new Live API sessions using the token resulting from this request will be rejected.
If not set this defaults to 60 seconds in the future. If set, this value must be less than 20 hours in the future.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z" , "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30" .
fieldMaskstring ( FieldMask format) Optional. Input only. Immutable. If fieldMask is empty, and bidiGenerateContentSetup is not present, then the effective BidiGenerateContentSetup message is taken from the Live API connection.
If fieldMask is empty, and bidiGenerateContentSetup is present, then the effective BidiGenerateContentSetup message is taken entirely from bidiGenerateContentSetup in this request. The setup message from the Live API connection is ignored.
If fieldMask is not empty, then the corresponding fields from bidiGenerateContentSetup will overwrite the fields from the setup message in the Live API connection.
This is a comma-separated list of fully qualified names of fields. Example: "user.displayName,photo" .
configUnion typeconfig can be only one of the following: bidiGenerateContentSetupobject ( BidiGenerateContentSetup ) Optional. Input only. Immutable. Configuration specific to BidiGenerateContent .
usesintegerOptional. Input only. Immutable. The number of times the token can be used. If this value is zero then no limit is applied. Resuming a Live API session does not count as a use. If unspecified, the default is 1.
| JSON representation |
|---|
{
"name": string,
"expireTime": string,
"newSessionExpireTime": string,
"fieldMask": string,
// config
"bidiGenerateContentSetup": {
object ( |
BidiGenerateContentSetup
Message to be sent in the first (and only in the first) BidiGenerateContentClientMessage . Contains configuration that will apply for the duration of the streaming RPC.
Clients should wait for a BidiGenerateContentSetupComplete message before sending any additional messages.
modelstringRequired. The model's resource name. This serves as an ID for the Model to use.
Format: models/{model}
generationConfigobject ( GenerationConfig )Optional. Generation config.
The following fields are not supported:
-
responseLogprobs -
responseMimeType -
logprobs -
responseSchema -
responseJsonSchema -
stop_sequence -
skipResponseCache -
routing_config -
audio_timestamp
systemInstructionobject ( Content )Optional. The user provided system instructions for the model.
Note: Only text should be used in parts and content in each part will be in a separate paragraph.
tools[]object ( Tool ) Optional. A list of Tools the model may use to generate the next response.
A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.
realtimeInputConfigobject ( RealtimeInputConfig )Optional. Configures the handling of realtime input.
sessionResumptionobject ( SessionResumptionConfig )Optional. Configures session resumption mechanism.
If included, the server will send SessionResumptionUpdate messages.
contextWindowCompressionobject ( ContextWindowCompressionConfig )Optional. Configures a context window compression mechanism.
If included, the server will automatically reduce the size of the context when it exceeds the configured length.
inputAudioTranscriptionobject ( AudioTranscriptionConfig )Optional. If set, enables transcription of voice input. The transcription aligns with the input audio language, if configured.
outputAudioTranscriptionobject ( AudioTranscriptionConfig )Optional. If set, enables transcription of the model's audio output. The transcription aligns with the language code specified for the output audio, if configured.
historyConfigobject ( HistoryConfig )Optional. Configures the exchange of history between the client and the server.
| JSON representation |
|---|
{ "model": string, "generationConfig": { object ( |
GenerationConfig
Configuration options for model generation and outputs. Not all parameters are configurable for every model.
stopSequences[]string Optional. The set of character sequences (up to 5) that will stop output generation. If specified, the API will stop at the first appearance of a stop_sequence . The stop sequence will not be included as part of the response.
responseMimeTypestring Optional. MIME type of the generated candidate text. Supported MIME types are: text/plain : (default) Text output. application/json : JSON response in the response candidates. text/x.enum : ENUM as a string response in the response candidates. Refer to the docs for a list of all supported text MIME types.
responseSchema
(deprecated)object ( Schema )Optional. Output schema of the generated candidate text. Schemas must be a subset of the OpenAPI schema and can be objects, primitives or arrays.
If set, a compatible responseMimeType must also be set. Compatible MIME types: application/json : Schema for JSON response. Refer to the JSON text generation guide for more details.
_responseJsonSchema
(deprecated)value ( Value format) Optional. Output schema of the generated response. This is an alternative to responseSchema that accepts JSON Schema .
If set, responseSchema must be omitted, but responseMimeType is required.
While the full JSON Schema may be sent, not all features are supported. Specifically, only the following properties are supported:
-
$id -
$defs -
$ref -
$anchor -
type -
format -
title -
description -
enum(for strings and numbers) -
items -
prefixItems -
minItems -
maxItems -
minimum -
maximum -
anyOf -
oneOf(interpreted the same asanyOf) -
properties -
additionalProperties -
required
The non-standard propertyOrdering property may also be set.
Cyclic references are unrolled to a limited degree and, as such, may only be used within non-required properties. (Nullable properties are not sufficient.) If $ref is set on a sub-schema, no other properties, except for than those starting as a $ , may be set.
responseJsonSchemavalue ( Value format) Optional. An internal detail. Use responseJsonSchema rather than this field.
responseModalities[]enum ( Modality )Optional. The requested modalities of the response. Represents the set of modalities that the model can return, and should be expected in the response. This is an exact match to the modalities of the response.
A model may have multiple combinations of supported modalities. If the requested modalities do not match any of the supported combinations, an error will be returned.
An empty list is equivalent to requesting only text.
candidateCountintegerOptional. Number of generated responses to return. If unset, this will default to 1. Please note that this doesn't work for previous generation models (Gemini 1.0 family)
maxOutputTokensintegerOptional. The maximum number of tokens to include in a response candidate.
Note: The default value varies by model, see the Model.output_token_limit attribute of the Model returned from the getModel function.
temperaturenumberOptional. Controls the randomness of the output.
Note: The default value varies by model, see the Model.temperature attribute of the Model returned from the getModel function.
Values can range from [0.0, 2.0].
topPnumberOptional. The maximum cumulative probability of tokens to consider when sampling.
The model uses combined Top-k and Top-p (nucleus) sampling.
Tokens are sorted based on their assigned probabilities so that only the most likely tokens are considered. Top-k sampling directly limits the maximum number of tokens to consider, while Nucleus sampling limits the number of tokens based on the cumulative probability.
Note: The default value varies by Model and is specified by the Model.top_p attribute returned from the getModel function. An empty topK attribute indicates that the model doesn't apply top-k sampling and doesn't allow setting topK on requests.
topKintegerOptional. The maximum number of tokens to consider when sampling.
Gemini models use Top-p (nucleus) sampling or a combination of Top-k and nucleus sampling. Top-k sampling considers the set of topK most probable tokens. Models running with nucleus sampling don't allow topK setting.
Note: The default value varies by Model and is specified by the Model.top_p attribute returned from the getModel function. An empty topK attribute indicates that the model doesn't apply top-k sampling and doesn't allow setting topK on requests.
seedintegerOptional. Seed used in decoding. If not set, the request uses a randomly generated seed.
presencePenaltynumberOptional. Presence penalty applied to the next token's logprobs if the token has already been seen in the response.
This penalty is binary on/off and not dependant on the number of times the token is used (after the first). Use frequencyPenalty for a penalty that increases with each use.
A positive penalty will discourage the use of tokens that have already been used in the response, increasing the vocabulary.
A negative penalty will encourage the use of tokens that have already been used in the response, decreasing the vocabulary.
frequencyPenaltynumberOptional. Frequency penalty applied to the next token's logprobs, multiplied by the number of times each token has been seen in the respponse so far.
A positive penalty will discourage the use of tokens that have already been used, proportional to the number of times the token has been used: The more a token is used, the more difficult it is for the model to use that token again increasing the vocabulary of responses.
Caution: A negative penalty will encourage the model to reuse tokens proportional to the number of times the token has been used. Small negative values will reduce the vocabulary of a response. Larger negative values will cause the model to start repeating a common token until it hits the maxOutputTokens limit.
responseLogprobsbooleanOptional. If true, export the logprobs results in response.
logprobsinteger Optional. Only valid if responseLogprobs=True . This sets the number of top logprobs, including the chosen candidate, to return at each decoding step in the Candidate.logprobs_result . The number must be in the range of [0, 20].
enableEnhancedCivicAnswersbooleanOptional. Enables enhanced civic answers. It may not be available for all models.
speechConfigobject ( SpeechConfig )Optional. The speech generation config.
thinkingConfigobject ( ThinkingConfig )Optional. Config for thinking features. An error will be returned if this field is set for models that don't support thinking.
imageConfigobject ( ImageConfig )Optional. Config for image generation. An error will be returned if this field is set for models that don't support these config options.
mediaResolutionenum ( MediaResolution )Optional. If specified, the media resolution specified will be used.
enableAffectiveDialogbooleanOptional. If enabled, the model will detect emotions and adapt its responses accordingly.
responseFormatobject ( ResponseFormatConfig )Optional. Configuration for the response output format. Allows specifying output configuration per modality (text, audio, image) in a flat structure.
translationConfigobject ( TranslationConfig )Optional. Config for translation.
audioTranscriptionConfigobject ( AudioTranscriptionConfig )Optional. Config for audio transcription (speech recognition).
| JSON representation |
|---|
{ "stopSequences": [ string ], "responseMimeType": string, "responseSchema": { object ( |
Modality
Supported modalities of the response.
| Enums | |
|---|---|
MODALITY_UNSPECIFIED | Default value. |
TEXT | Indicates the model should return text. |
IMAGE | Indicates the model should return images. |
AUDIO | Indicates the model should return audio. |
SpeechConfig
Config for speech generation and transcription.
voiceConfigobject ( VoiceConfig )The configuration in case of single-voice output.
multiSpeakerVoiceConfigobject ( MultiSpeakerVoiceConfig )Optional. The configuration for the multi-speaker setup. It is mutually exclusive with the voiceConfig field.
languageCodestringOptional. The IETF BCP-47 language code that the user configured the app to use. Used for speech recognition and synthesis.
Valid values are: de-DE , en-AU , en-GB , en-IN , en-US , es-US , fr-FR , hi-IN , pt-BR , ar-XA , es-ES , fr-CA , id-ID , it-IT , ja-JP , tr-TR , vi-VN , bn-IN , gu-IN , kn-IN , ml-IN , mr-IN , ta-IN , te-IN , nl-NL , ko-KR , cmn-CN , pl-PL , ru-RU , and th-TH .
| JSON representation |
|---|
{ "voiceConfig": { object ( |
VoiceConfig
The configuration for the voice to use.
voice_configUnion typevoice_config can be only one of the following: prebuiltVoiceConfigobject ( PrebuiltVoiceConfig )The configuration for the prebuilt voice to use.
| JSON representation |
|---|
{
// voice_config
"prebuiltVoiceConfig": {
object ( |
PrebuiltVoiceConfig
The configuration for the prebuilt speaker to use.
voiceNamestringThe name of the preset voice to use.
| JSON representation |
|---|
{ "voiceName": string } |
MultiSpeakerVoiceConfig
The configuration for the multi-speaker setup.
speakerVoiceConfigs[]object ( SpeakerVoiceConfig )Required. All the enabled speaker voices.
| JSON representation |
|---|
{
"speakerVoiceConfigs": [
{
object ( |
SpeakerVoiceConfig
The configuration for a single speaker in a multi speaker setup.
speakerstringRequired. The name of the speaker to use. Should be the same as in the prompt.
voiceConfigobject ( VoiceConfig )Required. The configuration for the voice to use.
| JSON representation |
|---|
{
"speaker": string,
"voiceConfig": {
object ( |
ThinkingConfig
Config for thinking features.
includeThoughtsbooleanIndicates whether to include thoughts in the response. If true, thoughts are returned only when available.
thinkingBudgetintegerThe number of thoughts tokens that the model should generate.
thinkingLevelenum ( ThinkingLevel )Optional. Controls the maximum depth of the model's internal reasoning process before it produces a response. The default value is model-dependent. Refer to the Thinking levels guide for more details. Recommended for Gemini 3 or later models. Use with earlier models results in an error.
| JSON representation |
|---|
{
"includeThoughts": boolean,
"thinkingBudget": integer,
"thinkingLevel": enum ( |
ThinkingLevel
Allow user to specify how much to think using enum instead of integer budget.
| Enums | |
|---|---|
THINKING_LEVEL_UNSPECIFIED | Default value. |
MINIMAL | Little to no thinking. |
LOW | Low thinking level. |
MEDIUM | Medium thinking level. |
HIGH | High thinking level. |
ImageConfig
Config for image generation features.
aspectRatiostring Optional. The aspect ratio of the image to generate. Supported aspect ratios: 1:1 , 1:4 , 4:1 , 1:8 , 8:1 , 2:3 , 3:2 , 3:4 , 4:3 , 4:5 , 5:4 , 9:16 , 16:9 , or 21:9 .
If not specified, the model will choose a default aspect ratio based on any reference images provided.
imageSizestring Optional. Specifies the size of generated images. Supported values are 512 , 1K , 2K , 4K . If not specified, the model will use default value 1K .
| JSON representation |
|---|
{ "aspectRatio": string, "imageSize": string } |
MediaResolution
Media resolution for the input media.
| Enums | |
|---|---|
MEDIA_RESOLUTION_UNSPECIFIED | Media resolution has not been set. |
MEDIA_RESOLUTION_LOW | Media resolution set to low (64 tokens). |
MEDIA_RESOLUTION_MEDIUM | Media resolution set to medium (256 tokens). |
MEDIA_RESOLUTION_HIGH | Media resolution set to high (zoomed reframing with 256 tokens). |
ResponseFormatConfig
Configuration for the response output format. This is a flat object where each optional sub-field configures a specific output modality.
textobject ( TextResponseFormat )Optional. Text output format configuration.
audioobject ( AudioResponseFormat )Optional. Audio output format configuration.
imageobject ( ImageResponseFormat )Optional. Image output format configuration.
| JSON representation |
|---|
{ "text": { object ( |
TextResponseFormat
Configuration for text output format.
mimeTypeenum ( MimeType )Optional. The MIME type of the text output.
schemavalue ( Value format)Optional. The JSON schema that the output should conform to. Only applicable when mimeType is APPLICATION_JSON.
| JSON representation |
|---|
{
"mimeType": enum ( |
MimeType
Supported MIME types for text output.
| Enums | |
|---|---|
MIME_TYPE_UNSPECIFIED | Default value. This value is unused. |
APPLICATION_JSON | JSON output format. |
TEXT_PLAIN | Plain text output format. |
AudioResponseFormat
Configuration for audio output format.
mimeTypeenum ( MimeType )Optional. The MIME type of the audio output.
deliveryenum ( Delivery )Optional. The delivery mode for the audio output.
sampleRateintegerOptional. Sample rate in Hz.
bitRateintegerOptional. Bit rate in bits per second (bps). Only applicable for compressed formats (MP3, Opus).
MimeType
Supported MIME types for audio output.
| Enums | |
|---|---|
MIME_TYPE_UNSPECIFIED | Default value. This value is unused. |
AUDIO_MP3 | MP3 audio format. |
AUDIO_OGG_OPUS | OGG Opus audio format. |
AUDIO_L16 | Raw PCM (L16) audio format. |
AUDIO_WAV | WAV audio format. |
AUDIO_ALAW | A-law audio format. |
AUDIO_MULAW | Mu-law audio format. |
Dërgim
Delivery mode for audio output.
| Enums | |
|---|---|
DELIVERY_UNSPECIFIED | Default value. This value is unused. |
INLINE | Audio data is returned inline in the response. |
URI | Audio data is returned as a URI. |
ImageResponseFormat
Configuration for image output format.
mimeTypeenum ( MimeType )Optional. The MIME type of the image output.
deliveryenum ( Delivery )Optional. The delivery mode for the image output.
aspectRatioenum ( AspectRatio )Optional. The aspect ratio for the image output.
imageSizeenum ( ImageSize )Optional. The size of the image output.
| JSON representation |
|---|
{ "mimeType": enum ( |
MimeType
Supported MIME types for image output.
| Enums | |
|---|---|
MIME_TYPE_UNSPECIFIED | Default value. This value is unused. |
IMAGE_JPEG | JPEG image format. |
Dërgim
Delivery mode for image output.
| Enums | |
|---|---|
DELIVERY_UNSPECIFIED | Default value. This value is unused. |
INLINE | Image data is returned inline in the response. |
URI | Image data is returned as a URI. |
AspectRatio
Supported aspect ratios for image output.
| Enums | |
|---|---|
ASPECT_RATIO_UNSPECIFIED | Default value. This value is unused. |
ASPECT_RATIO_ONE_BY_ONE | 1:1 aspect ratio. |
ASPECT_RATIO_TWO_BY_THREE | 2:3 aspect ratio. |
ASPECT_RATIO_THREE_BY_TWO | 3:2 aspect ratio. |
ASPECT_RATIO_THREE_BY_FOUR | 3:4 aspect ratio. |
ASPECT_RATIO_FOUR_BY_THREE | 4:3 aspect ratio. |
ASPECT_RATIO_FOUR_BY_FIVE | 4:5 aspect ratio. |
ASPECT_RATIO_FIVE_BY_FOUR | 5:4 aspect ratio. |
ASPECT_RATIO_NINE_BY_SIXTEEN | 9:16 aspect ratio. |
ASPECT_RATIO_SIXTEEN_BY_NINE | 16:9 aspect ratio. |
ASPECT_RATIO_TWENTY_ONE_BY_NINE | 21:9 aspect ratio. |
ASPECT_RATIO_ONE_BY_EIGHT | 1:8 aspect ratio. |
ASPECT_RATIO_EIGHT_BY_ONE | 8:1 aspect ratio. |
ASPECT_RATIO_ONE_BY_FOUR | 1:4 aspect ratio. |
ASPECT_RATIO_FOUR_BY_ONE | 4:1 aspect ratio. |
ImageSize
Supported image sizes for image output.
| Enums | |
|---|---|
IMAGE_SIZE_UNSPECIFIED | Default value. This value is unused. |
IMAGE_SIZE_FIVE_TWELVE | 512px image size. |
IMAGE_SIZE_ONE_K | 1K image size. |
IMAGE_SIZE_TWO_K | 2K image size. |
IMAGE_SIZE_FOUR_K | 4K image size. |
TranslationConfig
Config for translation features.
targetLanguageCodestringRequired. The target language for translation. Supported values are BCP-47 language codes (eg "en", "es", "fr").
echoTargetLanguagebooleanOptional. If true, the model will generate audio when the target language is spoken, essentially it will parrot the input. If false, we will not produce audio for the target language.
| JSON representation |
|---|
{ "targetLanguageCode": string, "echoTargetLanguage": boolean } |
AudioTranscriptionConfig
The audio transcription configuration.
languageCodes[]stringOptional. BCP-47 language codes providing hints about the languages present in the audio. If omitted or empty, defaults to automatic language detection.
adaptationPhrases[]
(deprecated)stringOptional. A list of phrases used for speech adaptation, which biases the ASR model to improve recognition of these specific terms.
customVocabulary[]stringOptional. A list of custom vocabulary phrases to bias the speech recognition model toward recognizing specific terms (product names, proper nouns, jargon).
wordTimestampbooleanOptional. Configures word-level timestamp generation.
diarizationbooleanOptional. Configures speaker diarization.
language_configUnion typelanguage_codes instead. language_config can be only one of the following: languageAuto
(deprecated)object ( LanguageAuto )Optional. The model will detect the language automatically.
languageHints
(deprecated)object ( LanguageHints )Optional. Specifies one or more languages in the audio.
| JSON representation |
|---|
{ "languageCodes": [ string ], "adaptationPhrases": [ string ], "customVocabulary": [ string ], "wordTimestamp": boolean, "diarization": boolean, // language_config "languageAuto": { object ( |
LanguageAuto
This type has no fields.
Indicates the language of the audio should be automatically detected.
LanguageHints
Provides hints to the model about possible languages present in the audio.
languageCodes[]
(deprecated)stringRequired. BCP-47 language codes.
| JSON representation |
|---|
{ "languageCodes": [ string ] } |
RealtimeInputConfig
Configures the realtime input behavior in BidiGenerateContent .
automaticActivityDetectionobject ( AutomaticActivityDetection )Optional. If not set, automatic activity detection is enabled by default. If automatic voice detection is disabled, the client must send activity signals.
activityHandlingenum ( ActivityHandling )Optional. Defines what effect activity has.
turnCoverageenum ( TurnCoverage )Optional. Defines which input is included in the user's turn.
| JSON representation |
|---|
{ "automaticActivityDetection": { object ( |
AutomaticActivityDetection
Configures automatic detection of activity.
disabledbooleanOptional. If enabled (the default), detected voice and text input count as activity. If disabled, the client must send activity signals.
startOfSpeechSensitivityenum ( StartSensitivity )Optional. Determines how likely speech is to be detected.
prefixPaddingMsintegerOptional. The required duration of detected speech before start-of-speech is committed. The lower this value, the more sensitive the start-of-speech detection is and shorter speech can be recognized. However, this also increases the probability of false positives.
endOfSpeechSensitivityenum ( EndSensitivity )Optional. Determines how likely detected speech is ended.
silenceDurationMsintegerOptional. The required duration of detected non-speech (eg silence) before end-of-speech is committed. The larger this value, the longer speech gaps can be without interrupting the user's activity but this will increase the model's latency.
| JSON representation |
|---|
{ "disabled": boolean, "startOfSpeechSensitivity": enum ( |
StartSensitivity
Determines how start of speech is detected.
| Enums | |
|---|---|
START_SENSITIVITY_UNSPECIFIED | The default is START_SENSITIVITY_HIGH. |
START_SENSITIVITY_HIGH | Automatic detection will detect the start of speech more often. |
START_SENSITIVITY_LOW | Automatic detection will detect the start of speech less often. |
EndSensitivity
Determines how end of speech is detected.
| Enums | |
|---|---|
END_SENSITIVITY_UNSPECIFIED | The default is END_SENSITIVITY_HIGH. |
END_SENSITIVITY_HIGH | Automatic detection ends speech more often. |
END_SENSITIVITY_LOW | Automatic detection ends speech less often. |
ActivityHandling
The different ways of handling user activity.
| Enums | |
|---|---|
ACTIVITY_HANDLING_UNSPECIFIED | If unspecified, the default behavior is START_OF_ACTIVITY_INTERRUPTS . |
START_OF_ACTIVITY_INTERRUPTS | If true, start of activity will interrupt the model's response (also called "barge in"). The model's current response will be cut-off in the moment of the interruption. This is the default behavior. |
NO_INTERRUPTION | The model's response will not be interrupted. |
TurnCoverage
Options about which input is included in the user's turn.
| Enums | |
|---|---|
TURN_COVERAGE_UNSPECIFIED | If unspecified, a default behavior is selected based on the model. Eg, for Gemini 2.5, the default is TURN_INCLUDES_ONLY_ACTIVITY , while for Gemini 3.1 and onwards, it's TURN_INCLUDES_AUDIO_ACTIVITY_AND_ALL_VIDEO . |
TURN_INCLUDES_ONLY_ACTIVITY | Includes activity since the last turn, excluding inactivity (eg silence on the audio stream). |
TURN_INCLUDES_ALL_INPUT | Includes all realtime input since the last turn, including inactivity (eg silence on the audio stream). |
TURN_INCLUDES_AUDIO_ACTIVITY_AND_ALL_VIDEO | Includes audio activity and all video since the last turn. With automatic activity detection, audio activity means speech and excludes silence. |
SessionResumptionConfig
Session resumption configuration.
This message is included in the session configuration as BidiGenerateContentSetup.session_resumption . If configured, the server will send SessionResumptionUpdate messages.
handlestringThe handle of a previous session. If not present then a new session is created.
Session handles come from SessionResumptionUpdate.token values in previous connections.
| JSON representation |
|---|
{ "handle": string } |
ContextWindowCompressionConfig
Enables context window compression — a mechanism for managing the model's context window so that it does not exceed a given length.
compression_mechanismUnion typecompression_mechanism can be only one of the following: slidingWindowobject ( SlidingWindow )A sliding-window mechanism.
triggerTokensstring ( int64 format)The number of tokens (before running a turn) required to trigger a context window compression.
This can be used to balance quality against latency as shorter context windows may result in faster model responses. However, any compression operation will cause a temporary latency increase, so they should not be triggered frequently.
If not set, the default is 80% of the model's context window limit. This leaves 20% for the next user request/model response.
| JSON representation |
|---|
{
// compression_mechanism
"slidingWindow": {
object ( |
SlidingWindow
The SlidingWindow method operates by discarding content at the beginning of the context window. The resulting context will always begin at the start of a USER role turn. System instructions and any BidiGenerateContentSetup.prefix_turns will always remain at the beginning of the result.
targetTokensstring ( int64 format)The target number of tokens to keep. The default value is triggerTokens/2.
Discarding parts of the context window causes a temporary latency increase so this value should be calibrated to avoid frequent compression operations.
| JSON representation |
|---|
{ "targetTokens": string } |
HistoryConfig
History configuration.
This message is included in the session configuration as BidiGenerateContentSetup.history_config . Configures the exchange of history messages.
initialHistoryInClientContentboolean Optional. If true, after sending setupComplete , the server will wait and at first process clientContent messages until turnComplete is true . This initial history will not trigger a model call and may end with role MODEL . After turnComplete is true , the client can start the realtime conversation via realtimeInput .
| JSON representation |
|---|
{ "initialHistoryInClientContent": boolean } |
Method: auth_tokens.create
Krijon një token që mund të përdoret për të kufizuar sjelljen e një sesioni BidiGenerateContent.
Endpoint
posthttps: / /generativelanguage.googleapis.com /v1beta /auth_tokensRequest body
The request body contains an instance of AuthToken .
expireTimestring ( Timestamp format)Optional. Input only. Immutable. An optional time after which, when using the resulting token, messages in BidiGenerateContent sessions will be rejected. (Gemini may preemptively close the session after this time.)
If not set then this defaults to 30 minutes in the future. If set, this value must be less than 20 hours in the future.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z" , "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30" .
newSessionExpireTimestring ( Timestamp format)Optional. Input only. Immutable. The time after which new Live API sessions using the token resulting from this request will be rejected.
If not set this defaults to 60 seconds in the future. If set, this value must be less than 20 hours in the future.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z" , "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30" .
fieldMaskstring ( FieldMask format) Optional. Input only. Immutable. If fieldMask is empty, and bidiGenerateContentSetup is not present, then the effective BidiGenerateContentSetup message is taken from the Live API connection.
If fieldMask is empty, and bidiGenerateContentSetup is present, then the effective BidiGenerateContentSetup message is taken entirely from bidiGenerateContentSetup in this request. The setup message from the Live API connection is ignored.
If fieldMask is not empty, then the corresponding fields from bidiGenerateContentSetup will overwrite the fields from the setup message in the Live API connection.
This is a comma-separated list of fully qualified names of fields. Example: "user.displayName,photo" .
configUnion typeconfig can be only one of the following: bidiGenerateContentSetupobject ( BidiGenerateContentSetup ) Optional. Input only. Immutable. Configuration specific to BidiGenerateContent .
usesintegerOptional. Input only. Immutable. The number of times the token can be used. If this value is zero then no limit is applied. Resuming a Live API session does not count as a use. If unspecified, the default is 1.
Response body
If successful, the response body contains a newly created instance of AuthToken .