From 7b429fbcf540aae7cb4440def53541d7fdc16f2d Mon Sep 17 00:00:00 2001 From: Matthew Farrellee Date: Fri, 15 Nov 2024 06:35:13 -0500 Subject: [PATCH 1/2] change available_models to return List[Model], previously List[str] --- .../llama_index/multi_modal_llms/nvidia/base.py | 12 +++++++++--- .../tests/test_available_models.py | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-nvidia/llama_index/multi_modal_llms/nvidia/base.py b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-nvidia/llama_index/multi_modal_llms/nvidia/base.py index 02cea8ed17ed7..e14dfa616f510 100644 --- a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-nvidia/llama_index/multi_modal_llms/nvidia/base.py +++ b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-nvidia/llama_index/multi_modal_llms/nvidia/base.py @@ -39,6 +39,12 @@ import aiohttp import json +from llama_index.core.bridge.pydantic import BaseModel + + +class Model(BaseModel): + id: str + class NVIDIAClient: def __init__( @@ -58,14 +64,14 @@ def _get_headers(self, stream: bool) -> Dict[str, str]: headers["accept"] = "text/event-stream" if stream else "application/json" return headers - def get_model_details(self) -> List[str]: + def get_model_details(self) -> List[Model]: """ Get model details. Returns: List of models """ - return list(NVIDIA_MULTI_MODAL_MODELS.keys()) + return [Model(id=model) for model in NVIDIA_MULTI_MODAL_MODELS] def request( self, @@ -198,7 +204,7 @@ def metadata(self) -> MultiModalLLMMetadata: ) @property - def available_models(self): + def available_models(self) -> List[Model]: return self._client.get_model_details() def _get_credential_kwargs(self) -> Dict[str, Any]: diff --git a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-nvidia/tests/test_available_models.py b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-nvidia/tests/test_available_models.py index 829622e872440..26d14ad038abf 100644 --- a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-nvidia/tests/test_available_models.py +++ b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-nvidia/tests/test_available_models.py @@ -8,4 +8,4 @@ def test_available_models() -> None: models = NVIDIAMultiModal().available_models assert models assert isinstance(models, list) - assert all(isinstance(model, str) for model in models) + assert all(isinstance(model.id, str) for model in models) From d27d3f3fc18258fef8582b6b77a78e8004bf99e6 Mon Sep 17 00:00:00 2001 From: Matthew Farrellee Date: Fri, 15 Nov 2024 06:38:16 -0500 Subject: [PATCH 2/2] bump version to 0.2.0 --- .../llama-index-multi-modal-llms-nvidia/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-nvidia/pyproject.toml b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-nvidia/pyproject.toml index 9555020026cb1..32d8121d7eaa6 100644 --- a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-nvidia/pyproject.toml +++ b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-nvidia/pyproject.toml @@ -27,7 +27,7 @@ license = "MIT" name = "llama-index-multi-modal-llms-nvidia" packages = [{include = "llama_index/"}] readme = "README.md" -version = "0.1.0" +version = "0.2.0" [tool.poetry.dependencies] python = ">=3.8.1,<4.0"