Skip to content

Sa692 soc prompts st2 st3#30

Open
peter-spencer-ons wants to merge 25 commits into
mainfrom
SA692_soc_prompts_st2_st3
Open

Sa692 soc prompts st2 st3#30
peter-spencer-ons wants to merge 25 commits into
mainfrom
SA692_soc_prompts_st2_st3

Conversation

@peter-spencer-ons

@peter-spencer-ons peter-spencer-ons commented May 29, 2026

Copy link
Copy Markdown
Contributor

✨ Summary

Adds stage 2 and 3 in the two prompt SOC pipeline.
Changes in this PR are required for (ONSdigital/survey-assist-eval#9) to be tested.

Mirrors the same steps as in SIC pipeline (sic-classification-utils).

📜 Changes Introduced

Introduced changes to

  • added methods using LLM (evaluation of the codability, generating open follow up question).
  • added validation models for responses.
  • added prompts (prompt for codability evaluation, and open follow up question )
  • added tests to meet the required 80% coverage.

✅ Checklist

Please confirm you've completed these checks before requesting a review.

  • Code is formatted using ruff format
  • Imports are sorted using ruff
  • Code passes linting with ruff and mypy
  • Security checks pass using Bandit
  • API and Unit tests are written and pass using pytest
  • Terraform files (if applicable) follow best practices and have been validated (terraform fmt & terraform validate)
  • DocStrings follow Google-style and are added as per ruff recommendations
  • Documentation has been updated if needed

🔍 How to Test

Test in (ONSdigital/survey-assist-eval#9)

@peter-spencer-ons peter-spencer-ons marked this pull request as ready for review June 1, 2026 17:11
@peter-spencer-ons peter-spencer-ons requested a review from ivyONS June 1, 2026 17:11
Comment thread src/occupational_classification_utils/llm/llm.py Outdated
Comment thread src/occupational_classification_utils/llm/prompt.py Outdated
Comment thread src/occupational_classification_utils/models/response_model.py
Raises:
ValueError: If the number of candidates is not within the allowed range.
"""
if not 1 <= len(v) <= MAX_ALT_CANDIDATES:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

does it really have to have at least 1 alt candidate?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it is worth keeping at least one candidate in case we want to verify LLM's selection.

Also we have been using minimum number of candidates 1 for alt_candidates to ensure there is at least one.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

but if it is clearly codable and it assigned one code, there are unlikely any suitable alternatives, in such a case the list of alternative candidates should be empty

Comment thread src/occupational_classification_utils/llm/llm.py
- Company's main activity: {industry_descr}
- Job Title: {job_title}
- Job Description: {job_description}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

where is the level of edu??

@peter-spencer-ons peter-spencer-ons requested a review from ivyONS June 4, 2026 17:03
industry_descr: str,
job_title: str | None = None,
job_description: str | None = None,
level_of_education: str | None = None,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

you have added the level of edu to the sa_rag_soc_code method but not to its prompt

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