Skip to content

[BUG] Amazon Bedrock Embedder Config #2299

Open
@smitius

Description

@smitius

Description

I saw several posts about it but the documentation is not clear on this point.

When using knowledge, and take the simplest implementation on the CREW level there are my observations for an application that uses AWS exclusively.

KB is initialized as following:


best_practices_source = TextFileKnowledgeSource(
	file_paths=[
		kb_file,
	]
)

1/ When KB is initialized without the embedded config in the CREW class this is the output: [2025-03-06 19:05:14][WARNING]: Failed to init knowledge: Please provide an OpenAI API key. You can get one at https://platform.openai.com/account/api-keys
Result: No knowledge is extracted but the flow continues

2/ In case KB is initialized with the embedder config:

			agents=self.agents, 
			tasks=self.tasks, 
			process=Process.sequential,
			verbose=True,
			task_callback=on_task_complete,
			embedder={
				"provider": "bedrock",
				"config": {
					"model": "amazon.titan-embed-text-v2:0",
				}
			},
			knowledge_sources=[
				best_practices_source
			]
		)

The response is [2025-03-06 19:10:29][WARNING]: Failed to init knowledge: 'NoneType' object has no attribute 'client'

This points me to an issue with the embedder config. However, I can't find information how to properly initialize it as all examples are with Gemini and their API key as parameter. My question is how to debug this and where can I learn more. I would preferably want to use the crewai tools rather than just develop a custom tool.

For reference if I do knowledge base creation on AWS directly via SDK this is how:
self._retrieve_and_generate(bedrock_agent_runtime_client, knowledge_base_id, question) where the runtime is defined as bedrock_agent_runtime_client = boto3.client('bedrock-agent-runtime', region_name=region_name)

I do have access to the models.

Any guidance is welcome.

Steps to Reproduce

See steps 1 and 2 above

Expected behavior

Ideally to be able to use the embedder or KB with crewai

Screenshots/Code snippets

as per above

Operating System

macOS Sonoma

Python Version

3.10

crewAI Version

0.102.0

crewAI Tools Version

0.36.0

Virtual Environment

Venv

Evidence

as per above

Possible Solution

wrong embedder configuration for AWS Bedrock

Additional context

none

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions