Understanding the Role of prompt.py in the Hiring-Agent Project

The prompt.py module serves as the central configuration hub for all Large Language Model (LLM) interactions in the hiring-agent codebase, consolidating environment variables, model defaults, provider mappings, and inference parameters into a single source of truth.

The interviewstreet/hiring-agent repository uses prompt.py to decouple LLM configuration from business logic. Located at the project root, this file ensures that modules like score.py, pdf.py, and github.py access consistent model settings without hardcoding provider-specific details, making the role of prompt.py in the hiring-agent project critical for maintainability.

Environment and Model Configuration

prompt.py initializes the runtime environment for LLM operations through six distinct responsibilities:

Loading Environment Variables

At lines 8-14, the module imports dotenv and invokes load_dotenv() to pull runtime configuration from a .env file. This includes critical variables such as DEFAULT_MODEL, LLM_PROVIDER, and GEMINI_API_KEY, ensuring sensitive credentials remain outside version control.

Default Model Selection

Lines 15-22 define the fallback model (gemma3:4b) and read the DEFAULT_MODEL override from the environment. This design allows operators to switch models without touching application code, as the constant propagates to all downstream consumers.

Provider Validation and Mapping

The file validates provider strings against a ModelProvider enum at lines 23-26, defaulting to OLLAMA when the value is unsupported. Lines 46-64 establish MODEL_PROVIDER_MAPPING, linking each model name to its concrete implementation (ModelProvider.OLLAMA or ModelProvider.GEMINI), which determines which client class gets instantiated at runtime.

Inference Parameters

Lines 27-44 define MODEL_PARAMETERS, a dictionary containing per-model tuning knobs like temperature and top_p. Downstream components forward these values directly to the LLM API, allowing fine-grained control over generation behavior without scattering magic numbers throughout the codebase.

API Key Management

For Gemini integration, lines 66-68 extract GEMINI_API_KEY from the environment, making it available to provider classes while maintaining security best practices.

Integration Patterns Across the Codebase

Other modules import constants from prompt.py rather than defining their own defaults. This pattern appears consistently across the repository.

Configuration Imports in score.py

The evaluation logic in score.py imports the default configuration to drive resume scoring:

from prompt import DEFAULT_MODEL, MODEL_PARAMETERS

# Use centralized defaults for evaluation

model_params = MODEL_PARAMETERS.get(DEFAULT_MODEL)
evaluator = ResumeEvaluator(
    model_name=DEFAULT_MODEL,
    model_params=model_params,
)

Provider Initialization Workflow

The mapping defined in prompt.py enables dynamic provider instantiation. Applications initialize the correct client class based on the model name:

from prompt import DEFAULT_MODEL, MODEL_PROVIDER_MAPPING, GEMINI_API_KEY
from models import ModelProvider, OllamaProvider, GeminiProvider

def initialize_llm_provider(model_name: str):
    provider = MODEL_PROVIDER_MAPPING[model_name]
    if provider == ModelProvider.OLLAMA:
        return OllamaProvider()
    elif provider == ModelProvider.GEMINI:
        return GeminiProvider(GEMINI_API_KEY)
    raise ValueError(f"Unsupported provider for model {model_name}")

PDF Processing Integration

The pdf.py module demonstrates practical usage in document extraction workflows:

from prompt import DEFAULT_MODEL, MODEL_PARAMETERS
from utils import initialize_llm_provider

provider = initialize_llm_provider(DEFAULT_MODEL)
response = provider.chat(
    model=DEFAULT_MODEL,
    messages=[{"role": "user", "content": "Extract the Experience section"}],
    options=MODEL_PARAMETERS[DEFAULT_MODEL],
)

Extending Configuration for New Providers

When adding support for new models or providers, prompt.py remains the single file requiring modification. Update MODEL_PROVIDER_MAPPING to include the new model-to-provider association, add any model-specific parameters to MODEL_PARAMETERS, and ensure the corresponding API key loads from the environment. The rest of the hiring-agent codebase automatically adapts to these changes through the existing import patterns.

Summary

  • prompt.py acts as the central configuration hub for LLM interactions in interviewstreet/hiring-agent.
  • Environment loading occurs at lines 8-14 via dotenv.load_dotenv(), securing API keys and model preferences.
  • Model defaults are defined at lines 15-22, with gemma3:4b serving as the fallback.
  • Provider mapping at lines 46-64 links models to their concrete implementations (OLLAMA or GEMINI).
  • Inference parameters at lines 27-44 configure temperature, top_p, and other tuning knobs.
  • Decoupled architecture allows modules like score.py, pdf.py, and github.py to import settings without hardcoding provider logic.

Frequently Asked Questions

What is the default model configured in prompt.py?

The default model is gemma3:4b, defined as a fallback at lines 15-22. This value is overridden when the DEFAULT_MODEL environment variable is set in the .env file, allowing deployment-specific configurations without code changes.

How does prompt.py handle different LLM providers?

The module validates provider strings against the ModelProvider enum at lines 23-26, defaulting to OLLAMA when unsupported. Lines 46-64 define MODEL_PROVIDER_MAPPING, which associates each model name with its specific provider implementation, enabling the codebase to instantiate the correct client class dynamically.

Where are API keys managed in the hiring-agent project?

API keys are loaded from environment variables via dotenv.load_dotenv() at lines 8-14. Specifically, GEMINI_API_KEY is extracted at lines 66-68 for Gemini provider initialization, keeping sensitive credentials out of version control while making them accessible to downstream modules.

Can I add a new model to prompt.py without modifying other files?

Yes. Adding a new model requires updating three sections in prompt.py: add the model name to MODEL_PROVIDER_MAPPING (lines 46-64), define its parameters in MODEL_PARAMETERS (lines 27-44), and optionally load specific API keys. Since score.py, pdf.py, and other modules import these values dynamically, they automatically recognize new configurations without requiring additional changes.

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 →