Skip to main content

vllm-mock

Provide a mock instance to test vLLM without CUDA or any GPUs.

Features

  • vllm.LLM.generate mock
  • vllm.LLM.chat mock

Usage

It is highly recommended to use the mock instance with pytest-mock.

from vllm_mock import LLM
from vllm import SamplingParams

def test_vllm(mocker):
    mock_class = mocker.patch("vllm.LLM")
    mock_class.return_value = LLM(model="mock-model")

    llm = mock_class()
    sampling_params = SamplingParams(temperature=0.8, top_p=0.9, logprobs=1)
    response = llm.generate("Hello, world!", sampling_params=sampling_params)
    assert isinstance(response[0].outputs[0].text, str)

    chat_response = llm.chat([
		{"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Hello, world!"}
    ], sampling_params=sampling_params)
    assert isinstance(chat_response[0].outputs[0].text, str)

Installation

pip install vllm-mock pytest-mock

or in a UV environment

uv add --dev vllm-mock pytest-mock

To-do List

  • Mock vLLM API server
  • Mock Reasoning model features
  • Mock quantization features
  • Mock LoRA features
  • vLM models mock
  • vllm.LLM.beam_search mock
  • vllm.LLM.embed mock
  • vllm.LLM.classify mock
  • vllm.LLM.encode mock
  • vllm.LLM.reward mock

For Contributors

1. Setup Environment

First, clone a repository

git clone https://github.com/NomaDamas/vllm-mock.git
cd vllm-mock

Then, install the environment and the pre-commit hooks with

make install

This will also generate your uv.lock file

2. Run the pre-commit hooks

Initially, the CI/CD pipeline might be failing due to formatting issues. To resolve those run:

uv run pre-commit run -a

You can create any issue or PR to support this project. Thank you!

Builder of this repository

  • Jeffrey is a creator of this repo. Made this because he desperately needed it for his research.
  • NomaDamas is an AI open-source Hacker House in Seoul, Korea.

Repository initiated with fpgmaas/cookiecutter-uv.

Metadata

Release files for vllm-mock 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vllm-mock 0.0.3
File Size Uploaded Provenance
vllm_mock-0.0.3.tar.gz 301.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for vllm-mock 0.0.3
File Interpreter ABI Platform
vllm_mock-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 308.2 kB

Release files / vllm_mock-0.0.3.tar.gz

Download URL vllm_mock-0.0.3.tar.gz
Size 301.6 kB
Tags Source
SHA-256 checksum
How to use checksums
948634eca0f8cf49dfcaca5d4f7be64cc3c9d5d07a7da4a3eb00f3b3f73f254c
BLAKE2b-256 checksum
How to use checksums
7e6fa74e1dfd605665fb8b3efbc5d347bf6c40f17c29b8cee3e9f87e9084fd13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.14

Release files / vllm_mock-0.0.3-py3-none-any.whl

Download URL vllm_mock-0.0.3-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8a824313913457719f87be392783ca14a4032832a7aa0a1f8f56f33a7bf68a1
BLAKE2b-256 checksum
How to use checksums
24f7bcd0e755a9b56b3172ee20e87165445d276927cd4dc11840187059b61979
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.14

Security for vllm-mock 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page