Skip to content

Commit 10a6571

Browse files
committed
fix: raise ValueError when 'model' is passed instead of 'model_name' in BedrockEmbedding
Raises a clear ValueError when users pass model= instead of model_name= to BedrockEmbedding. Previously, model= was silently absorbed by **kwargs and ignored, causing the default model (amazon.titan-embed-text-v1) to be used unexpectedly. Bump llama-index-embeddings-bedrock version to 0.7.4.
1 parent 59b4cc6 commit 10a6571

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

llama-index-integrations/embeddings/llama-index-embeddings-bedrock/llama_index/embeddings/bedrock/base.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ def __init__(
147147
output_parser: Optional[BaseOutputParser] = None,
148148
**kwargs: Any,
149149
):
150+
if "model" in kwargs:
151+
raise ValueError(
152+
"The 'model' parameter is not supported. "
153+
"Please use 'model_name' instead to specify the Bedrock model ID."
154+
)
155+
150156
additional_kwargs = additional_kwargs or {}
151157

152158
session_kwargs = {

llama-index-integrations/embeddings/llama-index-embeddings-bedrock/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dev = [
2727

2828
[project]
2929
name = "llama-index-embeddings-bedrock"
30-
version = "0.7.3"
30+
version = "0.7.4"
3131
description = "llama-index embeddings bedrock integration"
3232
authors = [{name = "Your Name", email = "you@example.com"}]
3333
requires-python = ">=3.9,<4.0"

llama-index-integrations/embeddings/llama-index-embeddings-bedrock/tests/test_bedrock_embedding.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ def test_class():
99
assert BaseEmbedding.__name__ in names_of_base_classes
1010

1111

12+
def test_model_param_raises_error():
13+
"""Test that passing 'model' instead of 'model_name' raises ValueError."""
14+
bedrock_client = boto3.client("bedrock-runtime", region_name="us-east-1")
15+
with pytest.raises(ValueError, match="Please use 'model_name' instead"):
16+
BedrockEmbedding(model="cohere.embed-multilingual-v3", client=bedrock_client)
17+
18+
1219
def test_get_provider_two_part_format():
1320
"""Test _get_provider with 2-part model names (provider.model)."""
1421
bedrock_client = boto3.client("bedrock-runtime", region_name="us-east-1")

llama-index-integrations/embeddings/llama-index-embeddings-bedrock/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)