Skip to content

fix(recommender): implement dynamic batch size for recommendations an…#67

Merged
rav3n11 merged 2 commits into
mainfrom
feat/recommendation-in-batches
Jul 13, 2026
Merged

fix(recommender): implement dynamic batch size for recommendations an…#67
rav3n11 merged 2 commits into
mainfrom
feat/recommendation-in-batches

Conversation

@rav3n11

@rav3n11 rav3n11 commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_more intent.
  • 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 thread backend/app/server.py
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)

@rav3n11
rav3n11 merged commit b130ce8 into main Jul 13, 2026
6 checks passed
@rav3n11
rav3n11 deleted the feat/recommendation-in-batches branch July 13, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants