janito 3.16.0__py3-none-any.whl → 3.16.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- janito/providers/anthropic/provider.py +76 -72
- {janito-3.16.0.dist-info → janito-3.16.1.dist-info}/METADATA +1 -1
- {janito-3.16.0.dist-info → janito-3.16.1.dist-info}/RECORD +7 -7
- {janito-3.16.0.dist-info → janito-3.16.1.dist-info}/WHEEL +0 -0
- {janito-3.16.0.dist-info → janito-3.16.1.dist-info}/entry_points.txt +0 -0
- {janito-3.16.0.dist-info → janito-3.16.1.dist-info}/licenses/LICENSE +0 -0
- {janito-3.16.0.dist-info → janito-3.16.1.dist-info}/top_level.txt +0 -0
@@ -1,72 +1,76 @@
|
|
1
|
-
from janito.llm.provider import LLMProvider
|
2
|
-
from janito.llm.model import LLMModelInfo
|
3
|
-
from janito.llm.auth import LLMAuthManager
|
4
|
-
from janito.llm.driver_config import LLMDriverConfig
|
5
|
-
from janito.tools import get_local_tools_adapter
|
6
|
-
from janito.providers.registry import LLMProviderRegistry
|
7
|
-
from janito.providers.anthropic.model_info import MODEL_SPECS
|
8
|
-
from janito.drivers.openai.driver import OpenAIModelDriver
|
9
|
-
|
10
|
-
|
11
|
-
class AnthropicProvider(LLMProvider):
|
12
|
-
"""Anthropic LLM Provider implementation."""
|
13
|
-
|
14
|
-
name = "anthropic"
|
15
|
-
NAME = "anthropic" # For backward compatibility
|
16
|
-
MAINTAINER = "Alberto Minetti <alberto.minetti@gmail.com>"
|
17
|
-
MODEL_SPECS = MODEL_SPECS
|
18
|
-
DEFAULT_MODEL = "claude-
|
19
|
-
available = OpenAIModelDriver.available
|
20
|
-
unavailable_reason = OpenAIModelDriver.unavailable_reason
|
21
|
-
|
22
|
-
def __init__(
|
23
|
-
self, auth_manager: LLMAuthManager = None, config: LLMDriverConfig = None
|
24
|
-
):
|
25
|
-
self._tools_adapter = get_local_tools_adapter()
|
26
|
-
|
27
|
-
# Call parent constructor to initialize base functionality
|
28
|
-
super().__init__(
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
""
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
1
|
+
from janito.llm.provider import LLMProvider
|
2
|
+
from janito.llm.model import LLMModelInfo
|
3
|
+
from janito.llm.auth import LLMAuthManager
|
4
|
+
from janito.llm.driver_config import LLMDriverConfig
|
5
|
+
from janito.tools import get_local_tools_adapter
|
6
|
+
from janito.providers.registry import LLMProviderRegistry
|
7
|
+
from janito.providers.anthropic.model_info import MODEL_SPECS
|
8
|
+
from janito.drivers.openai.driver import OpenAIModelDriver
|
9
|
+
|
10
|
+
|
11
|
+
class AnthropicProvider(LLMProvider):
|
12
|
+
"""Anthropic LLM Provider implementation."""
|
13
|
+
|
14
|
+
name = "anthropic"
|
15
|
+
NAME = "anthropic" # For backward compatibility
|
16
|
+
MAINTAINER = "Alberto Minetti <alberto.minetti@gmail.com>"
|
17
|
+
MODEL_SPECS = MODEL_SPECS
|
18
|
+
DEFAULT_MODEL = "claude-sonnet-4-5-20250929"
|
19
|
+
available = OpenAIModelDriver.available
|
20
|
+
unavailable_reason = OpenAIModelDriver.unavailable_reason
|
21
|
+
|
22
|
+
def __init__(
|
23
|
+
self, auth_manager: LLMAuthManager = None, config: LLMDriverConfig = None
|
24
|
+
):
|
25
|
+
self._tools_adapter = get_local_tools_adapter()
|
26
|
+
|
27
|
+
# Call parent constructor to initialize base functionality
|
28
|
+
super().__init__(
|
29
|
+
auth_manager=auth_manager, config=config, tools_adapter=self._tools_adapter
|
30
|
+
)
|
31
|
+
|
32
|
+
# Initialize API key and configure Anthropic-specific settings
|
33
|
+
if self.available:
|
34
|
+
self._initialize_anthropic_config()
|
35
|
+
|
36
|
+
def _initialize_anthropic_config(self):
|
37
|
+
"""Initialize Anthropic-specific configuration."""
|
38
|
+
# Initialize API key
|
39
|
+
api_key = self.auth_manager.get_credentials(self.name)
|
40
|
+
if not api_key:
|
41
|
+
from janito.llm.auth_utils import handle_missing_api_key
|
42
|
+
|
43
|
+
handle_missing_api_key(self.name, "ANTHROPIC_API_KEY")
|
44
|
+
|
45
|
+
# Set API key in config
|
46
|
+
if not self.config.api_key:
|
47
|
+
self.config.api_key = api_key
|
48
|
+
|
49
|
+
# Set the Anthropic OpenAI-compatible API endpoint
|
50
|
+
self.config.base_url = "https://api.anthropic.com/v1/"
|
51
|
+
|
52
|
+
def create_driver(self) -> OpenAIModelDriver:
|
53
|
+
"""
|
54
|
+
Create and return a new OpenAIModelDriver instance for Anthropic.
|
55
|
+
|
56
|
+
Returns:
|
57
|
+
A new OpenAIModelDriver instance configured for Anthropic API
|
58
|
+
"""
|
59
|
+
if not self.available:
|
60
|
+
raise ImportError(
|
61
|
+
f"AnthropicProvider unavailable: {self.unavailable_reason}"
|
62
|
+
)
|
63
|
+
|
64
|
+
driver = OpenAIModelDriver(
|
65
|
+
tools_adapter=self.tools_adapter, provider_name=self.name
|
66
|
+
)
|
67
|
+
driver.config = self.config
|
68
|
+
return driver
|
69
|
+
|
70
|
+
def execute_tool(self, tool_name: str, event_bus, *args, **kwargs):
|
71
|
+
"""Execute a tool by name."""
|
72
|
+
self.tools_adapter.event_bus = event_bus
|
73
|
+
return self.tools_adapter.execute_by_name(tool_name, *args, **kwargs)
|
74
|
+
|
75
|
+
|
76
|
+
LLMProviderRegistry.register(AnthropicProvider.NAME, AnthropicProvider)
|
@@ -209,7 +209,7 @@ janito/providers/alibaba/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
209
209
|
janito/providers/alibaba/model_info.py,sha256=cvw4s0YQMB6cbFkIsiu5rMCsWVnko2Cfb5bAtF--s2I,5510
|
210
210
|
janito/providers/alibaba/provider.py,sha256=YgGDpo19dAjmX1WlhosbUjCWGwHUeAPeT6xl7zDg3yI,3474
|
211
211
|
janito/providers/anthropic/model_info.py,sha256=ppDB5LRdEg6NG9Q5-egMpUg-8pky21WufT0n3YlEAZo,1590
|
212
|
-
janito/providers/anthropic/provider.py,sha256=
|
212
|
+
janito/providers/anthropic/provider.py,sha256=BeeVq4Q7obekANqec1Hqyrup-3YeHerRbbDf1I2D0hA,2874
|
213
213
|
janito/providers/azure_openai/model_info.py,sha256=TMSqEpQROIIYUGAyulYJ5xGhj7CbLoaKL_JXeLbXaG0,689
|
214
214
|
janito/providers/azure_openai/provider.py,sha256=7N3tOKrPujn9sYPcB3lNBkIVcFj-ql7_awdg462QDMQ,5144
|
215
215
|
janito/providers/cerebras/__init__.py,sha256=w7VvVDG-AmW7axvt80TSM_HvAM7MjtH_2yM2wzy-Wok,28
|
@@ -266,9 +266,9 @@ janito/tools/tool_utils.py,sha256=alPm9DvtXSw_zPRKvP5GjbebPRf_nfvmWk2TNlL5Cws,12
|
|
266
266
|
janito/tools/tools_adapter.py,sha256=3Phjw34mOqG0KvXzQpZKIWigfSgZWRvdYuSdvV7Dj4M,21965
|
267
267
|
janito/tools/tools_schema.py,sha256=bv7jQfjh6yCbiRNPJykmbCTBgZZrOV2z_WqWQOjeY5o,4324
|
268
268
|
janito/tools/url_whitelist.py,sha256=0CPLkHTp5HgnwgjxwgXnJmwPeZQ30q4j3YjW59hiUUE,4295
|
269
|
-
janito-3.16.
|
270
|
-
janito-3.16.
|
271
|
-
janito-3.16.
|
272
|
-
janito-3.16.
|
273
|
-
janito-3.16.
|
274
|
-
janito-3.16.
|
269
|
+
janito-3.16.1.dist-info/licenses/LICENSE,sha256=dXV4fOF2ZErugtN8l_Nrj5tsRTYgtjE3cgiya0UfBio,11356
|
270
|
+
janito-3.16.1.dist-info/METADATA,sha256=L9KSwTseQzNHWmIUb1wwR-vTFZ9ZPFvUOdI-0bmOAOI,1722
|
271
|
+
janito-3.16.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
272
|
+
janito-3.16.1.dist-info/entry_points.txt,sha256=wIo5zZxbmu4fC-ZMrsKD0T0vq7IqkOOLYhrqRGypkx4,48
|
273
|
+
janito-3.16.1.dist-info/top_level.txt,sha256=m0NaVCq0-ivxbazE2-ND0EA9Hmuijj_OGkmCbnBcCig,7
|
274
|
+
janito-3.16.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|