Gemini -> Generate Content
Readonly
Action summary
Gemini -> Generate Content
Gemini → Generate Content
Overview
This action lets you generate text or general AI content using the Gemini API. You specify the model name and a prompt, then the function sends this request to Gemini and returns the generated response.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
gemini_api_key |
text (registry) | Yes | Your Gemini API key from the settings registry. |
model |
text | Yes | The Gemini model to use (e.g., gemini-1.5-flash). |
prompt |
text | Yes | The prompt or question for Gemini to generate content for. |
Function Stack
- Gemini API Request
- Sends a POST request to:
https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent?key={gemini_api_key}
- The body of the request includes the user-supplied `prompt`.
- The response is saved as `gemini_api`.
- Precondition
- Verifies the API response status is
200to ensure the request succeeded.
- Verifies the API response status is
- Response
- Returns the content from
gemini_api.response.result.
- Returns the content from
Example Usage
Request
{
"gemini_api_key": "AIzaSyD...",
"model": "gemini-1.5-flash",
"prompt": "Summarize the latest research trends in artificial intelligence."
}
Response
{
"result": "Recent AI research trends include improvements in large language models, multimodal AI, edge computing integration, AI safety efforts, and reinforcement learning advancements."
}
Notes
- Select a valid Gemini model name for your use case.
- The
gemini_api_keymust have the appropriate access and quota. - The prompt should be clear for best results from the model.
- For more advanced outputs (code, lists, summaries, etc.), craft your prompt accordingly.
Troubleshooting
PERMISSION_DENIEDorINVALID_ARGUMENT: Check if your API key and model name are correct and supported.- Empty or incomplete response: Revise the prompt or try a different model.
- Other errors: Consult the Gemini API documentation for troubleshooting and more usage instructions.
References
Version notes
Initial version
Current