-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Feat/client server version check #6827
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
d44c33d
704221d
468a1f3
e9ebc81
cf51ab5
abd3d01
c8b64a9
5fce059
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| import orjson | ||
| from typing import Any, Mapping, Optional, cast, Tuple, Sequence, Dict, List | ||
| import logging | ||
| import warnings | ||
| import httpx | ||
| from overrides import override | ||
| from chromadb import __version__ | ||
|
|
@@ -793,6 +794,22 @@ async def reset(self) -> bool: | |
|
|
||
| @trace_method("AsyncFastAPI.get_version", OpenTelemetryGranularity.OPERATION) | ||
| @override | ||
|
|
||
| async def _check_version_compatibility(self) -> None: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Logic] To invoke this on startup, it would need to be called from an async entry point such as async def __aenter__(self) -> "AsyncFastAPI":
self._get_client()
await self._check_version_compatibility()
return selfAlternatively, expose a synchronous wrapper or document that callers must invoke it manually after Context for Agents |
||
| """Warn if client and server major.minor versions differ.""" | ||
| try: | ||
| server_version = await self.get_version() | ||
| from chromadb import __version__ as client_version | ||
propel-code-bot[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if server_version.split(".")[:2] != client_version.split(".")[:2]: | ||
| warnings.warn( | ||
| f"Chroma client version ({client_version}) may not be compatible " | ||
| f"with server version ({server_version}). " | ||
| f"Please ensure client and server use the same major.minor version.", | ||
| stacklevel=2, | ||
| ) | ||
| except Exception: | ||
| pass | ||
propel-code-bot[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| async def get_version(self) -> str: | ||
| resp_json = await self._make_request("get", "/version") | ||
| return cast(str, resp_json) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.