Embeddings Engine
PRSense fundamentally relies on Embeddings to perform semantic similarity matching across your organization’s entire codebase and pull request history.
What are Embeddings?
In machine learning, an embedding is a way to represent text (or code) as an array of numbers (a vector) in a high-dimensional space. By converting text to these vectors, PRSense can mathematical calculate how “close” two pieces of code or pull request descriptions are to each other.
Unlike traditional string-matching or regex search, vector search understands context and meaning.
Add user login authenticationImplement auth layer with JWT
A keyword search might miss the connection, but vector embeddings understand they represent the exact same engineering effort.
How PRSense Uses Embeddings
When a developer opens a Pull Request, PRSense processes the metadata and diffs through our embedding pipeline:
- Extraction: Code changes, PR titles, and descriptions are extracted.
- Vectorization: The content is passed through an Embedding Model (either OpenAI’s
text-embedding-3-smallor our local, zero-cost ONNX fallback model). - Storage: The resulting high-dimensional vector is stored in our PGVector database.
- Search: We perform a Cosine Similarity Search against thousands of past PRs in milliseconds.
Bring Your Own Key (BYOK) vs Local ONNX
We offer two distinct embedding engines to fit your compliance and cost needs:
1. OpenAI Embeddings (BYOK)
For maximum accuracy and semantic comprehension, you can provide your own OpenAI API key. PRSense will use the state-of-the-art embedding models to build your knowledge graph.
2. Local ONNX Models
If your organization has strict data-residency requirements or wants to avoid API costs, PRSense seamlessly falls back to local ONNX models. These models run directly on your infrastructure (or in the API container) using onnxruntime-node. No code ever leaves your servers.
PRSense