Skip to content

Conversation

@haroon0x
Copy link

@haroon0x haroon0x commented Sep 17, 2025

Description

Issue #1229: Mem0 fails when trying to reduce OpenAI embedding dimensions (e.g., 1024) because vector_dimension in the config was never passed to Chroma's OpenAIEmbeddingFunction.

Fixes # (issue)
#1229
This PR updates Mem0’s OpenAIEmbedder to forward vector_dimension from the config to Chroma, so embedding dimensions work correctly.

vector_dimension = self.config.vector_dimension or VectorDimensions.OPENAI.value
embedding_fn = OpenAIEmbeddingFunction(
    api_key=api_key,
    api_base=api_base,
    organization_id=os.getenv("OPENAI_ORGANIZATION"),
    model_name=self.config.model,
    dimensions=vector_dimension, #  added 
)
self.set_embedding_fn(embedding_fn=embedding_fn)
self.set_vector_dimension(vector_dimension=vector_dimension)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

  • 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

Maintainer Checklist

@CLAassistant
Copy link

CLAassistant commented Sep 17, 2025

CLA assistant check
All committers have signed the CLA.

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.

Reduce Dimensions of new OpenAI embedding models is not working

2 participants