Skip to content

Add unit tests for BedrockClassifier in Python #448

@amandladev

Description

@amandladev

The BedrockClassifier implementation currently has no dedicated test coverage. The existing classifier tests only cover the generic Classifier base class and the AnthropicClassifier.
Since BedrockClassifier is the AWS-native classifier and a core component of the framework, it should have parity with the Anthropic test suite.

Proposed Changes
Add test_bedrock_classifier.py covering:

  • Initialization — client injection, auto-creation via boto3, AWS_REGION env fallback, custom model ID, inference coding defaults/overrides, user_agent registration.
  • Tool Schema — Bedrock toolSpec structure validation.
  • toolChoice branching — correctly added for Anthropic and Mistral Large model IDs, omitted for others.
  • Happy path — successful classification, agent selection, confidence parsing.
  • Error handling — no output, missing/empty toolUse, invalid tool input, BotoCoreError, ClientError.
  • Callbacks — on_classifier_start / on_classifier_stop invocation and argument verification.
  • Edge cases — non-existing agent, string-to-float confidence coercion, multiple content blocks, system prompt list format.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions