Skip to content

Add classifyCategories function for llm scorecard #794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nlarew
Copy link
Collaborator

@nlarew nlarew commented Jun 30, 2025

Jira: (EAI-1107) Add Question Categorizations to Case Data

Changes

@nlarew nlarew requested a review from Copilot July 1, 2025 22:11
Copy link

@Copilot Copilot AI left a comment

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 introduces a new LLM-based classifier for question categorizations, adds a sample categories CSV, and updates package dependencies.

  • Add a comprehensive sample of categorized questions in CSV format for the classifier.
  • Implement classifyCategories.ts with an OpenAI-powered classifier and inline category definitions.
  • Reorder and dedupe dependencies in package.json for the llm-scorecard package.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/scripts/src/llm-scorecard/examples/categories.csv Add example dataset of questions with dataset, label, and question
packages/scripts/src/llm-scorecard/classifyCategories.ts Create classifyCategories function using makeClassifier
packages/scripts/package.json Reorder and remove duplicate dependency entries
Comments suppressed due to low confidence (2)

packages/scripts/src/llm-scorecard/classifyCategories.ts:145

  • [nitpick] There are no unit tests for classifyCategories. Adding tests with known prompts and expected categories will help ensure the classifier behaves as intended.
export const classifyCategories = makeClassifier({

packages/scripts/src/llm-scorecard/classifyCategories.ts:145

  • Add a JSDoc comment above this export to explain the purpose, input format, and output structure of classifyCategories for future maintainers.
export const classifyCategories = makeClassifier({

@@ -0,0 +1,465 @@
Dataset,Label,Question,
Copy link
Preview

Copilot AI Jul 1, 2025

Choose a reason for hiding this comment

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

The header row ends with an extra comma, which may lead to an unintended empty column when parsing. Please remove the trailing comma so it reads Dataset,Label,Question.

Suggested change
Dataset,Label,Question,
Dataset,Label,Question

Copilot uses AI. Check for mistakes.

apiVersion: env.OPENAI_API_VERSION,
});

const classificationTypes: ClassificationType[] = [
Copy link
Preview

Copilot AI Jul 1, 2025

Choose a reason for hiding this comment

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

[nitpick] This inline definition of many category examples can become hard to maintain as you add new categories. Consider loading this data from an external JSON or CSV file and transforming it into classificationTypes to keep the code concise.

Copilot uses AI. Check for mistakes.

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.

1 participant