Skip to content

Commit

Permalink
Merge pull request #120 from Bishoy-at-pieces/update-SDK
Browse files Browse the repository at this point in the history
chore: update skds
  • Loading branch information
Bishoy-at-pieces authored May 20, 2024
2 parents 3917a80 + 779988e commit 7680a30
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 66 deletions.
113 changes: 57 additions & 56 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
python = ">=3.9,<3.13"
pyperclip = ">=1.8.2"
websocket-client = "1.7.0"
pieces_os_client = "1.2.7"
pieces_os_client = "2.2.0"
prompt-toolkit = "^3.0.43"
rich = "^13.7.1"
platformdirs = "^4.2.0"
Expand Down
13 changes: 4 additions & 9 deletions src/pieces/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from pieces_os_client.api.well_known_api import WellKnownApi
from pieces_os_client.api.connector_api import ConnectorApi
from pieces_os_client.api.models_api import ModelsApi

from pieces_os_client.configuration import Configuration
from pieces_os_client.api_client import ApiClient
Expand Down Expand Up @@ -132,16 +133,10 @@ def connect_api(cls) -> Application:
return cls.application

@classmethod
def get_models_ids(cls) -> Dict[str, Dict[str, Union[str, int]]]:
# api_instance = pos_client.ModelsApi(api_client)
def get_models_ids(cls) -> Dict[str, Dict[str, str]]:

# api_response = api_instance.models_snapshot()
# models = {model.name: {"uuid":model.id,"word_limit":model.max_tokens.input} for model in api_response.iterable if model.cloud or model.downloading} # getting the models that are available in the cloud or is downloaded

# call the api until the sdks updated
response = cls.api_client.call_api('/models', 'GET',{},[],response_types_map={'200': "str",'500': "str"}).raw_data
response = json.loads(response)["iterable"]
models = {model["name"]:{"uuid":model["id"]} for model in response if model["cloud"] or model.get("downloaded",False)}
api_response = ModelsApi(cls.api_client).models_snapshot()
models = {model.name: {"uuid":model.id} for model in api_response.iterable if model.cloud or model.downloaded} # getting the models that are available in the cloud or is downloaded
return models

@classmethod
Expand Down

0 comments on commit 7680a30

Please sign in to comment.