feat(api): add debug endpoints for prod/local diagnosis#17
Merged
Conversation
Add comprehensive debug endpoints to diagnose inconsistency between production and local environments where production returns low confidence responses while local works correctly. Changes: - Add GET /debug endpoint exposing version, config, and sample embeddings - Enhance POST /retrieve to include embedding prefixes for comparison - Import necessary functions (generateEmbedding, queryChunks, ragConfig) Debug endpoint exposes: - Version info (git commit SHA, build time, node version) - Configuration (models, temperature, thresholds) - Vector store stats (mode, document count) - Sample embeddings (first 5 values from 2 chunks) - Environment info (API key prefix, platform) Retrieve endpoint now includes: - queryEmbedding (first 10 values for comparison) - embeddingPrefix for each chunk (first 10 values) Related to investigation of PR #15 fallback behavior in production.
This was referenced Feb 7, 2026
GMNAPI
added a commit
that referenced
this pull request
Feb 7, 2026
Resolved conflicts: - .gitignore: Both versions identical, kept unified version - src/api/chat.ts: Kept main's version with debug endpoints (PR #17)
GMNAPI
pushed a commit
that referenced
this pull request
Feb 7, 2026
Remove references to r.chunk.embedding in /retrieve and /debug endpoints. ContentChunk does not have an embedding property - embeddings are stored in the vector DB and not returned on retrieval queries. Replace embeddingPrefix with score in /debug for more useful diagnostics. Fixes TypeScript build error blocking Railway deployments since PR #17. Co-authored-by: Cursor <cursoragent@cursor.com>
2 tasks
GMNAPI
added a commit
that referenced
this pull request
Feb 7, 2026
Remove references to r.chunk.embedding in /retrieve and /debug endpoints. ContentChunk does not have an embedding property - embeddings are stored in the vector DB and not returned on retrieval queries. Replace embeddingPrefix with score in /debug for more useful diagnostics. Fixes TypeScript build error blocking Railway deployments since PR #17. Co-authored-by: DevFBI <dev@fastbyte.es> Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds comprehensive debug endpoints to diagnose why production returns low-confidence responses while local environment works correctly (issue #16).
What's Added
New Endpoint:
GET /debugReturns complete diagnostic information:
Enhanced Endpoint:
POST /retrieveNow includes:
queryEmbedding: First 10 values for comparisonembeddingPrefix: First 10 values for each retrieved chunkHow to Use
Test Locally:
Compare Local vs Prod:
Diagnosis Steps (Next)
Related
Test plan
/debugendpoint🤖 Generated with Claude Code