Skip to content
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

Add config option for vertex embedding tasks #2266

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rst0070
Copy link

@rst0070 rst0070 commented Feb 27, 2025

Description

Feature
The feature will provide users with multiple options for embedding tasks of Vertex AI.

Motivation
Vertex AI offers multiple options for embedding tasks, allowing the extraction of text embeddings for specific use cases, such as distinguishing between a "retrieval document" and a "retrieval query."
If this feature is added, it would give developers greater flexibility in using mem0 based on their needs.

Note
To use the feature, need to specify the embedding task type inmem0.configs.embeddings.base.BaseEmbedderConfig.

Fixes #2259

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

@alohays will contribute for the tests.
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Please delete options that are not relevant.

  • Unit Test
  • Test Script (please provide)

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

@CLAassistant
Copy link

CLAassistant commented Feb 27, 2025

CLA assistant check
All committers have signed the CLA.

- modify function call executing embedder by memory actions
@rst0070
Copy link
Author

rst0070 commented Feb 27, 2025

@Dev-Khant Please review the code and let me know if any change is required.

I mainly changed two things within the last commit:

  • mem0.embeddings.base.EmbeddingBasestructure
    • function embed takes parameter named memory_action
    • VertexAI embedding selects the embedding type based on the memory_action
    • memory_action is one of these: add, search and update
  • some part of mem0.memory.main.Memory
    • to pass what memory_action is calling embedding.embed function.

I made the change for use-case, developer wants to choose what embedding type for specific memory action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add multiple options for vertex ai embedding tasks
2 participants