Fix/nlp conditional parsing 17668343675982894612#233
Merged
GauravKarakoti merged 4 commits intoGauravKarakoti:mainfrom Feb 18, 2026
Merged
Conversation
…897033629532608424 Deterministic Boot and Health Check for Bot
- Extended `ParsedCommand` schema in `groq-client.ts` to include `conditions` object and updated `amountType`. - Improved LLM system prompt to extract conditions like "only if" and "above/below". - Implemented `normalizeNumber` helper in `parseUserCommand.ts` to handle 'k'/'m' suffixes and strip `$` characters. - Added regex fallback logic in `parseUserCommand.ts` to catch conditions missed by LLM. - Updated `REGEX_CONDITION` to support 'k'/'m' suffixes in deterministic parsing. - Added safety check in `bot.ts` to prevent automated execution of conditional swaps for now. - Added new test file `bot/src/tests/conditional-parsing.test.ts` to verify new parsing logic. Co-authored-by: navin-oss <181780004+navin-oss@users.noreply.github.com>
Contributor
|
@google-labs-jules[bot] is attempting to deploy a commit to the Gaurav's projects Team on Vercel. A member of the Team first needs to authorize it. |
✅ Deploy Preview for swapsmithminiapp canceled.
|
Owner
|
Good work @navin-oss |
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.
Improved the NLP parsing logic to correctly identify conditional swaps (e.g., "only if price > 60k") and percentage-based amounts. This includes extending the parser schema, updating the LLM prompt, adding regex fallbacks with unit support (k/m), and implementing a safety guard to prevent accidental execution of these new conditional commands until fully automated. Verified with new test cases.