generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 443
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Problem Statement
Strands has a set of content blocks that it supports, but if a custom model provider wants to implement its own custom content block, there is no easy way to do this today.
Proposed Solution
Strands introduces a new GenericContentBlock
that is passed through and treated normally by strands. Then model provider can have their own custom implementation for how to handle the generic content type if they wish.
Additionally, existing model providers can also have an extensibility mechanism to handle this generic case, where the user can define how the generic is transformed when using it to call the underlying model.
This could be:
- A new parameter to pass in during model provider init that is a function which maps generic types
def map_generic(generic: GenericContentBlock) -> Any:
...
model = BedrockModel(generic_mapper=map_generic)
- A method on a class that can be overridden by extending that class
class GenericHandlingBedrockModel(BedrockModel):
@override
def map_generic(generic: GenericContentBlock) -> Any:
...
Use Case
- A new feature is added to a model provider, but strands hasnt updated their content block implementation to handle it yet
- There is a temporary regression in a model provider that strands does not intend to fix, but blocks certain use cases
- A model provider supports content types outside of the types currently in strands, and strands does not plan to support those
Alternatives Solutions
No response
Additional Context
No response
dbschmigelski
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request