Skip to content

Conversation

@yashikabadaya
Copy link
Contributor

@yashikabadaya yashikabadaya commented Oct 23, 2025

Description

Added AWS Bedrock as a reranker provider in the docs:

  • Example configuration for AWS Bedrock reranker is now included.
  • AWS Bedrock is listed among supported reranker models.

Added code changes to support AWS Bedrock reranker.

Fixes #3501

Type of change

Please delete options that are not relevant.

New feature (non-breaking change which adds functionality)
Documentation update

How Has This Been Tested?

  • Unit Test
  • make build ensures code builds properly.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Maintainer Checklist

# Conflicts:
#	docs/components/rerankers/config.mdx
#	docs/components/rerankers/overview.mdx
#	mem0/configs/rerankers/base.py
#	mem0/utils/factory.py
@yashikabadaya yashikabadaya mentioned this pull request Oct 23, 2025
12 tasks
Copy link
Contributor

@parshvadaftari parshvadaftari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the failing tests and incorporate the requested changes, there's lot of duplicate code over here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this examples file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please match the writing style similar to here:

print(results)
```

## Prerequisites
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the section for the aws account setup, it's too textual and these steps shouldn't be documented here.

"api_key": "your-openai-key"
}
},
"reranker": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change reranker to rerank to make it align with the code base?

#### 4. IAM Roles (for EC2/Lambda)
```python
config = {
"reranker": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for the reranker here as well.

)

# Initialize reranker if configured
self.reranker = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate code here as well.

if threshold is None or mem.score >= threshold:
original_memories.append(memory_item_dict)

# Apply reranking if configured
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this code we have it's implementation in the search this becomes redundant.

if threshold is None or mem.score >= threshold:
original_memories.append(memory_item_dict)

# Apply reranking if configured
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing applies here.

except (ImportError, AttributeError) as e:
raise ImportError(f"Could not import reranker for provider '{provider_name}': {e}")

# For AWS Bedrock, tests expect the factory to pass a plain dict to the reranker
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit picking here, for the tests to pass we should update the tests and not code here, why are we explicitly handling aws bedrock config here?

@@ -0,0 +1 @@
"""Tests for reranker implementations."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants