sdk-python icon indicating copy to clipboard operation
sdk-python copied to clipboard

[FEATURE] Model Specific Feature Mechanism

Open dbschmigelski opened this issue 5 months ago • 5 comments

Problem Statement

Currently, different models on Bedrock and other providers have specific requirements and limitations that can cause runtime failures. For example, DeepSeek R1 has issues with reasoningContent in messages that other models like Claude don't have (as seen in PR #652 ). We need a systematic way to handle these model-specific configurations and requirements.

Proposed Solution

No response

Use Case

The system should implement a configuration registry pattern where model-specific behaviors are defined in external configuration files rather than scattered throughout the codebase with if-statements. This approach would be similar to how the SDK currently handles other features (as seen in various issues like #652 and #713).

For example, instead of:

if model == "deepseek":
    strip_reasoning_content()
elif model == "claude":
    handle_token_limits()

The system would use a declarative configuration approach where model capabilities and limitations are defined in configuration files, and a single handler processes these configurations. This keeps the core code clean and maintainable while moving model-specific logic to configuration rather than implementation.

This design would align with the SDK's existing architecture while preventing the proliferation of model-specific conditional statements throughout the codebase, as evidenced by the challenges seen in the DeepSeek reasoning content issue (#652) and other model-specific issues in the repository.

Alternatives Solutions

No response

Additional Context

No response

dbschmigelski avatar Sep 02 '25 20:09 dbschmigelski

Additional example of model/provider specific logic https://github.com/strands-agents/sdk-python/issues/630

model = BedrockModel(
    model_id="openai.gpt-oss-120b-1:0",
    streaming=False,
)

Strands should know gpt oss must use Converse and automatically use it.

dbschmigelski avatar Sep 03 '25 15:09 dbschmigelski

Additional example https://github.com/strands-agents/sdk-python/pull/686 relating to non-claude models and the inclusion of the status field.

dbschmigelski avatar Sep 03 '25 18:09 dbschmigelski

Hey, any news on it? Thanks!

matheus-1618 avatar Sep 22 '25 22:09 matheus-1618

Qwen model has same issue with Deepseek. It rejects messages that include reasoning content. Currently only when using Deepseek model, it filtered out them

https://github.com/strands-agents/sdk-python/blob/8cae18cdc9a70cd892188485c2df47698a17af55/src/strands/models/bedrock.py#L335

For the just workaround, I replace if statement as bellow then it worked.

if any(model in self.config["model_id"].lower() for model in ["deepseek", "qwen"]) and "reasoningContent" in content_block:

I don't think it's a good idea at all, but it seems like this is the only option at the moment.

YAMABASS80 avatar Nov 14 '25 02:11 YAMABASS80

@dbschmigelski We should also consider https://github.com/strands-agents/sdk-python/issues/1241 while implementing this.

azaylamba avatar Dec 10 '25 11:12 azaylamba