fix(recommender): implement dynamic batch size for recommendations an…#67
Merged
Conversation
…d add show more functionality [pulumi up]
There was a problem hiding this comment.
Pull request overview
This PR adds configurable recommendation pagination (“dynamic batch size”) for the Recommender/Advisor agent and introduces a new “show more” intent so users can request additional batches of recommendations without restarting the flow.
Changes:
- Adds
COMPASS_RECOMMENDATION_BATCH_SIZE(1–50, default 5) to IaC templates and propagates it through deployment into the backend runtime config. - Updates the intent classifier and present-phase handler to respect the configured batch size and to support a new
show_moreintent. - Implements pagination logic that tracks presented recommendation UUIDs and serves the next unseen batch per view (careers/jobs/both), including graceful “exhausted” messaging.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| iac/templates/env.template | Documents and validates the new batch-size env var. |
| iac/backend/deploy_backend.py | Wires the new env var into Cloud Run container environment. |
| iac/backend/main.py | Reads the new env var into IaC backend service config. |
| backend/app/server.py | Injects the new setting into ApplicationConfig at startup. |
| backend/app/app_config.py | Adds recommendation_batch_size to application config (default 5, range 1–50). |
| backend/app/agent/recommender_advisor_agent/phase_handlers/present_handler.py | Uses batch size everywhere “top 5” was used; adds SHOW_MORE pagination behavior. |
| backend/app/agent/recommender_advisor_agent/llm_response_models.py | Updates the intent schema description to include show_more. |
| backend/app/agent/recommender_advisor_agent/intent_classifier.py | Adds _batch_size() helper and updates prompts/selection lists to use it; teaches prompts about show_more. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+237
to
+240
| **( | ||
| {"recommendation_batch_size": int(os.environ["COMPASS_RECOMMENDATION_BATCH_SIZE"])} | ||
| if os.getenv("COMPASS_RECOMMENDATION_BATCH_SIZE") else {} | ||
| ), |
Comment on lines
+654
to
+656
| - ``careers`` view (or default) → next 5 occupations. | ||
| - ``jobs`` view → next 5 opportunities. | ||
| - ``both`` view → next 5 opportunities followed by next 5 occupations. |
Comment on lines
+553
to
+556
| # Handle SHOW_MORE intent - user wants the next batch of recommendations | ||
| elif intent.intent == "show_more": | ||
| return await self._handle_show_more_intent(user_input, state, context) | ||
|
|
…anslation and formatting
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.
…d add show more functionality [pulumi up]
https://tabiya-tech.atlassian.net/jira/software/c/projects/CORE/boards/105?issueType=10015%2C10014%2C10017&selectedIssue=CORE-543