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.

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
# - completion(model: str, messages: list) -> ModelResponse
# ⚠ PATTERN: fastapi + temporalio
# Rule [NO_WORKFLOW_IN_HANDLER]: Workflows must run in workers.

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.1.tar.gz (43.1 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.1-py3-none-any.whl (50.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vcase_auto_context-0.1.1.tar.gz
  • Upload date:
  • Size: 43.1 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.1.tar.gz
Algorithm Hash digest
SHA256 eb42ef96a51ae83d05cb3db8a4f5aba388505712016acb0106fb86734ebf4268
MD5 fab099d77278fc44ee588a61d94f7047
BLAKE2b-256 14c59d4f6abb123daf08ba8f65d5ce285fe95e367a689059f584686b7c99785d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vcase_auto_context-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 469e8f7ed7e5d26d8da413e9cdacd68765623507bcd1b1131bf688ec03375352
MD5 fc13b5dcb58165644666006392387e60
BLAKE2b-256 47c879ab8daba6d7d9c07ecfeb351edd4b3e893494fe67ee8423e90d50c60233

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