From 7bb53a7aa405a832a19b276d09af4eab0b4cfad2 Mon Sep 17 00:00:00 2001 From: Aaron <29749331+aarnphm@users.noreply.github.com> Date: Sun, 26 Nov 2023 18:48:01 -0500 Subject: [PATCH] fix(client): include ability to getitem for sync client Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> --- openllm-client/src/openllm_client/_http.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openllm-client/src/openllm_client/_http.py b/openllm-client/src/openllm_client/_http.py index 115c4bac..ed802a67 100644 --- a/openllm-client/src/openllm_client/_http.py +++ b/openllm-client/src/openllm_client/_http.py @@ -46,6 +46,13 @@ class HTTPClient(Client): return {'Authorization': f'Bearer {env}'} return super()._build_auth_headers() + def __getitem__(self, item): + if hasattr(self._metadata, item): + return getattr(self._metadata, item) + elif item in self._config: + return self._config[item] + raise KeyError(f'No attributes: {item}') + @property def _metadata(self): if self.__metadata is None: