feat: add model subpath exports, rename GeminiModel to GoogleModel, and add api field to OpenAIModel#711
Conversation
- Add subpath exports under ./models/ (bedrock, openai, anthropic, google)
- Rename GeminiModel to GoogleModel, move src/models/gemini/ to src/models/google/
- Rename geminiTools config field to builtInTools
- Add required api field to OpenAIModelOptions ('chat' for Chat Completions API)
- Keep BedrockModel, OpenAIModel, AnthropicModel names unchanged
API Design Question: Nested vs Flat NamespacesThe SDK Decision Records state:
This PR changes model imports from flat paths ( Questions for API review:
The motivation makes sense for consistency with the Python SDK and future extensibility, but I wanted to flag this for explicit consideration during API review since it appears to diverge from the documented pattern. |
API Design Consideration:
|
Code Review SummaryAssessment: Comment This PR introduces important API changes for 1.0 readiness. The implementation is clean and well-tested, with comprehensive documentation in the PR description and a linked docs PR. Review Categories
Good work preparing this for 1.0! The design questions above are for API review consideration, not blocking concerns. |
Description
This PR introduces model subpath exports under
@strands-agents/sdk/models/*, renamesGeminiModeltoGoogleModel, and adds a requiredapifield toOpenAIModel. These changes prepare the SDK for 1.0 by establishing stable public API names and an extensible configuration pattern for model providers.Motivation
With 1.0 approaching this week, we want to lock in model provider naming that:
BedrockModel,OpenAIModel,AnthropicModel) rather than deviating with implementation-specific names likeConverseModelorChatModel. The class name should not expose the underlying API being used.@strands-agents/sdk/models/*for proper namespacing.Note, we tried to come up with a new naming convention under #694. This was a contested change though. Also, it would lead to a significant deviation from the Python SDK. We are too close to 1.0 and so opened this PR instead.
Public API Changes
Subpath exports moved under
@strands-agents/sdk/models/:BedrockModelis still exported top-level from@strands-agents/sdk, so existing top-level imports continue to work.GeminiModelrenamed toGoogleModelto align with the provider (not the product line) and thebuiltInToolsconfig field replacesgeminiTools:OpenAIModelnow requires anapifield that explicitly declares which OpenAI API to use. Currently only'chat'(Chat Completions) is supported. When Responses API support is added later,apiwill become optional and default to'responses', making that a non-breaking change for existing users.Related Issues
N/A
Documentation PR
strands-agents/docs#694
Type of Change
Breaking change
Testing
How have you tested the change?
npm run checkAll 1632 unit tests pass. Lint, format, and type-check are clean.
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.