How to Configure Hiring Agent to Use Google Gemini: Complete Setup Guide

Set the GEMINI_API_KEY environment variable in your .env file, change LLM_PROVIDER to gemini, and select a Gemini model name like gemini-2.5-pro to switch the Hiring Agent from the default Ollama backend to Google Gemini.

The Hiring Agent by InterviewStreet is an open-source resume evaluation tool that supports multiple Large Language Model (LLM) backends. While it defaults to Ollama for local inference, you can configure Hiring Agent to use Google Gemini by supplying your API key and updating a few configuration settings.

Prerequisites for Gemini Configuration

Before switching backends, obtain a valid API key from Google AI Studio. The Hiring Agent requires this key to authenticate with the Gemini API. Ensure you have the google-generativeai package installed, which is listed in the project's requirements.txt.

Step-by-Step Configuration

1. Set the Environment Variables

The application uses python-dotenv to load configuration from .env files. Create a .env file in your project root based on the provided template:

cp main/.env.example .env

Edit the file to include your Gemini credentials:

GEMINI_API_KEY=your_actual_key_here
LLM_PROVIDER=gemini
DEFAULT_MODEL=gemini-2.5-pro

The main/prompt.py module loads these variables at lines 12-18 using load_dotenv(), then reads GEMINI_API_KEY at lines 66-68. If this key is missing, validation logic raises an error early to prevent unauthorized API calls.

2. Verify Model-to-Provider Mapping

In main/prompt.py (lines 36-44 and 55-63), the application maps model names to provider enums. All Gemini model names (such as gemini-2.5-pro or gemini-2.5-flash) are automatically mapped to ModelProvider.GEMINI. This mapping ensures that when you specify a Gemini model in DEFAULT_MODEL, the system instantiates the correct backend class.

3. Install Dependencies

Ensure the Google Generative AI SDK is available in your environment:

pip install -r requirements.txt

How the Gemini Integration Works

Understanding the architecture helps troubleshoot configuration issues.

Environment Loading in prompt.py

The main/prompt.py module handles environment initialization. It calls load_dotenv() to read .env files, then exposes GEMINI_API_KEY to the rest of the application. This design keeps credentials out of source code while making them available to provider classes.

Provider Implementation in models.py

The GeminiProvider class in main/models.py (lines 13-21) wraps the Google Gemini API. Its constructor receives the API key and calls google.generativeai.configure(api_key=...) to authenticate the client.

When processing chat requests, the GeminiProvider.chat() method (lines 48-66) constructs a GenerativeModel instance using the model name from DEFAULT_MODEL and generation parameters from MODEL_PARAMETERS in prompt.py. It forwards user messages to the Gemini API and returns responses in a format compatible with the Hiring Agent's evaluation pipeline.

Running the Hiring Agent with Gemini

Once configured, execute the evaluation script:

python -m main.evaluate path/to/resume.json

The agent will now route all LLM calls through Google Gemini using the specified model and parameters.

Alternative: Programmatic Configuration

If you prefer not to use a .env file, set the variables in Python before importing the agent modules:

import os

os.environ["GEMINI_API_KEY"] = "your-key-here"
os.environ["LLM_PROVIDER"] = "gemini"
os.environ["DEFAULT_MODEL"] = "gemini-2.5-flash"

from main.evaluate import evaluate_resume

# Your evaluation code here

This approach works because main/prompt.py reads environment variables at import time, allowing dynamic configuration without touching the filesystem.

Summary

  • Environment Variables: Set GEMINI_API_KEY, LLM_PROVIDER=gemini, and DEFAULT_MODEL in your .env file or shell environment.
  • Provider Mapping: The system automatically maps Gemini model names to ModelProvider.GEMINI in main/prompt.py (lines 36-44).
  • Implementation: The GeminiProvider class in main/models.py wraps the Google Generative AI SDK and handles authentication via google.generativeai.configure().
  • Validation: The application validates the API key presence before constructing the provider to prevent runtime errors.
  • Configuration Source: The main/.env.example file provides a template for all required environment variables.

Frequently Asked Questions

What happens if I don't set the GEMINI_API_KEY?

If the GEMINI_API_KEY environment variable is empty or missing, the Hiring Agent will raise a validation error during initialization. The validation logic checks for the key's presence before constructing the GeminiProvider, ensuring the application fails fast with a clear error message rather than attempting unauthorized API calls.

Can I use different Gemini models for different evaluation tasks?

Yes. The DEFAULT_MODEL environment variable accepts any Gemini model name supported by the Google API, such as gemini-2.5-pro or gemini-2.5-flash. The model-provider mapping in main/prompt.py recognizes these names and routes them to the GeminiProvider class accordingly, allowing you to switch models by changing a single environment variable.

How do I switch back to Ollama from Gemini?

To revert to the default Ollama backend, change the LLM_PROVIDER environment variable to ollama or remove it entirely, as Ollama is the default provider. Ensure your Ollama server is running locally, and update DEFAULT_MODEL to an Ollama-compatible model name such as llama2 or mistral.

Where does the Hiring Agent validate the Gemini API key?

The application validates the GEMINI_API_KEY in llm_utils.py before instantiating the GeminiProvider class. This validation ensures that if the key is missing or empty, the error is raised immediately when the module loads, rather than during the first chat request to the Gemini API.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →