swarmauri_llm_hyperbolic 0.1.1.dev3__tar.gz → 0.11.0.dev4__tar.gz

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.
@@ -0,0 +1,198 @@
1
+ Metadata-Version: 2.4
2
+ Name: swarmauri_llm_hyperbolic
3
+ Version: 0.11.0.dev4
4
+ Summary: Provider-specific Swarmauri import package for Hyperbolic OpenAI-compatible chat, vision-language inference, streaming, with retired audio imports retained for compatibility.
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Keywords: swarmauri,llm,hyperbolic,hyperbolic api,openai compatible,chat completions,vision language model,vlm,text to speech,tts,audio generation,streaming llm,async llm,qwen,llama,deepseek,large language model,generative ai,swarmauri llm,model,composable intelligence
8
+ Author: Jacob Stewart
9
+ Author-email: jacob@swarmauri.com
10
+ Requires-Python: >=3.10,<3.15
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Natural Language :: English
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Classifier: Topic :: Software Development :: Libraries
20
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
21
+ Classifier: Programming Language :: Python
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Programming Language :: Python :: 3 :: Only
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Programming Language :: Python :: 3.13
28
+ Classifier: Programming Language :: Python :: 3.14
29
+ Requires-Dist: swarmauri_base
30
+ Requires-Dist: swarmauri_core
31
+ Requires-Dist: swarmauri_standard (>=0.11.0.dev12,<0.12)
32
+ Description-Content-Type: text/markdown
33
+
34
+ ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
35
+
36
+ <p align="center">
37
+ <a href="https://pepy.tech/project/swarmauri_llm_hyperbolic/">
38
+ <img src="https://static.pepy.tech/badge/swarmauri_llm_hyperbolic/month" alt="PyPI - Downloads"/></a>
39
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_llm_hyperbolic/">
40
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_llm_hyperbolic.svg"/></a>
41
+ <a href="https://pypi.org/project/swarmauri_llm_hyperbolic/">
42
+ <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
43
+ <a href="https://pypi.org/project/swarmauri_llm_hyperbolic/">
44
+ <img src="https://img.shields.io/pypi/l/swarmauri_llm_hyperbolic" alt="PyPI - License"/></a>
45
+ <a href="https://pypi.org/project/swarmauri_llm_hyperbolic/">
46
+ <img src="https://img.shields.io/pypi/v/swarmauri_llm_hyperbolic?label=swarmauri_llm_hyperbolic&color=green" alt="PyPI - swarmauri_llm_hyperbolic"/></a>
47
+ <a href="https://discord.gg/N4UpBuQv8T">
48
+ <img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
49
+
50
+ # Swarmauri Hyperbolic LLM
51
+
52
+ `swarmauri_llm_hyperbolic` preserves Hyperbolic chat and vision imports and the
53
+ retired `HyperbolicAudioTTS` name. The old `.xyz/v1` API was decommissioned.
54
+ The current Hyperbolic inference service documents text and vision, with new
55
+ endpoints and credentials; it does not document a compatible audio replacement.
56
+
57
+ `HyperbolicAudioTTS` now warns and raises a local retirement error on construction
58
+ or execution. No audio request is sent. Select a standalone TTS adapter from the
59
+ [SDK migration guide](https://github.com/swarmauri/swarmauri-sdk/blob/master/docs/migrations/playht.md).
60
+
61
+ The chat and vision implementations have not been migrated or live-verified in
62
+ this TTS update. Their presence here does not establish current availability.
63
+ See [Hyperbolic's migration notice](https://www.hyperbolic.ai/docs/inference/overview#moving-from-the-previous-inference-api).
64
+
65
+ ## Features
66
+
67
+ - `HyperbolicModel` for sync, async, streaming, and batch chat completion
68
+ workflows.
69
+ - `HyperbolicVisionModel` for image-plus-text prompts against Hyperbolic VLMs.
70
+ - `HyperbolicAudioTTS` as an import-compatible retired type; it does not call
71
+ the decommissioned audio API.
72
+ - Model discovery through Hyperbolic's `/models` endpoint.
73
+ - Generation controls including `temperature`, `max_tokens`, `top_p`, `top_k`,
74
+ and `stop`.
75
+ - Optional usage metadata handling on chat responses when available.
76
+ - Compatibility with Python 3.10, 3.11, 3.12, 3.13, and 3.14.
77
+
78
+ ## Installation
79
+
80
+ ```bash
81
+ uv add swarmauri_llm_hyperbolic
82
+ ```
83
+
84
+ ```bash
85
+ pip install swarmauri_llm_hyperbolic
86
+ ```
87
+
88
+ ## Prerequisites
89
+
90
+ Create a Hyperbolic API key in the Hyperbolic app and pass it to the model
91
+ constructor as `api_key=...`.
92
+
93
+ ## Usage
94
+
95
+ ```python
96
+ from swarmauri_llm_hyperbolic import HyperbolicModel
97
+ from swarmauri_standard.conversations.Conversation import Conversation
98
+ from swarmauri_standard.messages.HumanMessage import HumanMessage
99
+
100
+ conversation = Conversation()
101
+ conversation.add_message(HumanMessage(content="Summarize this deployment risk."))
102
+
103
+ model = HyperbolicModel(api_key="HYPERBOLIC_API_KEY")
104
+ result = model.predict(conversation=conversation, max_tokens=200)
105
+
106
+ print(result.get_last().content)
107
+ ```
108
+
109
+ ### Streaming Chat
110
+
111
+ ```python
112
+ from swarmauri_llm_hyperbolic import HyperbolicModel
113
+ from swarmauri_standard.conversations.Conversation import Conversation
114
+ from swarmauri_standard.messages.HumanMessage import HumanMessage
115
+
116
+ conversation = Conversation()
117
+ conversation.add_message(HumanMessage(content="List three API gateway checks."))
118
+
119
+ model = HyperbolicModel(api_key="HYPERBOLIC_API_KEY")
120
+
121
+ for token in model.stream(conversation=conversation):
122
+ print(token, end="")
123
+ ```
124
+
125
+ ### Vision-Language Prompt
126
+
127
+ ```python
128
+ from swarmauri_llm_hyperbolic import HyperbolicVisionModel
129
+ from swarmauri_standard.conversations.Conversation import Conversation
130
+ from swarmauri_standard.messages.HumanMessage import HumanMessage
131
+
132
+ conversation = Conversation()
133
+ conversation.add_message(
134
+ HumanMessage(
135
+ content=[
136
+ {"type": "text", "text": "Describe the image."},
137
+ {"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}},
138
+ ]
139
+ )
140
+ )
141
+
142
+ model = HyperbolicVisionModel(api_key="HYPERBOLIC_API_KEY")
143
+ result = model.predict(conversation=conversation)
144
+
145
+ print(result.get_last().content)
146
+ ```
147
+
148
+ ### Text To Speech (retired)
149
+
150
+ Do not construct HyperbolicAudioTTS or HyperbolicTTS: the legacy API was
151
+ decommissioned. Imports remain, but use emits a warning and raises a local
152
+ migration error. See [the SDK guide](../../../docs/migrations/playht.md) and
153
+ [Hyperbolic's migration notice](https://www.hyperbolic.ai/docs/inference/overview#moving-from-the-previous-inference-api).
154
+
155
+ ## Related Packages
156
+
157
+ - [swarmauri_llm_deepinfra](https://pypi.org/project/swarmauri_llm_deepinfra/)
158
+ - [swarmauri_llm_groq](https://pypi.org/project/swarmauri_llm_groq/)
159
+ - [swarmauri_llm_mistral](https://pypi.org/project/swarmauri_llm_mistral/)
160
+ - [swarmauri_llm_openai](https://pypi.org/project/swarmauri_llm_openai/)
161
+ - [swarmauri_llm_perplexity](https://pypi.org/project/swarmauri_llm_perplexity/)
162
+ - [OpenAI TTS (Play.ht replacement)](../../standards/swarmauri_tts_openai/README.md)
163
+
164
+ ## Foundational Swarmauri Packages
165
+
166
+ - [swarmauri_core](https://pypi.org/project/swarmauri_core/)
167
+ - [swarmauri_base](https://pypi.org/project/swarmauri_base/)
168
+ - [swarmauri_standard](https://pypi.org/project/swarmauri_standard/)
169
+ - [swarmauri](https://pypi.org/project/swarmauri/)
170
+
171
+ ## Provider Documentation
172
+
173
+ - [Hyperbolic quick start](https://www.hyperbolic.ai/docs/inference/quickstart)
174
+ - [Hyperbolic text generation APIs](https://www.hyperbolic.ai/docs/inference/text-apis)
175
+ - [Hyperbolic vision-language APIs](https://www.hyperbolic.ai/docs/inference/vlm-apis)
176
+ - [Hyperbolic supported models](https://docs.hyperbolic.xyz/docs/supported-models)
177
+
178
+ ## Best Practices
179
+
180
+ - Store Hyperbolic API keys in environment variables or a secrets manager.
181
+ - Confirm model availability and provider capability flags before production
182
+ deployment.
183
+ - Use `HyperbolicVisionModel` only for image-aware prompts; plain chat is simpler
184
+ with `HyperbolicModel`.
185
+ - Use explicit output paths for TTS generation so generated audio files are easy
186
+ to manage.
187
+ - Prefer newer Swarmauri VLM and TTS imports for new projects when available.
188
+
189
+ ## License
190
+
191
+ Apache-2.0
192
+
193
+
194
+
195
+ The audio retirement does not redirect API keys or rewrite the other LLM/VLM
196
+ components. Those legacy integrations need their own provider migration and
197
+ verification; this update does not claim their current hosted availability.
198
+
@@ -0,0 +1,164 @@
1
+ ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
2
+
3
+ <p align="center">
4
+ <a href="https://pepy.tech/project/swarmauri_llm_hyperbolic/">
5
+ <img src="https://static.pepy.tech/badge/swarmauri_llm_hyperbolic/month" alt="PyPI - Downloads"/></a>
6
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_llm_hyperbolic/">
7
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_llm_hyperbolic.svg"/></a>
8
+ <a href="https://pypi.org/project/swarmauri_llm_hyperbolic/">
9
+ <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
10
+ <a href="https://pypi.org/project/swarmauri_llm_hyperbolic/">
11
+ <img src="https://img.shields.io/pypi/l/swarmauri_llm_hyperbolic" alt="PyPI - License"/></a>
12
+ <a href="https://pypi.org/project/swarmauri_llm_hyperbolic/">
13
+ <img src="https://img.shields.io/pypi/v/swarmauri_llm_hyperbolic?label=swarmauri_llm_hyperbolic&color=green" alt="PyPI - swarmauri_llm_hyperbolic"/></a>
14
+ <a href="https://discord.gg/N4UpBuQv8T">
15
+ <img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
16
+
17
+ # Swarmauri Hyperbolic LLM
18
+
19
+ `swarmauri_llm_hyperbolic` preserves Hyperbolic chat and vision imports and the
20
+ retired `HyperbolicAudioTTS` name. The old `.xyz/v1` API was decommissioned.
21
+ The current Hyperbolic inference service documents text and vision, with new
22
+ endpoints and credentials; it does not document a compatible audio replacement.
23
+
24
+ `HyperbolicAudioTTS` now warns and raises a local retirement error on construction
25
+ or execution. No audio request is sent. Select a standalone TTS adapter from the
26
+ [SDK migration guide](https://github.com/swarmauri/swarmauri-sdk/blob/master/docs/migrations/playht.md).
27
+
28
+ The chat and vision implementations have not been migrated or live-verified in
29
+ this TTS update. Their presence here does not establish current availability.
30
+ See [Hyperbolic's migration notice](https://www.hyperbolic.ai/docs/inference/overview#moving-from-the-previous-inference-api).
31
+
32
+ ## Features
33
+
34
+ - `HyperbolicModel` for sync, async, streaming, and batch chat completion
35
+ workflows.
36
+ - `HyperbolicVisionModel` for image-plus-text prompts against Hyperbolic VLMs.
37
+ - `HyperbolicAudioTTS` as an import-compatible retired type; it does not call
38
+ the decommissioned audio API.
39
+ - Model discovery through Hyperbolic's `/models` endpoint.
40
+ - Generation controls including `temperature`, `max_tokens`, `top_p`, `top_k`,
41
+ and `stop`.
42
+ - Optional usage metadata handling on chat responses when available.
43
+ - Compatibility with Python 3.10, 3.11, 3.12, 3.13, and 3.14.
44
+
45
+ ## Installation
46
+
47
+ ```bash
48
+ uv add swarmauri_llm_hyperbolic
49
+ ```
50
+
51
+ ```bash
52
+ pip install swarmauri_llm_hyperbolic
53
+ ```
54
+
55
+ ## Prerequisites
56
+
57
+ Create a Hyperbolic API key in the Hyperbolic app and pass it to the model
58
+ constructor as `api_key=...`.
59
+
60
+ ## Usage
61
+
62
+ ```python
63
+ from swarmauri_llm_hyperbolic import HyperbolicModel
64
+ from swarmauri_standard.conversations.Conversation import Conversation
65
+ from swarmauri_standard.messages.HumanMessage import HumanMessage
66
+
67
+ conversation = Conversation()
68
+ conversation.add_message(HumanMessage(content="Summarize this deployment risk."))
69
+
70
+ model = HyperbolicModel(api_key="HYPERBOLIC_API_KEY")
71
+ result = model.predict(conversation=conversation, max_tokens=200)
72
+
73
+ print(result.get_last().content)
74
+ ```
75
+
76
+ ### Streaming Chat
77
+
78
+ ```python
79
+ from swarmauri_llm_hyperbolic import HyperbolicModel
80
+ from swarmauri_standard.conversations.Conversation import Conversation
81
+ from swarmauri_standard.messages.HumanMessage import HumanMessage
82
+
83
+ conversation = Conversation()
84
+ conversation.add_message(HumanMessage(content="List three API gateway checks."))
85
+
86
+ model = HyperbolicModel(api_key="HYPERBOLIC_API_KEY")
87
+
88
+ for token in model.stream(conversation=conversation):
89
+ print(token, end="")
90
+ ```
91
+
92
+ ### Vision-Language Prompt
93
+
94
+ ```python
95
+ from swarmauri_llm_hyperbolic import HyperbolicVisionModel
96
+ from swarmauri_standard.conversations.Conversation import Conversation
97
+ from swarmauri_standard.messages.HumanMessage import HumanMessage
98
+
99
+ conversation = Conversation()
100
+ conversation.add_message(
101
+ HumanMessage(
102
+ content=[
103
+ {"type": "text", "text": "Describe the image."},
104
+ {"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}},
105
+ ]
106
+ )
107
+ )
108
+
109
+ model = HyperbolicVisionModel(api_key="HYPERBOLIC_API_KEY")
110
+ result = model.predict(conversation=conversation)
111
+
112
+ print(result.get_last().content)
113
+ ```
114
+
115
+ ### Text To Speech (retired)
116
+
117
+ Do not construct HyperbolicAudioTTS or HyperbolicTTS: the legacy API was
118
+ decommissioned. Imports remain, but use emits a warning and raises a local
119
+ migration error. See [the SDK guide](../../../docs/migrations/playht.md) and
120
+ [Hyperbolic's migration notice](https://www.hyperbolic.ai/docs/inference/overview#moving-from-the-previous-inference-api).
121
+
122
+ ## Related Packages
123
+
124
+ - [swarmauri_llm_deepinfra](https://pypi.org/project/swarmauri_llm_deepinfra/)
125
+ - [swarmauri_llm_groq](https://pypi.org/project/swarmauri_llm_groq/)
126
+ - [swarmauri_llm_mistral](https://pypi.org/project/swarmauri_llm_mistral/)
127
+ - [swarmauri_llm_openai](https://pypi.org/project/swarmauri_llm_openai/)
128
+ - [swarmauri_llm_perplexity](https://pypi.org/project/swarmauri_llm_perplexity/)
129
+ - [OpenAI TTS (Play.ht replacement)](../../standards/swarmauri_tts_openai/README.md)
130
+
131
+ ## Foundational Swarmauri Packages
132
+
133
+ - [swarmauri_core](https://pypi.org/project/swarmauri_core/)
134
+ - [swarmauri_base](https://pypi.org/project/swarmauri_base/)
135
+ - [swarmauri_standard](https://pypi.org/project/swarmauri_standard/)
136
+ - [swarmauri](https://pypi.org/project/swarmauri/)
137
+
138
+ ## Provider Documentation
139
+
140
+ - [Hyperbolic quick start](https://www.hyperbolic.ai/docs/inference/quickstart)
141
+ - [Hyperbolic text generation APIs](https://www.hyperbolic.ai/docs/inference/text-apis)
142
+ - [Hyperbolic vision-language APIs](https://www.hyperbolic.ai/docs/inference/vlm-apis)
143
+ - [Hyperbolic supported models](https://docs.hyperbolic.xyz/docs/supported-models)
144
+
145
+ ## Best Practices
146
+
147
+ - Store Hyperbolic API keys in environment variables or a secrets manager.
148
+ - Confirm model availability and provider capability flags before production
149
+ deployment.
150
+ - Use `HyperbolicVisionModel` only for image-aware prompts; plain chat is simpler
151
+ with `HyperbolicModel`.
152
+ - Use explicit output paths for TTS generation so generated audio files are easy
153
+ to manage.
154
+ - Prefer newer Swarmauri VLM and TTS imports for new projects when available.
155
+
156
+ ## License
157
+
158
+ Apache-2.0
159
+
160
+
161
+
162
+ The audio retirement does not redirect API keys or rewrite the other LLM/VLM
163
+ components. Those legacy integrations need their own provider migration and
164
+ verification; this update does not claim their current hosted availability.
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "swarmauri_llm_hyperbolic"
3
- version = "0.1.1.dev3"
4
- description = "Swarmauri Hyperbolic LLM adapters from swarmauri_standard."
3
+ version = "0.11.0.dev4"
4
+ description = "Provider-specific Swarmauri import package for Hyperbolic OpenAI-compatible chat, vision-language inference, streaming, with retired audio imports retained for compatibility."
5
5
  license = "Apache-2.0"
6
6
  readme = "README.md"
7
7
  repository = "http://github.com/swarmauri/swarmauri-sdk"
@@ -11,6 +11,11 @@ classifiers = [
11
11
  "Natural Language :: English",
12
12
  "Development Status :: 3 - Alpha",
13
13
  "Intended Audience :: Developers",
14
+ "Intended Audience :: Science/Research",
15
+ "Operating System :: OS Independent",
16
+ "Topic :: Multimedia :: Sound/Audio :: Speech",
17
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
18
+ "Topic :: Software Development :: Libraries",
14
19
  "Topic :: Software Development :: Libraries :: Application Frameworks",
15
20
  "Programming Language :: Python",
16
21
  "Programming Language :: Python :: 3",
@@ -25,13 +30,30 @@ authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
25
30
  dependencies = [
26
31
  "swarmauri_core",
27
32
  "swarmauri_base",
28
- "swarmauri_standard",
33
+ "swarmauri_standard>=0.11.0.dev12,<0.12",
29
34
  ]
30
35
  keywords = [
31
36
  "swarmauri",
32
37
  "llm",
33
38
  "hyperbolic",
39
+ "hyperbolic api",
40
+ "openai compatible",
41
+ "chat completions",
42
+ "vision language model",
43
+ "vlm",
44
+ "text to speech",
45
+ "tts",
46
+ "audio generation",
47
+ "streaming llm",
48
+ "async llm",
49
+ "qwen",
50
+ "llama",
51
+ "deepseek",
52
+ "large language model",
53
+ "generative ai",
54
+ "swarmauri llm",
34
55
  "model",
56
+ "composable intelligence",
35
57
  ]
36
58
 
37
59
  [tool.uv.sources]
@@ -75,7 +97,7 @@ dev = [
75
97
  "pytest-xdist>=3.6.1",
76
98
  "pytest-json-report>=1.5.0",
77
99
  "python-dotenv",
78
- "requests>=2.32.3",
100
+ "httpx>=0.27",
79
101
  "flake8>=7.0",
80
102
  "pytest-timeout>=2.3.1",
81
103
  "ruff>=0.9.9",
@@ -0,0 +1,442 @@
1
+ import asyncio
2
+ import json
3
+ from typing import (
4
+ Any,
5
+ AsyncGenerator,
6
+ Dict,
7
+ Generator,
8
+ List,
9
+ Literal,
10
+ Optional,
11
+ Type,
12
+ )
13
+
14
+ import httpx
15
+ from pydantic import PrivateAttr, SecretStr
16
+ from swarmauri_base.ComponentBase import ComponentBase
17
+ from swarmauri_base.messages.MessageBase import MessageBase
18
+ from swarmauri_base.vlms.VLMBase import VLMBase
19
+
20
+ from swarmauri_standard.conversations.Conversation import Conversation
21
+ from swarmauri_standard.messages.AgentMessage import AgentMessage, UsageData
22
+ from swarmauri_standard.utils.file_path_to_base64 import file_path_to_base64
23
+ from swarmauri_standard.utils.retry_decorator import retry_on_status_codes
24
+
25
+
26
+ @ComponentBase.register_type(VLMBase, "HyperbolicVLM")
27
+ class HyperbolicVLM(VLMBase):
28
+ """
29
+ HyperbolicVLM class for interacting with the Hyperbolic vision language
30
+ models API. This class
31
+ provides synchronous and asynchronous methods to send conversation data to
32
+ the
33
+ model, receive predictions, and stream responses.
34
+
35
+ Attributes:
36
+ api_key (str): API key for authenticating requests to the Hyperbolic
37
+ API.
38
+ allowed_models (List[str]): List of allowed model names that can be
39
+ used.
40
+ name (str): The default model name to use for predictions.
41
+ type (Literal["HyperbolicVCM"]): The type identifier for this class.
42
+
43
+ Link to Allowed Models: https://app.hyperbolic.xyz/models
44
+ Link to API KEYS: https://app.hyperbolic.xyz/settings
45
+ """
46
+
47
+ api_key: SecretStr
48
+ allowed_models: List[str] = [
49
+ "Qwen/Qwen2.5-VL-72B-Instruct",
50
+ "Qwen/Qwen2.5-VL-7B-Instruct",
51
+ "mistralai/Pixtral-12B-2409",
52
+ ]
53
+ name: str = "Qwen/Qwen2.5-VL-72B-Instruct"
54
+ type: Literal["HyperbolicVisionModel"] = "HyperbolicVisionModel"
55
+ timeout: float = 600.0
56
+ _headers: Dict[str, str] = PrivateAttr(default=None)
57
+ _client: httpx.Client = PrivateAttr(default=None)
58
+ _BASE_URL: str = PrivateAttr(default="https://api.hyperbolic.xyz/v1/")
59
+
60
+ def __init__(self, **data: dict[str, Any]) -> None:
61
+ """
62
+ Initialize the HyperbolicVisionModel class with the provided data.
63
+
64
+ Args:
65
+ **data: Arbitrary keyword arguments containing initialization data.
66
+ """
67
+ super().__init__(**data)
68
+ self._headers = {
69
+ "Content-Type": "application/json",
70
+ "Authorization": f"Bearer {self.api_key.get_secret_value()}",
71
+ }
72
+ self._client = httpx.Client(
73
+ headers=self._headers,
74
+ base_url=self._BASE_URL,
75
+ timeout=self.timeout,
76
+ )
77
+
78
+ def _format_messages(
79
+ self,
80
+ messages: List[Type[MessageBase]],
81
+ ) -> List[Dict[str, Any]]:
82
+ """
83
+ Formats conversation messages into the structure expected by the API.
84
+
85
+ Args:
86
+ messages (List[MessageBase]): List of message objects from the
87
+ conversation history.
88
+
89
+ Returns:
90
+ List[Dict[str, Any]]: List of formatted message dictionaries.
91
+ """
92
+ formatted_messages = []
93
+ for message in messages:
94
+ formatted_message = message.model_dump(
95
+ include=["content", "role", "name"], exclude_none=True
96
+ )
97
+
98
+ if isinstance(formatted_message["content"], list):
99
+ formatted_content = []
100
+ for item in formatted_message["content"]:
101
+ if item["type"] == "image_url" and "file_path" in item:
102
+ # Convert file path to base64
103
+ base64_img = file_path_to_base64(item["file_path"])
104
+ formatted_content.append(
105
+ {
106
+ "type": "image_url",
107
+ "image_url": {
108
+ "url": (
109
+ f"data:image/jpeg;base64,{base64_img}"
110
+ )
111
+ },
112
+ }
113
+ )
114
+ else:
115
+ formatted_content.append(item)
116
+ formatted_message["content"] = formatted_content
117
+
118
+ formatted_messages.append(formatted_message)
119
+ return formatted_messages
120
+
121
+ def _prepare_usage_data(self, usage_data) -> UsageData:
122
+ """
123
+ Prepares and validates usage data received from the API response.
124
+
125
+ Args:
126
+ usage_data (dict): Raw usage data from the API response.
127
+
128
+ Returns:
129
+ UsageData: Validated usage data instance.
130
+ """
131
+ return UsageData.model_validate(usage_data)
132
+
133
+ @retry_on_status_codes((429, 529), max_retries=1)
134
+ def get_allowed_models(self) -> List[str]:
135
+ """
136
+ Get a list of allowed models for the Hyperbolic API.
137
+
138
+ Returns:
139
+ List[str]: List of allowed model names.
140
+ """
141
+ response = self._client.get("models")
142
+ response.raise_for_status()
143
+ response_data = response.json()
144
+
145
+ chat_models = [
146
+ model["id"]
147
+ for model in response_data["data"]
148
+ if model["supports_image_input"]
149
+ ]
150
+
151
+ return chat_models
152
+
153
+ @retry_on_status_codes((429, 529), max_retries=1)
154
+ def predict_vision(
155
+ self,
156
+ conversation: Conversation,
157
+ temperature: float = 0.7,
158
+ max_tokens: int = 2048,
159
+ top_p: float = 0.9,
160
+ stop: Optional[List[str]] = None,
161
+ ) -> Conversation:
162
+ """
163
+ Generates a response from the model based on the given conversation.
164
+
165
+ Args:
166
+ conversation (Conversation): Conversation object with message
167
+ history.
168
+ temperature (float): Sampling temperature for response diversity.
169
+ max_tokens (int): Maximum tokens for the model's response.
170
+ top_p (float): Cumulative probability for nucleus sampling.
171
+ stop (Optional[List[str]]): List of stop sequences for response
172
+ termination.
173
+
174
+ Returns:
175
+ Conversation: Updated conversation with the model's response.
176
+ """
177
+ formatted_messages = self._format_messages(conversation.history)
178
+ payload = {
179
+ "model": self.name,
180
+ "messages": formatted_messages,
181
+ "temperature": temperature,
182
+ "max_tokens": max_tokens,
183
+ "top_p": top_p,
184
+ "stop": stop or [],
185
+ }
186
+
187
+ response = self._client.post("chat/completions", json=payload)
188
+ response.raise_for_status()
189
+
190
+ response_data = response.json()
191
+
192
+ message_content = response_data["choices"][0]["message"]["content"]
193
+ usage_data = response_data.get("usage", {})
194
+
195
+ usage = self._prepare_usage_data(usage_data)
196
+ conversation.add_message(
197
+ AgentMessage(content=message_content, usage=usage)
198
+ )
199
+ return conversation
200
+
201
+ @retry_on_status_codes((429, 529), max_retries=1)
202
+ async def apredict_vision(
203
+ self,
204
+ conversation: Conversation,
205
+ temperature: float = 0.7,
206
+ max_tokens: int = 2048,
207
+ top_p: float = 0.9,
208
+ stop: Optional[List[str]] = None,
209
+ ) -> Conversation:
210
+ """
211
+ Async method to generate a response from the model based on the given
212
+ conversation.
213
+
214
+ Args:
215
+ conversation (Conversation): Conversation object with message
216
+ history.
217
+ temperature (float): Sampling temperature for response diversity.
218
+ max_tokens (int): Maximum tokens for the model's response.
219
+ top_p (float): Cumulative probability for nucleus sampling.
220
+ stop (Optional[List[str]]): List of stop sequences for response
221
+ termination.
222
+
223
+ Returns:
224
+ Conversation: Updated conversation with the model's response.
225
+ """
226
+ formatted_messages = self._format_messages(conversation.history)
227
+ payload = {
228
+ "model": self.name,
229
+ "messages": formatted_messages,
230
+ "temperature": temperature,
231
+ "max_tokens": max_tokens,
232
+ "top_p": top_p,
233
+ "stop": stop or [],
234
+ }
235
+
236
+ async with httpx.AsyncClient() as async_client:
237
+ response = await async_client.post(
238
+ f"{self._BASE_URL}chat/completions",
239
+ json=payload,
240
+ headers=self._headers,
241
+ )
242
+ response.raise_for_status()
243
+
244
+ response_data = response.json()
245
+
246
+ message_content = response_data["choices"][0]["message"]["content"]
247
+ usage_data = response_data.get("usage", {})
248
+
249
+ usage = self._prepare_usage_data(usage_data)
250
+ conversation.add_message(
251
+ AgentMessage(content=message_content, usage=usage)
252
+ )
253
+ return conversation
254
+
255
+ @retry_on_status_codes((429, 529), max_retries=1)
256
+ def stream(
257
+ self,
258
+ conversation: Conversation,
259
+ temperature: float = 0.7,
260
+ max_tokens: int = 2048,
261
+ top_p: float = 0.9,
262
+ stop: Optional[List[str]] = None,
263
+ ) -> Generator[str, None, None]:
264
+ """
265
+ Streams response text from the model in real-time.
266
+
267
+ Args:
268
+ conversation (Conversation): Conversation object with message
269
+ history.
270
+ temperature (float): Sampling temperature for response diversity.
271
+ max_tokens (int): Maximum tokens for the model's response.
272
+ top_p (float): Cumulative probability for nucleus sampling.
273
+ stop (Optional[List[str]]): List of stop sequences for response
274
+ termination.
275
+
276
+ Yields:
277
+ str: Partial response content from the model.
278
+ """
279
+ formatted_messages = self._format_messages(conversation.history)
280
+ payload = {
281
+ "model": self.name,
282
+ "messages": formatted_messages,
283
+ "temperature": temperature,
284
+ "max_tokens": max_tokens,
285
+ "top_p": top_p,
286
+ "stream": True,
287
+ "stop": stop or [],
288
+ }
289
+
290
+ response = self._client.post(self._BASE_URL, json=payload)
291
+ response.raise_for_status()
292
+
293
+ message_content = ""
294
+ for line in response.iter_lines():
295
+ json_str = line.replace("data: ", "")
296
+ try:
297
+ if json_str:
298
+ chunk = json.loads(json_str)
299
+ if chunk["choices"][0]["delta"]:
300
+ delta = chunk["choices"][0]["delta"]["content"]
301
+ message_content += delta
302
+ yield delta
303
+ except json.JSONDecodeError:
304
+ pass
305
+
306
+ conversation.add_message(AgentMessage(content=message_content))
307
+
308
+ @retry_on_status_codes((429, 529), max_retries=1)
309
+ async def astream(
310
+ self,
311
+ conversation: Conversation,
312
+ temperature: float = 0.7,
313
+ max_tokens: int = 2048,
314
+ top_p: float = 0.9,
315
+ stop: Optional[List[str]] = None,
316
+ ) -> AsyncGenerator[str, None]:
317
+ """
318
+ Async generator that streams response text from the model in real-time.
319
+
320
+ Args:
321
+ conversation (Conversation): Conversation object with message
322
+ history.
323
+ temperature (float): Sampling temperature for response diversity.
324
+ max_tokens (int): Maximum tokens for the model's response.
325
+ top_p (float): Cumulative probability for nucleus sampling.
326
+ stop (Optional[List[str]]): List of stop sequences for response
327
+ termination.
328
+
329
+ Yields:
330
+ str: Partial response content from the model.
331
+ """
332
+ formatted_messages = self._format_messages(conversation.history)
333
+ payload = {
334
+ "model": self.name,
335
+ "messages": formatted_messages,
336
+ "temperature": temperature,
337
+ "max_tokens": max_tokens,
338
+ "top_p": top_p,
339
+ "stream": True,
340
+ "stop": stop or [],
341
+ }
342
+
343
+ async with httpx.AsyncClient as async_client:
344
+ response = await async_client.post(
345
+ f"{self._BASE_URL}chat/completions",
346
+ json=payload,
347
+ headers=self._headers,
348
+ )
349
+ response.raise_for_status()
350
+
351
+ message_content = ""
352
+ async for line in response.aiter_lines():
353
+ json_str = line.replace("data: ", "")
354
+ try:
355
+ if json_str:
356
+ chunk = json.loads(json_str)
357
+ if chunk["choices"][0]["delta"]:
358
+ delta = chunk["choices"][0]["delta"]["content"]
359
+ message_content += delta
360
+ yield delta
361
+ except json.JSONDecodeError:
362
+ pass
363
+
364
+ conversation.add_message(AgentMessage(content=message_content))
365
+
366
+ def batch(
367
+ self,
368
+ conversations: List[Conversation],
369
+ temperature: float = 0.7,
370
+ max_tokens: int = 2048,
371
+ top_p: float = 0.9,
372
+ stop: Optional[List[str]] = None,
373
+ ) -> List[Conversation]:
374
+ """
375
+ Processes a batch of conversations and generates responses for each
376
+ sequentially.
377
+
378
+ Args:
379
+ conversations (List[Conversation]): List of conversations to
380
+ process.
381
+ temperature (float): Sampling temperature for response diversity.
382
+ max_tokens (int): Maximum tokens for each response.
383
+ top_p (float): Cumulative probability for nucleus sampling.
384
+ stop (Optional[List[str]]): List of stop sequences for response
385
+ termination.
386
+
387
+ Returns:
388
+ List[Conversation]: List of updated conversations with model
389
+ responses.
390
+ """
391
+ results = []
392
+ for conversation in conversations:
393
+ result_conversation = self.predict_vision(
394
+ conversation,
395
+ temperature=temperature,
396
+ max_tokens=max_tokens,
397
+ top_p=top_p,
398
+ stop=stop,
399
+ )
400
+ results.append(result_conversation)
401
+ return results
402
+
403
+ async def abatch(
404
+ self,
405
+ conversations: List[Conversation],
406
+ temperature: float = 0.7,
407
+ max_tokens: int = 2048,
408
+ top_p: float = 0.9,
409
+ stop: Optional[List[str]] = None,
410
+ max_concurrent=5,
411
+ ) -> List[Conversation]:
412
+ """
413
+ Async method for processing a batch of conversations concurrently.
414
+
415
+ Args:
416
+ conversations (List[Conversation]): List of conversations to
417
+ process.
418
+ temperature (float): Sampling temperature for response diversity.
419
+ max_tokens (int): Maximum tokens for each response.
420
+ top_p (float): Cumulative probability for nucleus sampling.
421
+ stop (Optional[List[str]]): List of stop sequences for response
422
+ termination.
423
+ max_concurrent (int): Maximum number of concurrent requests.
424
+
425
+ Returns:
426
+ List[Conversation]: List of updated conversations with model
427
+ responses.
428
+ """
429
+ semaphore = asyncio.Semaphore(max_concurrent)
430
+
431
+ async def process_conversation(conv: Conversation) -> Conversation:
432
+ async with semaphore:
433
+ return await self.apredict_vision(
434
+ conv,
435
+ temperature=temperature,
436
+ max_tokens=max_tokens,
437
+ top_p=top_p,
438
+ stop=stop,
439
+ )
440
+
441
+ tasks = [process_conversation(conv) for conv in conversations]
442
+ return await asyncio.gather(*tasks)
@@ -1,8 +1,14 @@
1
1
  from .HyperbolicAudioTTS import HyperbolicAudioTTS
2
2
  from .HyperbolicModel import HyperbolicModel
3
3
  from .HyperbolicVisionModel import HyperbolicVisionModel
4
+ from .HyperbolicVLM import HyperbolicVLM
4
5
 
5
- __all__ = ["HyperbolicAudioTTS", "HyperbolicModel", "HyperbolicVisionModel"]
6
+ __all__ = [
7
+ "HyperbolicAudioTTS",
8
+ "HyperbolicModel",
9
+ "HyperbolicVisionModel",
10
+ "HyperbolicVLM",
11
+ ]
6
12
 
7
13
  try:
8
14
  from importlib.metadata import PackageNotFoundError, version
@@ -1,87 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: swarmauri_llm_hyperbolic
3
- Version: 0.1.1.dev3
4
- Summary: Swarmauri Hyperbolic LLM adapters from swarmauri_standard.
5
- License-Expression: Apache-2.0
6
- License-File: LICENSE
7
- Keywords: swarmauri,llm,hyperbolic,model
8
- Author: Jacob Stewart
9
- Author-email: jacob@swarmauri.com
10
- Requires-Python: >=3.10,<3.15
11
- Classifier: License :: OSI Approved :: Apache Software License
12
- Classifier: Natural Language :: English
13
- Classifier: Development Status :: 3 - Alpha
14
- Classifier: Intended Audience :: Developers
15
- Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
16
- Classifier: Programming Language :: Python
17
- Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3 :: Only
19
- Classifier: Programming Language :: Python :: 3.10
20
- Classifier: Programming Language :: Python :: 3.11
21
- Classifier: Programming Language :: Python :: 3.12
22
- Classifier: Programming Language :: Python :: 3.13
23
- Classifier: Programming Language :: Python :: 3.14
24
- Requires-Dist: swarmauri_base
25
- Requires-Dist: swarmauri_core
26
- Requires-Dist: swarmauri_standard
27
- Description-Content-Type: text/markdown
28
-
29
- ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
30
-
31
- <p align="center">
32
- <a href="https://pepy.tech/project/swarmauri_llm_hyperbolic/">
33
- <img src="https://static.pepy.tech/badge/swarmauri_llm_hyperbolic/month" alt="PyPI - Downloads"/></a>
34
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_llm_hyperbolic/">
35
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_llm_hyperbolic.svg"/></a>
36
- <a href="https://pypi.org/project/swarmauri_llm_hyperbolic/">
37
- <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
38
- <a href="https://pypi.org/project/swarmauri_llm_hyperbolic/">
39
- <img src="https://img.shields.io/pypi/l/swarmauri_llm_hyperbolic" alt="PyPI - License"/></a>
40
- <a href="https://pypi.org/project/swarmauri_llm_hyperbolic/">
41
- <img src="https://img.shields.io/pypi/v/swarmauri_llm_hyperbolic?label=swarmauri_llm_hyperbolic&color=green" alt="PyPI - swarmauri_llm_hyperbolic"/></a>
42
- </p>
43
-
44
- # swarmauri_llm_hyperbolic
45
-
46
- Provider-specific Hyperbolic LLM package for Swarmauri. This package offers direct imports for HyperbolicAudioTTS, HyperbolicModel, HyperbolicVisionModel while keeping implementation parity with `swarmauri_standard`.
47
-
48
- ## Features
49
-
50
- - `HyperbolicAudioTTS` adapter exported from `swarmauri_standard.llms.HyperbolicAudioTTS`.
51
- - `HyperbolicModel` adapter exported from `swarmauri_standard.llms.HyperbolicModel`.
52
- - `HyperbolicVisionModel` adapter exported from `swarmauri_standard.llms.HyperbolicVisionModel`.
53
- - Compatible with Python 3.10 through 3.12.
54
-
55
- ## Installation
56
-
57
- ```bash
58
- # uv
59
- uv add swarmauri_llm_hyperbolic
60
-
61
- # pip
62
- pip install swarmauri_llm_hyperbolic
63
- ```
64
-
65
- ## Usage
66
-
67
- ```python
68
- from swarmauri_llm_hyperbolic import HyperbolicAudioTTS
69
- from swarmauri_llm_hyperbolic import HyperbolicModel
70
- from swarmauri_llm_hyperbolic import HyperbolicVisionModel
71
- from swarmauri_standard.conversations.Conversation import Conversation
72
- from swarmauri_standard.messages.HumanMessage import HumanMessage
73
-
74
- conversation = Conversation()
75
- conversation.add_message(HumanMessage(content="Hello from Swarmauri"))
76
-
77
- model = HyperbolicAudioTTS()
78
- # Configure provider credentials before making requests.
79
- # result = model.predict(conversation=conversation)
80
- ```
81
-
82
- ## Workflow Notes
83
-
84
- - These adapters intentionally mirror the corresponding classes in `swarmauri_standard`.
85
- - Use the provider package that matches your deployment and credential setup.
86
- - Install only the provider packages you need to keep dependencies minimal.
87
-
@@ -1,58 +0,0 @@
1
- ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
2
-
3
- <p align="center">
4
- <a href="https://pepy.tech/project/swarmauri_llm_hyperbolic/">
5
- <img src="https://static.pepy.tech/badge/swarmauri_llm_hyperbolic/month" alt="PyPI - Downloads"/></a>
6
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_llm_hyperbolic/">
7
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_llm_hyperbolic.svg"/></a>
8
- <a href="https://pypi.org/project/swarmauri_llm_hyperbolic/">
9
- <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
10
- <a href="https://pypi.org/project/swarmauri_llm_hyperbolic/">
11
- <img src="https://img.shields.io/pypi/l/swarmauri_llm_hyperbolic" alt="PyPI - License"/></a>
12
- <a href="https://pypi.org/project/swarmauri_llm_hyperbolic/">
13
- <img src="https://img.shields.io/pypi/v/swarmauri_llm_hyperbolic?label=swarmauri_llm_hyperbolic&color=green" alt="PyPI - swarmauri_llm_hyperbolic"/></a>
14
- </p>
15
-
16
- # swarmauri_llm_hyperbolic
17
-
18
- Provider-specific Hyperbolic LLM package for Swarmauri. This package offers direct imports for HyperbolicAudioTTS, HyperbolicModel, HyperbolicVisionModel while keeping implementation parity with `swarmauri_standard`.
19
-
20
- ## Features
21
-
22
- - `HyperbolicAudioTTS` adapter exported from `swarmauri_standard.llms.HyperbolicAudioTTS`.
23
- - `HyperbolicModel` adapter exported from `swarmauri_standard.llms.HyperbolicModel`.
24
- - `HyperbolicVisionModel` adapter exported from `swarmauri_standard.llms.HyperbolicVisionModel`.
25
- - Compatible with Python 3.10 through 3.12.
26
-
27
- ## Installation
28
-
29
- ```bash
30
- # uv
31
- uv add swarmauri_llm_hyperbolic
32
-
33
- # pip
34
- pip install swarmauri_llm_hyperbolic
35
- ```
36
-
37
- ## Usage
38
-
39
- ```python
40
- from swarmauri_llm_hyperbolic import HyperbolicAudioTTS
41
- from swarmauri_llm_hyperbolic import HyperbolicModel
42
- from swarmauri_llm_hyperbolic import HyperbolicVisionModel
43
- from swarmauri_standard.conversations.Conversation import Conversation
44
- from swarmauri_standard.messages.HumanMessage import HumanMessage
45
-
46
- conversation = Conversation()
47
- conversation.add_message(HumanMessage(content="Hello from Swarmauri"))
48
-
49
- model = HyperbolicAudioTTS()
50
- # Configure provider credentials before making requests.
51
- # result = model.predict(conversation=conversation)
52
- ```
53
-
54
- ## Workflow Notes
55
-
56
- - These adapters intentionally mirror the corresponding classes in `swarmauri_standard`.
57
- - Use the provider package that matches your deployment and credential setup.
58
- - Install only the provider packages you need to keep dependencies minimal.