-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Bedrock provider example for memory embedder #1933
base: main
Are you sure you want to change the base?
Conversation
Adding Bedrock example to docs
If there is a better/easier way, let me know, I dug the chromadb and crewai codebase for an hour to get this working. |
Disclaimer: This review was made by a crew of AI Agents. Code Review Report for PR #1933OverviewThe changes add documentation for using Amazon Bedrock embeddings with crewAI's memory system. The patch modifies Documentation Quality AnalysisPositive Aspects
Issues and Recommendations1. Indentation ConsistencyThe code example has inconsistent indentation in the embedder configuration. Current: embedder={
"provider": "bedrock",
"config":{
"session": boto3_session,
"model": "amazon.titan-embed-text-v2:0",
"vector_dimension": 1024
}
} Recommended Fix: embedder={
"provider": "bedrock",
"config": {
"session": boto3_session,
"model": "amazon.titan-embed-text-v2:0",
"vector_dimension": 1024
}
} 2. Missing Error Handling DocumentationConsider adding a note about potential errors and how to handle them: Recommended Addition: """
Note: Ensure all environment variables are properly set before initializing the boto3 session.
The code may raise boto3.exceptions.NoCredentialsError if credentials are missing.
Error handling example:
try:
boto3_session = boto3.Session(...)
except boto3.exceptions.NoCredentialsError:
print("AWS credentials not found. Please check your environment variables.")
""" 3. Environment Variables DocumentationAdd a section explaining required environment variables: Required Environment Variables: - AWS_REGION_NAME: Your AWS region (e.g., 'us-east-1')
- AWS_ACCESS_KEY_ID: Your AWS access key
- AWS_SECRET_ACCESS_KEY: Your AWS secret key 4. Code Style ImprovementsThe ellipsis usage for agents and tasks could be more informative: Current: agents=[...],
tasks=[...], Recommended: agents=[
# Add your agents here
# Example: Agent(name="researcher", ...)
],
tasks=[
# Add your tasks here
# Example: Task(description="research task", ...)
], 5. Missing Type HintsConsider adding type hints for better code documentation: Recommended Addition: from typing import Optional
from boto3.session import Session
boto3_session: Session = boto3.Session(
region_name: str = os.environ.get("AWS_REGION_NAME"),
aws_access_key_id: str = os.environ.get("AWS_ACCESS_KEY_ID"),
aws_secret_access_key: str = os.environ.get("AWS_SECRET_ACCESS_KEY")
) Security Considerations
Additional Recommendations
Overall AssessmentThe documentation addition is valuable and well-structured but could benefit from more comprehensive error handling, security considerations, and practical examples. The current implementation is functional but could be enhanced with the suggested improvements for better user experience and maintainability. Suggested Final Changes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding this!
Adding example on how to use Amazon Bedrock models as an embedder for memory.