Skip to content

Commit

Permalink
Fix : short_term_memory with bedrock - using user defined model(when …
Browse files Browse the repository at this point in the history
…passed as attribute) rather than default (#1959)

* Update embedding_configurator.py

Modified  _configure_bedrock method to use user submitted model_name rather than default  amazon.titan-embed-text-v1.

Sending model_name in short_term_memory (embedder_config/config) was not working.


 # Passing model_name to use model_name provide by user than using default. Added if/else for backward compatibility

* Update embedding_configurator.py

Incorporated review comments

---------

Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com>
  • Loading branch information
rishi154 and bhancockio authored Feb 4, 2025
1 parent 9cf3fad commit 5154784
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/crewai/utilities/embedding_configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,11 @@ def _configure_bedrock(config, model_name):
AmazonBedrockEmbeddingFunction,
)

return AmazonBedrockEmbeddingFunction(
session=config.get("session"),
)
# Allow custom model_name override with backwards compatibility
kwargs = {"session": config.get("session")}
if model_name is not None:
kwargs["model_name"] = model_name
return AmazonBedrockEmbeddingFunction(**kwargs)

@staticmethod
def _configure_huggingface(config, model_name):
Expand Down

0 comments on commit 5154784

Please sign in to comment.