Gemini

Use Google’s AI Studio to access the Gemini and Gemma models.

Authentication

Set your GOOGLE_API_KEY environment variable. You can get one from Google here.

MacWindows

export GOOGLE_API_KEY=***

Example

Use Gemini with your Agent:

agent.py


from bitca.agent import Agent, RunResponse
from bitca.model.google import Gemini

agent = Agent(
    model=Gemini(id="gemini-1.5-flash"),
    markdown=True,
)

# Get the response in a variable
# run: RunResponse = agent.run("Share a 2 sentence horror story.")
# print(run.content)

# Print the response in the terminal
agent.print_response("Share a 2 sentence horror story.")

Params

Parameter
Type
Default
Description

id

str

"gemini-1.5-flash"

The specific Gemini model ID to use.

name

str

"Gemini"

The name of this Gemini model instance.

provider

str

"Google"

The provider of the model.

function_declarations

Optional[List[FunctionDeclaration]]

None

List of function declarations for the model.

generation_config

Optional[Any]

None

Configuration for text generation.

safety_settings

Optional[Any]

None

Safety settings for the model.

generative_model_kwargs

Optional[Dict[str, Any]]

None

Additional keyword arguments for the generative model.

api_key

Optional[str]

None

API key for authentication.

client_params

Optional[Dict[str, Any]]

None

Additional parameters for the client.

client

Optional[GenerativeModel]

None

The underlying generative model client.

Last updated