Explore Gemini API Android SDK samples
mainThe samples/ directory provides implementation examples for key features of the Gemini API Android SDK. These samples are available in both Kotlin and Java and cover the following core functionalities:
- Multi-turn chat conversations: Implementing interactive chat sessions.
- Executing code: Using the code execution feature.
- Setting model parameters: Configuring how the model behaves.
- Controlled generation: Using output constraints like JSON mode.
- Counting tokens: Measuring input and output token usage.
- Function calling: Integrating external functions into the model workflow.
- Safety settings: Configuring and applying safety controls.
- System instructions: Providing high-level instructions to guide model behavior.
- Text generation: Basic single-turn text generation.
These samples are also integrated into the official Gemini API documentation and API reference.