OptimusPrime

OptimusPrime is a Python-based utility directory designed to interface with NVIDIA’s NIM (NVIDIA Inference Microservices) APIs. It provides a straightforward implementation using the standard openai Python SDK to interact with NVIDIA’s hosted large language models (LLMs).

Features

Prerequisites

Setup

  1. Set your API Key: Export your NVIDIA API key as an environment variable in your terminal session:

    export NVIDIA_API_KEY="your_api_key_here"
    
  2. Initialize the Virtual Environment: Navigate into the OptimusPrime directory and create a virtual environment using uv:

    cd OptimusPrime
    uv venv
    source .venv/bin/activate
    
  3. Install Dependencies: Install the required packages listed in requirements.txt:

    uv pip install -r requirements.txt
    

Usage

To run the automated code reviewer:

python reviewer.py

What happens under the hood?

  1. The script initializes the OpenAI client pointing base_url to NVIDIA’s API (https://integrate.api.nvidia.com/v1).
  2. It sends a sample Python function to the model specified by NVIDIA_MODEL (defaulting to meta/llama-3.3-70b-instruct).
  3. It uses a low temperature (0.2) to ensure deterministic and factual code review output.
  4. The API response is parsed and written to src/pages/review.md for instant Astro static site compilation.

Static Site Build & Appwrite Sites Deployment

To compile static HTML/CSS assets into dist/:

npm run build

This outputs a zero-JS bundle ready for Appwrite Sites deployment (dist/index.html and dist/review/index.html).