Skip to content

Conversation

@SaraCalla
Copy link
Contributor

Related Issues

Proposed Changes:

Added client_settings parameter to __init__ to allow users to configure the underlying Chroma client's Settings without accessing private attributes.

How did you test it?

  • Added unit tests for client_settings initialization
  • Added integration test for async client with settings

Notes for the reviewer

I also took the liberty of fixing the async test class marking. Previously, running hatch run test:unit would fail because tests required a Chroma server instance. The entire TestDocumentStoreAsync class is now marked as @pytest.mark.integration.

Checklist

@github-actions github-actions bot added integration:chroma type:documentation Improvements or additions to documentation labels Jan 4, 2026
@SaraCalla SaraCalla marked this pull request as ready for review January 5, 2026 10:49
@SaraCalla SaraCalla requested a review from a team as a code owner January 5, 2026 10:49
@SaraCalla SaraCalla requested review from anakin87 and removed request for a team January 5, 2026 10:49
@anakin87
Copy link
Member

anakin87 commented Jan 7, 2026

Hey @SaraCalla, thanks for the contribution and sorry for the wait.
I'll try to review in the next few days.

Could you please resolve the conflicts in the meantime?

Copy link
Member

@anakin87 anakin87 left a comment

Choose a reason for hiding this comment

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

Thank you again. I left some comments.

Have you investigated how Settings interfere with other client parameters?

HttpClient(host: str = "localhost",
               port: int = 8000,
               settings: my_custom_settings)

method `create_collection`. If it contains the key `"hnsw:space"`, the value will take precedence over the
`distance_function` parameter above.
:param client_settings: a dictionary of Chroma Settings configuration options passed to
`chromadb.config.Settings`. These settings configure the underlying Chroma client behavior.
Copy link
Member

Choose a reason for hiding this comment

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

if self._client_settings:
try:
client_kwargs["settings"] = Settings(**self._client_settings)
except Exception as e:
Copy link
Member

Choose a reason for hiding this comment

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

Let's catch the specific error we get - if possible

)
raise ValueError(error_message)

client_kwargs: dict[str, Any] = {}
Copy link
Member

Choose a reason for hiding this comment

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

nit: instead of a dictionary with a single key, we can define define a client_settings object with a None default value.

client_settings_obj = None
and later
client_settings_obj = Settings(**self._client_settings)

Chroma's in-memory client uses a singleton pattern with an internal cache.
Once a client is created with certain settings, Chroma rejects creating another
with different settings in the same process. We clear the cache before and after
this test to avoid conflicts with other tests that use default settings.
Copy link
Member

Choose a reason for hiding this comment

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

Ah, this is a good catch, but I'd prefer to extract a fixture to do the same. Something like this (not tested)

@pytest.fixture
def clear_chroma_system_cache():
    SharedSystemClient.clear_system_cache()
    yield
    SharedSystemClient.clear_system_cache() 

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

Labels

integration:chroma type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Offer passing Settings to Chroma Client in __init__

2 participants