Generare podcast (metodo API)
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Importante :l'accesso all'API Podcast è disponibile per alcuni clienti Google Cloud. Per scoprire di più o registrarti per utilizzare questa funzionalità, contatta il tuo
Google Cloud rappresentante di vendita.
Gemini Enterprise offre un'API che ti consente di generare podcast basati su documenti di origine. L'output è molto simile ai podcast che gli utenti finali possono
generare all'interno dei propri notebook.
La generazione di podcast tramite l'API è adatta ai lavori batch in cui
potresti avere decine o centinaia di libri, articoli o corsi e vuoi
generare un podcast per ciascuno.
L'API
Podcast è un'API
autonoma. ovvero non hai bisogno di un notebook NotebookLM Enterprise, di una licenza Gemini Enterprise o di un datastore. Tutto ciò che ti serve è un progetto
Google Cloud abilitato e il ruolo utente API Podcast.
L'input per l'API è un array di elementi context
. Questi sono i materiali
di origine da cui viene generato il podcast. L'input può essere sotto forma di
testo, immagini, audio e video. Il contenuto totale dell'array di contesto deve essere
inferiore a 100.000 token.
Per un elenco dei tipi supportati, consulta le specifiche tecniche per immagini, documenti, video e audio in questa pagina su Gemini 2.5 Flash .
Output
L'output dell'API è il podcast, in formato MP3.
Prima di iniziare
Prima di poter generare un podcast utilizzando l'API, devi disporre di quanto segue:
Generare un podcast dall'input di contesto
Utilizza il seguente comando per generare un podcast chiamando il metodo
podcast .
L'input è un array di oggetti multimediali come testo, immagini
e clip audio e video.
REST
Per generare ed esportare un podcast:
Esegui questo comando curl:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID /locations/global/podcasts" \
-d '{
"podcastConfig": {
"focus": "FOCUS ",
"length": "LENGTH ",
"languageCode": "LANGUAGE_CODE "
},
"contexts": [
{
"MEDIA_TYPE_1 ": "MEDIA_CONTENT_1 "
},
{
"MEDIA_TYPE_2 ": "MEDIA_CONTENT_2 "
}
],
"title": "PODCAST_TITLE ",
"description": "PODCAST_DESCRIPTION "
}'
Sostituisci quanto segue:
PROJECT_ID
: l'ID progetto.
FOCUS
: un prompt in cui suggerisci l'argomento principale del podcast.
LENGTH
: sono disponibili due opzioni:
SHORT
(in genere 4-5 minuti)
STANDARD
(in genere circa 10 minuti, ma può essere
più breve con set di dati più piccoli)
LANGUAGE_CODE
: facoltativo. Specifica
il codice lingua del podcast. Utilizza i tag di lingua definiti da BCP47 . Se il codice
della lingua non viene fornito, il podcast viene generato in inglese.
MEDIA_TYPE_N
: specifica il tipo di contenuti multimediali
a cui fai riferimento per generare il podcast. I tipi consentiti sono i
seguenti:
text
. Testo normale.
blob
. Per
tutti i tipi di media, ad eccezione del testo normale, utilizza questo tipo e carica i
dati come byte non elaborati.
MEDIA_CONTENT_N
: i contenuti stessi in testo normale o byte non elaborati. Il contenuto totale dell'array di contesto deve essere inferiore
a 100.000 token.
PODCAST_TITLE
: un titolo per il podcast. Può essere per uso interno oppure puoi scegliere di mostrarlo agli utenti finali.
PODCAST_DESCRIPTION
: una descrizione del
podcast. Può essere per uso interno oppure puoi scegliere di mostrarlo agli
utenti finali.
Esempio di comando e risultato
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://discoveryengine.googleapis.com/v1/projects/my-project-123/locations/global/podcasts" \
-d '{
"podcastConfig": {
"focus": "Can you talk about how to find a job in Google?",
"length": "SHORT"
},
"contexts": [
{
"text": "Breaking into Google is a highly competitive endeavor, attracting millions of applicants globally due to its reputation as a top employer, its innovative work, and comprehensive perks. Success hinges on a multi-faceted approach, starting with meticulously tailored online applications that incorporate job description keywords for ATS and showcasing Googlyness—a blend of curiosity, collaborative spirit, and leadership potential. The rigorous, multi-stage interview process involves recruiter screens, behavioral interviews (often using the STAR method), and for technical roles, demanding coding challenges and system design questions that assess not just correct answers but also problem-solving thought processes and communication skills. Networking for referrals and informational interviews can significantly boost visibility, but ultimately, thorough preparation through mock interviews and platforms like LeetCode, combined with patience and resilience through the often lengthy process, are paramount for navigating this challenging but rewarding path."
},
{
"text": "Finding your way into a career at Google begins with their comprehensive careers website, a digital gateway brimming with opportunities. To embark on this journey, you first navigate the job board, using keywords like software engineer or product manager to pinpoint potential roles. To refine your search, utilize the array of filters available for location, experience level, degree, skills, and even specific Google organizations. You can even browse by team if you have a particular department in mind, like Engineering and Technology or Marketing and Communications. Once you discover a promising position, delve into its detailed description, paying close attention to the minimum qualifications – these are the foundational criteria against which your application will be assessed. Remember, Google seeks out leaders who can perform at the highest level, and while experience is valued, internships or graduate programs can be a great entry point for those earlier in their career. When you are ready to apply, you will need to create a Careers Profile, using your Google Account for seamless sign-in and communication. Crucially, tailor your resume for each specific role, highlighting relevant experiences and quantifying your achievements with concrete data. While a one-page resume is generally preferred, a two-page resume is acceptable for those with more extensive experience. Notably, cover letters are not typically required unless explicitly stated in the job description. Google encourages quality over quantity, so strategically apply for up to three jobs every 30 days, choosing roles that truly align with your skills and passions. Once you have submitted your applications, your Careers Profile becomes your tracking center, where you can monitor the status of each submission, from Draft to Submitted. If you do not hear back within eight weeks, the search continues, though Google recruiters may proactively reach out for other opportunities later. Remember, perseverance and a solid understanding of Google values, combined with a continuously refined skill set and a well-prepared resume, will greatly enhance your chances of securing a position at this innovative company."
}
],
"title": "Find a job at Google ",
"description": "This podcast is based on two plain text documents that describe various aspects of getting a job at Google."
}'
{
"name": "projects/123456/locations/global/operations/create-podcast-54321"
}
La generazione di un podcast richiede alcuni minuti.
Prendi nota del nome dell'operazione, che ti servirà per scaricare il podcast nel passaggio 4. Nell'esempio riportato sopra, il nome dell'operazione è projects/123456/locations/global/operations/create-podcast-54321
.
Facoltativo. Estrai lo stato dell'operazione
di creazione del podcast. Consulta Visualizzare i dettagli di un'operazione a lunga esecuzione .
Al termine dell'operazione, esegui il seguente comando curl per
scaricare il podcast:
curl -v \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://discoveryengine.googleapis.com/v1/OPERATION_NAME :download?alt=media" \
--output FILENAME .mp3 -L
Sostituisci quanto segue:
OPERATION_NAME
: il nome dell'operazione annotata nel passaggio 2.
FILENAME
: un nome file per il podcast.
Questo comando scarica il podcast in un file MP3 nella directory locale.
Esempio di comando e risultato
curl -v \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://discoveryengine.googleapis.com/v1/projects/123456/locations/global/operations/create-podcast-54321:download?alt=media" \
--output my-podcast.mp3 -L
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Host discoveryengine.googleapis.com:443 was resolved.
...
{ [42044 bytes data]
100 14.3M 100 14.3M 0 0 10.9M 0 0:00:01 0:00:01 --:--:-- 29.7M
* Connection #0 to host discoveryengine.googleapis.com left intact
Conformità
L'API podcast non è conforme alle chiavi di crittografia gestite dal cliente,
CMEK per
Gemini Enterprise .