-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[BUG] Make sure Client parameters are strings #1577
Changes from 1 commit
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 | ||||
---|---|---|---|---|---|---|
|
@@ -112,6 +112,10 @@ def EphemeralClient( | |||||
settings = Settings() | ||||||
settings.is_persistent = False | ||||||
|
||||||
# https://github.com/chroma-core/chroma/issues/1573 | ||||||
tenant = str(tenant) | ||||||
database = str(database) | ||||||
|
||||||
return ClientCreator(settings=settings, tenant=tenant, database=database) | ||||||
|
||||||
|
||||||
|
@@ -135,6 +139,10 @@ def PersistentClient( | |||||
settings.persist_directory = path | ||||||
settings.is_persistent = True | ||||||
|
||||||
# https://github.com/chroma-core/chroma/issues/1573 | ||||||
tenant = str(tenant) | ||||||
database = str(database) | ||||||
|
||||||
return ClientCreator(tenant=tenant, database=database, settings=settings) | ||||||
|
||||||
|
||||||
|
@@ -165,6 +173,14 @@ def HttpClient( | |||||
if settings is None: | ||||||
settings = Settings() | ||||||
|
||||||
# https://github.com/chroma-core/chroma/issues/1573 | ||||||
host = str(host) | ||||||
port = str(port) | ||||||
ssl = bool(ssl) | ||||||
_stringify_headers(headers) | ||||||
tenant = str(tenant) | ||||||
database = str(database) | ||||||
|
||||||
settings.chroma_api_impl = "chromadb.api.fastapi.FastAPI" | ||||||
if settings.chroma_server_host and settings.chroma_server_host != host: | ||||||
raise ValueError( | ||||||
|
@@ -217,6 +233,14 @@ def CloudClient( | |||||
if settings is None: | ||||||
settings = Settings() | ||||||
|
||||||
# https://github.com/chroma-core/chroma/issues/1573 | ||||||
tenant = str(tenant) | ||||||
database = str(database) | ||||||
api_key = str(api_key) | ||||||
cloud_host = str(cloud_host) | ||||||
cloud_port = str(cloud_port) | ||||||
enable_ssl = bool(enable_ssl) | ||||||
|
||||||
settings.chroma_api_impl = "chromadb.api.fastapi.FastAPI" | ||||||
settings.chroma_server_host = cloud_host | ||||||
settings.chroma_server_http_port = cloud_port | ||||||
|
@@ -242,9 +266,12 @@ def Client( | |||||
|
||||||
tenant: The tenant to use for this client. Defaults to the default tenant. | ||||||
database: The database to use for this client. Defaults to the default database. | ||||||
|
||||||
""" | ||||||
|
||||||
# https://github.com/chroma-core/chroma/issues/1573 | ||||||
tenant = str(tenant) | ||||||
database = str(database) | ||||||
|
||||||
return ClientCreator(tenant=tenant, database=database, settings=settings) | ||||||
|
||||||
|
||||||
|
@@ -255,3 +282,9 @@ def AdminClient(settings: Settings = Settings()) -> AdminAPI: | |||||
|
||||||
""" | ||||||
return AdminClientCreator(settings=settings) | ||||||
|
||||||
|
||||||
def _stringify_headers(headers: Optional[Dict[str, str]]) -> None: | ||||||
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. I feel like we can be more suggestive with the type-hinting here. If
Suggested change
I would have suggested a |
||||||
if headers is not None: | ||||||
for key, value in headers.items(): | ||||||
headers[key] = str(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to link to this issue in 4 separate places? just feels a little messy- id rather add one-liner with the rationale
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed these all to a comment, lmk what you think. Happy to change.