Skip to main content

Version-Constrained API Specification Engine (VCASE)

Project description

Version-Constrained API Specification Engine

A deterministic, version-aware knowledge streaming infrastructure for Large Language Models (LLMs).

Why does this exist?

When LLMs generate code, they frequently rely on outdated training data or hallucinate API signatures for newer libraries. Traditional Retrieval-Augmented Generation (RAG) is often static and misses critical version-specific nuances or architectural constraints.

This engine replaces static RAG with a five-layer defense system. It dynamically extracts exact project dependencies, resolves them to specific versions, and streams deterministic API contracts and interaction rules directly into the LLM's system prompt.

Core Features

  • Zero-Hallucination API Contracts: Injects exact function signatures based on the specific version of the library you are using.
  • Architectural Guardrails: Enforces complex interaction patterns (e.g., "Temporal workflows cannot be executed directly inside FastAPI route handlers").
  • Language Agnostic Architecture: Built on a provider interface allowing expansion beyond Python to Node, Rust, Go, etc.

Installation

Install VCASE directly in your local environment:

# For development/editable mode:
pip install -e .

# Or standard install:
pip install .

This installs the package and registers the vcase executable globally.

Resolution Architecture

The engine uses a strict Tiered Fallback Strategy to guarantee dependency accuracy before building the specification:

  1. Tier 1: Lock Files (Highest Priority)
    • Parses deterministic manifests (e.g., poetry.lock) to extract exact, pinned versions.
  2. Tier 2: Declaration Files
    • Parses abstract declarations (e.g., pyproject.toml, requirements.txt).
    • Connects to ecosystem registries (like PyPI) to resolve loose constraints (like ^1.2.0) to the latest compatible version.
  3. Tier 3: Containerized Introspection (Future)
    • Sandboxed subprocess execution (pip freeze, npm ls) for deeply nested or hidden dependencies.

Component Flow

  1. TechnologyDetector: Scans the repository or user prompt against a curated list of ~180 production-grade technologies to identify the stack.
  2. DependencyResolver: Orchestrates the tiered fallback logic across all available Ecosystem Providers.
  3. EcosystemProvider (e.g., PythonProvider): Parses the specific manifest syntax of the language.
  4. PypiClient: Makes async, defensive network requests to fetch current metadata and documentation sources.
  5. SpecBuilder: Assembles the final, non-negotiable System Prompt block, formatting parameters, return types, and deprecation warnings.

Usage / Integration

Currently, the engine provides internal APIs to assemble the System Prompt constraints.

# Example Internal Flow (Pseudocode)
from vcase.service.resolver import DependencyResolver
from vcase.service.spec_builder import SpecBuilder

# 1. Resolve exact versions used in the project
resolver = DependencyResolver(providers=[PythonProvider(...)])
resolved_deps = await resolver.resolve(Path("./my_project"))

# 2. Fetch the metadata/signatures internally 
# ...

# 3. Build the strict constraints for the LLM
builder = SpecBuilder()
system_instruction = builder.build_system_prompt(api_indexes, patterns)

print(system_instruction) 
# Outputs: 
# ## litellm@1.40.0
# - litellm.completion(model:str,messages:list) -> ModelResponse
# 
# Pattern: fastapi + temporalio
# Description: Workflows must run in workers.
# Correct Pattern: Run workflows in workers or separate processes.
# Incorrect Pattern: Do not execute workflows directly inside route handlers.
# Disallowed In: app.post, app.get
# Allowed In: workers, scripts
# Rule Name: [NO_WORKFLOW_IN_HANDLER]: Temporal workflows cannot run in FastAPI handlers

Contributing

When adding a new Ecosystem Provider (e.g., NodeProvider), you must adhere to the asynchronous contract defined in vcase/providers/base.py. All registry interactions must be defensive and non-blocking.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vcase_auto_context-0.1.2.tar.gz (47.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vcase_auto_context-0.1.2-py3-none-any.whl (54.4 kB view details)

Uploaded Python 3

File details

Details for the file vcase_auto_context-0.1.2.tar.gz.

File metadata

  • Download URL: vcase_auto_context-0.1.2.tar.gz
  • Upload date:
  • Size: 47.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for vcase_auto_context-0.1.2.tar.gz
Algorithm Hash digest
SHA256 08343a92144df39622d8e641f30a4fc20f7fa1d187a88bf84bf1e83d4a7da1af
MD5 d9ab24406c14441fafb59bcc379f5160
BLAKE2b-256 14db85ea51d7ba80fcad925631f45cc82ed0af03885c9ba464d62f67ff33d23d

See more details on using hashes here.

File details

Details for the file vcase_auto_context-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for vcase_auto_context-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 92804310650a93d00bf8d5889e9fdd5b93b19bf754cd1e3d8b17d02132743181
MD5 6b4bab804f90031592e691d5d2f6abc1
BLAKE2b-256 2c36b45c794bc8275859b2d59f0907d6b8cdce505eb997e3fcdb78e2410a9055

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page