Skip to content

Commit c3d7d17

Browse files
authored
chore: fix typing hints for get_provider_impl deps arguments (#1544)
# What does this PR do? It's a dict that may contain different types, as per resolver:instantiate_provider implementation. (AFAIU it also never contains ProviderSpecs, but *instances* of provider implementations.) [//]: # (If resolving an issue, uncomment and update the line below) [//]: # (Closes #[issue-number]) ## Test Plan mypy passing if enabled checks for these modules. (See #1543) [//]: # (## Documentation) Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
1 parent 04106b9 commit c3d7d17

File tree

18 files changed

+52
-40
lines changed

18 files changed

+52
-40
lines changed

llama_stack/providers/inline/agents/meta_reference/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
# This source code is licensed under the terms described in the LICENSE file in
55
# the root directory of this source tree.
66

7-
from typing import Dict
7+
from typing import Any, Dict
88

9-
from llama_stack.distribution.datatypes import Api, ProviderSpec
9+
from llama_stack.distribution.datatypes import Api
1010

1111
from .config import MetaReferenceAgentsImplConfig
1212

1313

14-
async def get_provider_impl(config: MetaReferenceAgentsImplConfig, deps: Dict[Api, ProviderSpec]):
14+
async def get_provider_impl(config: MetaReferenceAgentsImplConfig, deps: Dict[Api, Any]):
1515
from .agents import MetaReferenceAgentsImpl
1616

1717
impl = MetaReferenceAgentsImpl(

llama_stack/providers/inline/datasetio/localfs/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
# This source code is licensed under the terms described in the LICENSE file in
55
# the root directory of this source tree.
66

7+
from typing import Any, Dict
8+
79
from .config import LocalFSDatasetIOConfig
810

911

1012
async def get_provider_impl(
1113
config: LocalFSDatasetIOConfig,
12-
_deps,
14+
_deps: Dict[str, Any],
1315
):
1416
from .datasetio import LocalFSDatasetIOImpl
1517

llama_stack/providers/inline/eval/meta_reference/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
#
44
# This source code is licensed under the terms described in the LICENSE file in
55
# the root directory of this source tree.
6-
from typing import Dict
6+
from typing import Any, Dict
77

8-
from llama_stack.distribution.datatypes import Api, ProviderSpec
8+
from llama_stack.distribution.datatypes import Api
99

1010
from .config import MetaReferenceEvalConfig
1111

1212

1313
async def get_provider_impl(
1414
config: MetaReferenceEvalConfig,
15-
deps: Dict[Api, ProviderSpec],
15+
deps: Dict[Api, Any],
1616
):
1717
from .eval import MetaReferenceEvalImpl
1818

llama_stack/providers/inline/inference/meta_reference/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
# This source code is licensed under the terms described in the LICENSE file in
55
# the root directory of this source tree.
66

7-
from typing import Union
7+
from typing import Any, Dict, Union
88

99
from .config import MetaReferenceInferenceConfig, MetaReferenceQuantizedInferenceConfig
1010

1111

1212
async def get_provider_impl(
1313
config: Union[MetaReferenceInferenceConfig, MetaReferenceQuantizedInferenceConfig],
14-
_deps,
14+
_deps: Dict[str, Any],
1515
):
1616
from .inference import MetaReferenceInferenceImpl
1717

llama_stack/providers/inline/inference/sentence_transformers/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
# This source code is licensed under the terms described in the LICENSE file in
55
# the root directory of this source tree.
66

7+
from typing import Any, Dict
8+
79
from llama_stack.providers.inline.inference.sentence_transformers.config import (
810
SentenceTransformersInferenceConfig,
911
)
1012

1113

1214
async def get_provider_impl(
1315
config: SentenceTransformersInferenceConfig,
14-
_deps,
16+
_deps: Dict[str, Any],
1517
):
1618
from .sentence_transformers import SentenceTransformersInferenceImpl
1719

llama_stack/providers/inline/inference/vllm/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
# This source code is licensed under the terms described in the LICENSE file in
55
# the root directory of this source tree.
66

7-
from typing import Any
7+
from typing import Any, Dict
88

99
from .config import VLLMConfig
1010

1111

12-
async def get_provider_impl(config: VLLMConfig, _deps) -> Any:
12+
async def get_provider_impl(config: VLLMConfig, _deps: Dict[str, Any]):
1313
from .vllm import VLLMInferenceImpl
1414

1515
impl = VLLMInferenceImpl(config)

llama_stack/providers/inline/post_training/torchtune/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
# This source code is licensed under the terms described in the LICENSE file in
55
# the root directory of this source tree.
66

7-
from typing import Dict
7+
from typing import Any, Dict
88

9-
from llama_stack.distribution.datatypes import Api, ProviderSpec
9+
from llama_stack.distribution.datatypes import Api
1010

1111
from .config import TorchtunePostTrainingConfig
1212

@@ -15,7 +15,7 @@
1515

1616
async def get_provider_impl(
1717
config: TorchtunePostTrainingConfig,
18-
deps: Dict[Api, ProviderSpec],
18+
deps: Dict[Api, Any],
1919
):
2020
from .post_training import TorchtunePostTrainingImpl
2121

llama_stack/providers/inline/safety/code_scanner/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
# This source code is licensed under the terms described in the LICENSE file in
55
# the root directory of this source tree.
66

7+
from typing import Any, Dict
8+
79
from .config import CodeScannerConfig
810

911

10-
async def get_provider_impl(config: CodeScannerConfig, deps):
12+
async def get_provider_impl(config: CodeScannerConfig, deps: Dict[str, Any]):
1113
from .code_scanner import MetaReferenceCodeScannerSafetyImpl
1214

1315
impl = MetaReferenceCodeScannerSafetyImpl(config, deps)

llama_stack/providers/inline/safety/llama_guard/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
# This source code is licensed under the terms described in the LICENSE file in
55
# the root directory of this source tree.
66

7+
from typing import Any, Dict
8+
79
from .config import LlamaGuardConfig
810

911

10-
async def get_provider_impl(config: LlamaGuardConfig, deps):
12+
async def get_provider_impl(config: LlamaGuardConfig, deps: Dict[str, Any]):
1113
from .llama_guard import LlamaGuardSafetyImpl
1214

1315
assert isinstance(config, LlamaGuardConfig), f"Unexpected config type: {type(config)}"

llama_stack/providers/inline/safety/prompt_guard/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
# This source code is licensed under the terms described in the LICENSE file in
55
# the root directory of this source tree.
66

7+
from typing import Any, Dict
8+
79
from .config import PromptGuardConfig # noqa: F401
810

911

10-
async def get_provider_impl(config: PromptGuardConfig, deps):
12+
async def get_provider_impl(config: PromptGuardConfig, deps: Dict[str, Any]):
1113
from .prompt_guard import PromptGuardSafetyImpl
1214

1315
impl = PromptGuardSafetyImpl(config, deps)

0 commit comments

Comments
 (0)