Repository navigation
Backend llm search pr - #428
bryanshao07 wants to merge 4 commits into
Conversation
…pping, injection comment accuracy
|
[diff-counting] Significant lines: 1007. This diff might be too big! Developer leads are invited to review the code. |
|
|
|
Nice work overall the endpoint is well structured, and I especially like the response validation. I ran the focused test suite locally and all 35 tests passed. I found a one thing I think you should address before merging:
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@NigelTatem Thanks for the review! I just added the fix to your comment. The order per-IP limiter → body validation → global limiter → handler, and I added additional tests for that. |
Summary
This adds a new
POST /api/llm-searchendpoint that takes a natural language query (like "cheap studio near campus") and turns it into structured search filters using Gemini 3.5 Flash-Lite.Test Plan
Wrote 35 Jest (our test runner) tests covering the main stuff: bad input handling, making sure the query can't hijack the prompt, what happens when Gemini returns garbage or times out, and the rate limiter working
yarn tscandyarn lintboth run successfullyTo run it:
yarn jest llmSearch.test.tsfrombackend/, just needs any non-empty value forGEMINI_API_KEYsince all the Gemini calls are mocked (no real API key is needed for test)Haven't done a full manual test against the live Gemini API yet
Notes
Added two new deps:
express-rate-limitandzodTo run in prod, it needs a real
GEMINI_API_KEY