# Module: google.generativeai Google AI Python SDK ## Setup ```posix-terminal pip install google-generativeai ``` ## GenerativeModel Use `genai.GenerativeModel` to access the API: ``` import google.generativeai as genai import os genai.configure(api_key=os.environ['API_KEY']) model = genai.GenerativeModel(model_name='gemini-1.5-flash') response = model.generate_content('Teach me about how an LLM works') print(response.text) ``` See the [python quickstart](https://ai.google.dev/tutorials/python_quickstart) for more details. ## Modules [`caching`](../google/generativeai/caching.md) module [`protos`](../google/generativeai/protos.md) module: This module provides low level access to the ProtoBuffer "Message" classes used by the API. [`types`](../google/generativeai/types.md) module: A collection of type definitions used throughout the library. ## Classes [`class ChatSession`](../google/generativeai/ChatSession.md): Contains an ongoing conversation with the model. [`class GenerationConfig`](../google/generativeai/types/GenerationConfig.md): A simple dataclass used to configure the generation parameters of GenerativeModel.generate_content. [`class GenerativeModel`](../google/generativeai/GenerativeModel.md): The `genai.GenerativeModel` class wraps default parameters for calls to GenerativeModel.generate_content, GenerativeModel.count_tokens, and GenerativeModel.start_chat. ## Functions [`configure(...)`](../google/generativeai/configure.md): Captures default client configuration. [`create_tuned_model(...)`](../google/generativeai/create_tuned_model.md): Calls the API to initiate a tuning process that optimizes a model for specific data, returning an operation object to track and manage the tuning progress. [`delete_file(...)`](../google/generativeai/delete_file.md): Calls the API to permanently delete a specified file using a supported file service. [`delete_tuned_model(...)`](../google/generativeai/delete_tuned_model.md): Calls the API to delete a specified tuned model [`embed_content(...)`](../google/generativeai/embed_content.md): Calls the API to create embeddings for content passed in. [`embed_content_async(...)`](../google/generativeai/embed_content_async.md): Calls the API to create async embeddings for content passed in. [`get_base_model(...)`](../google/generativeai/get_base_model.md): Calls the API to fetch a base model by name. [`get_file(...)`](../google/generativeai/get_file.md): Calls the API to retrieve a specified file using a supported file service. [`get_model(...)`](../google/generativeai/get_model.md): Calls the API to fetch a model by name. [`get_operation(...)`](../google/generativeai/get_operation.md): Calls the API to get a specific operation [`get_tuned_model(...)`](../google/generativeai/get_tuned_model.md): Calls the API to fetch a tuned model by name. [`list_files(...)`](../google/generativeai/list_files.md): Calls the API to list files using a supported file service. [`list_models(...)`](../google/generativeai/list_models.md): Calls the API to list all available models. [`list_operations(...)`](../google/generativeai/list_operations.md): Calls the API to list all operations [`list_tuned_models(...)`](../google/generativeai/list_tuned_models.md): Calls the API to list all tuned models. [`update_tuned_model(...)`](../google/generativeai/update_tuned_model.md): Calls the API to push updates to a specified tuned model where only certain attributes are updatable. [`upload_file(...)`](../google/generativeai/upload_file.md): Calls the API to upload a file using a supported file service.
__version__ `'0.8.3'`
annotations Instance of `__future__._Feature`