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 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ë.
object ( ToolConfig ) 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. Referojuni udhëzuesit për informacion të detajuar mbi cilësimet e sigurisë në dispozicion. Referojuni gjithashtu udhëzuesit të Sigurisë 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.
object ( GenerationConfig ) generationConfigOpsionale. 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}
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 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ë.
object ( ToolConfig ) 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. Referojuni udhëzuesit për informacion të detajuar mbi cilësimet e sigurisë në dispozicion. Referojuni gjithashtu udhëzuesit të Sigurisë 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.
object ( GenerationConfig ) generationConfigOpsionale. 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}
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.
object ( PromptFeedback ) promptFeedbackKthen reagimin e kërkesës në lidhje me filtrat e përmbajtjes.
object ( UsageMetadata ) usageMetadataVetë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 responseIdVetëm rezultat. responseId përdoret për të identifikuar çdo përgjigje.
| 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 + 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.
object ( ModalityTokenCount ) cacheTokensDetails[]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.
object ( ModalityTokenCount ) toolUsePromptTokensDetails[]Vetëm rezultate. Lista e modaliteteve që u përpunuan për hyrjet e kërkesave për përdorimin e mjetit.
| Përfaqësimi JSON |
|---|
{ "promptTokenCount": integer, "cachedContentTokenCount": integer, "candidatesTokenCount": integer, "toolUsePromptTokenCount": integer, "thoughtsTokenCount": integer, "totalTokenCount": integer, "promptTokensDetails": [ { object ( |
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
- Konteksti i Marrë
- 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.
object ( CitationMetadata ) citationMetadataVetë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 .
object ( GroundingMetadata ) groundingMetadataVetë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.
object ( LogprobsResult ) logprobsResultVetëm rezultate. Rezultatet e gjasës logaritmike për tokenët e përgjigjes dhe tokenët kryesorë
object ( UrlContextMetadata ) urlContextMetadataVetë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. |
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: object ( GroundingPassageId ) groundingPassageIdentifikues për një pasazh të brendshëm.
object ( SemanticRetrieverChunk ) 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 .
passageIdstring -së së pasazhit 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.
object ( GroundingChunk ) groundingChunks[]Lista e referencave mbështetëse të marra nga burimi i specifikuar i tokëzimit.
groundingSupports[]object ( GroundingSupport )Lista e mbështetjes së tokëzimit.
webSearchQueries[]stringPyetje kërkimi në internet për kërkimin pasues në internet.
searchEntryPointobject ( SearchEntryPoint )Opsionale. Hyrje kërkimi në Google për kërkimet pasuese në internet.
object ( RetrievalMetadata ) retrievalMetadataMeta 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
Copë tokëzimi.
Union type chunk_typechunk_type mund të jetë vetëm një nga të mëposhtmet:webobject ( Web )Një copë tokëzimi nga rrjeti.
object ( RetrievedContext ) retrievedContextOpsionale. 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.
string uriReferenca URI e copës.
string titleTitulli i pjesës.
| Përfaqësimi JSON |
|---|
{ "uri": string, "title": string } |
Konteksti i Marrë
Pjesë nga konteksti e marrë nga mjeti i kërkimit të skedarëve.
string uriOpsionale. Referenca URI e dokumentit të rikthimit semantik.
string titleOpsionale. Titulli i dokumentit.
string textOpsionale. Teksti i pjesës.
| Përfaqësimi JSON |
|---|
{ "uri": string, "title": string, "text": string } |
Hartat
Një pjesë e lidhjes së tokës nga Google Maps. Një pjesë e Maps korrespondon me një vend të vetëm.
string uriReferenca URI e vendit.
string titleTitulli i vendit.
string textPërshkrim me tekst i përgjigjes së vendit.
string placeId Ky ID i vendit, në formatin places/{placeId} . Një përdorues mund ta përdorë këtë ID për të kërkuar atë vend.
object ( PlaceAnswerSources ) placeAnswerSourcesBurime 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 -së 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[]integerNjë listë indeksesh (në 'grounding_chunk') 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.
number confidenceScores[]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.
segmentobject ( Segment )Segmenti i përmbajtjes të cilit i përket kjo mbështetje.
| Përfaqësimi JSON |
|---|
{
"groundingChunkIndices": [
integer
],
"confidenceScores": [
number
],
"segment": {
object ( |
Segmenti
Segment i përmbajtjes.
integer partIndexVetëm rezultati. Indeksi i një objekti Part brenda objektit të tij mëmë Content.
integer startIndexVetëm dalje. Indeksi fillestar në Pjesën e dhënë, i matur në bajt. Zhvendosje nga fillimi i Pjesës, përfshirëse, duke filluar nga zero.
endIndexintegerVetëm dalje. Indeksi 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 textVetëm rezultati. Teksti 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.
string retrievedUrlURL-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.
string uriOpsionale. 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 } |
Konfigurimi i Gjeneratës
- Përfaqësimi JSON
- Modaliteti
- Konfigurimi i të folurit
- Konfigurimi i Zërit
- ParandërtuarKonfigurimi i Zërit
- Konfigurimi i Zërit të Shumë Altoparlantëve
- Konfigurimi i Zërit të Altoparlantit
- ThinkingConfig
- ImageConfig
- Rezolucioni i Medias
Opsionet e konfigurimit për gjenerimin e modelit dhe rezultatet. Jo të gjithë parametrat janë të konfigurueshëm për çdo model.
string stopSequences[] Opsionale. Sekuencat e karaktereve (deri në 5) që do të ndalojnë gjenerimin e rezultateve. Nëse specifikohet, API do të ndalet në shfaqjen e parë të një stop_sequence . Sekuenca e ndalimit nuk do të përfshihet si pjesë e përgjigjes.
string responseMimeType 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.
responseSchemaobject ( 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.
_responseJsonSchemavalue ( 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 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.
| 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
The speech generation config.
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. Language code (in BCP 47 format, eg "en-US") for speech 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.
| JSON representation |
|---|
{ "includeThoughts": boolean, "thinkingBudget": integer } |
ImageConfig
Config for image generation features.
aspectRatiostringOptional. The aspect ratio of the image to generate. Supported aspect ratios: 1:1, 2:3, 3:2, 3:4, 4:3, 9:16, 16:9, 21:9.
If not specified, the model will choose a default aspect ratio based on any reference images provided.
| JSON representation |
|---|
{ "aspectRatio": 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). |
HarmCategory
The category of a rating.
These categories cover various kinds of harms that developers may wish to adjust.
| Enums | |
|---|---|
HARM_CATEGORY_UNSPECIFIED | Category is unspecified. |
HARM_CATEGORY_DEROGATORY | PaLM - Negative or harmful comments targeting identity and/or protected attribute. |
HARM_CATEGORY_TOXICITY | PaLM - Content that is rude, disrespectful, or profane. |
HARM_CATEGORY_VIOLENCE | PaLM - Describes scenarios depicting violence against an individual or group, or general descriptions of gore. |
HARM_CATEGORY_SEXUAL | PaLM - Contains references to sexual acts or other lewd content. |
HARM_CATEGORY_MEDICAL | PaLM - Promotes unchecked medical advice. |
HARM_CATEGORY_DANGEROUS | PaLM - Dangerous content that promotes, facilitates, or encourages harmful acts. |
HARM_CATEGORY_HARASSMENT | Gemini - Harassment content. |
HARM_CATEGORY_HATE_SPEECH | Gemini - Hate speech and content. |
HARM_CATEGORY_SEXUALLY_EXPLICIT | Gemini - Sexually explicit content. |
HARM_CATEGORY_DANGEROUS_CONTENT | Gemini - Dangerous content. |
HARM_CATEGORY_CIVIC_INTEGRITY | Gemini - Content that may be used to harm civic integrity. DEPRECATED: use enableEnhancedCivicAnswers instead. |
ModalityTokenCount
Represents token counting info for a single modality.
modalityenum ( Modality )The modality associated with this token count.
tokenCountintegerNumber of tokens.
| JSON representation |
|---|
{
"modality": enum ( |
Modality
Content Part modality
| Enums | |
|---|---|
MODALITY_UNSPECIFIED | Unspecified modality. |
TEXT | Plain text. |
IMAGE | Imazh. |
VIDEO | Video. |
AUDIO | Audio. |
DOCUMENT | Document, eg PDF. |
SafetyRating
Safety rating for a piece of content.
The safety rating contains the category of harm and the harm probability level in that category for a piece of content. Content is classified for safety across a number of harm categories and the probability of the harm classification is included here.
categoryenum ( HarmCategory )Required. The category for this rating.
probabilityenum ( HarmProbability )Required. The probability of harm for this content.
blockedbooleanWas this content blocked because of this rating?
| JSON representation |
|---|
{ "category": enum ( |
HarmProbability
The probability that a piece of content is harmful.
The classification system gives the probability of the content being unsafe. This does not indicate the severity of harm for a piece of content.
| Enums | |
|---|---|
HARM_PROBABILITY_UNSPECIFIED | Probability is unspecified. |
NEGLIGIBLE | Content has a negligible chance of being unsafe. |
LOW | Content has a low chance of being unsafe. |
MEDIUM | Content has a medium chance of being unsafe. |
HIGH | Content has a high chance of being unsafe. |
SafetySetting
Safety setting, affecting the safety-blocking behavior.
Passing a safety setting for a category changes the allowed probability that content is blocked.
categoryenum ( HarmCategory )Required. The category for this setting.
thresholdenum ( HarmBlockThreshold )Required. Controls the probability threshold at which harm is blocked.
| JSON representation |
|---|
{ "category": enum ( |
HarmBlockThreshold
Block at and beyond a specified harm probability.
| Enums | |
|---|---|
HARM_BLOCK_THRESHOLD_UNSPECIFIED | Threshold is unspecified. |
BLOCK_LOW_AND_ABOVE | Content with NEGLIGIBLE will be allowed. |
BLOCK_MEDIUM_AND_ABOVE | Content with NEGLIGIBLE and LOW will be allowed. |
BLOCK_ONLY_HIGH | Content with NEGLIGIBLE, LOW, and MEDIUM will be allowed. |
BLOCK_NONE | All content will be allowed. |
OFF | Turn off the safety filter. |