mira-network 0.1.2__py3-none-any.whl → 0.1.3__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.
- {mira_network-0.1.2.dist-info → mira_network-0.1.3.dist-info}/METADATA +3 -2
- mira_network-0.1.3.dist-info/RECORD +7 -0
- mira_sdk/client.py +12 -14
- mira_network-0.1.2.dist-info/RECORD +0 -7
- {mira_network-0.1.2.dist-info → mira_network-0.1.3.dist-info}/WHEEL +0 -0
- {mira_network-0.1.2.dist-info → mira_network-0.1.3.dist-info}/entry_points.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: mira-network
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.3
|
4
4
|
Summary: Python SDK for Mira Network API
|
5
5
|
Author-Email: sarim2000 <sarimbleedblue@gmail.com>
|
6
6
|
License: MIT
|
@@ -9,6 +9,7 @@ Requires-Dist: httpx>=0.28.1
|
|
9
9
|
Requires-Dist: pydantic>=2.10.4
|
10
10
|
Requires-Dist: typing-extensions>=4.8.0
|
11
11
|
Requires-Dist: requests>=2.32.3
|
12
|
+
Requires-Dist: pytest-cov>=6.0.0
|
12
13
|
Description-Content-Type: text/markdown
|
13
14
|
|
14
15
|
# Mira Network SDK
|
@@ -40,7 +41,7 @@ async def main():
|
|
40
41
|
|
41
42
|
# Generate text
|
42
43
|
request = AiRequest(
|
43
|
-
model="
|
44
|
+
model="gpt-4o",
|
44
45
|
messages=[
|
45
46
|
Message(role="system", content="You are a helpful assistant."),
|
46
47
|
Message(role="user", content="Hello!")
|
@@ -0,0 +1,7 @@
|
|
1
|
+
mira_network-0.1.3.dist-info/METADATA,sha256=Bii_N1AYNnH5H8qjsfMVC8CEsaoqjva_x7ZGtRuWLfI,2941
|
2
|
+
mira_network-0.1.3.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
3
|
+
mira_network-0.1.3.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
4
|
+
mira_sdk/__init__.py,sha256=KVFj7e20pprJuOWCG9Ky_w2JqKBu8TFPCilPDKRhkyI,364
|
5
|
+
mira_sdk/client.py,sha256=35g97GTbcTMojCn6Jh0RK7cEZ3ahYjoS5PiuCgZr8LU,5703
|
6
|
+
mira_sdk/models.py,sha256=FQfxjK_Cs7Nt0dB1qYHd7rov3VJSVr6rNAqZqOarU48,1749
|
7
|
+
mira_network-0.1.3.dist-info/RECORD,,
|
mira_sdk/client.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
from typing import Optional, List, Dict, AsyncGenerator, Union
|
1
|
+
from typing import AsyncIterator, Optional, List, Dict, AsyncGenerator, Union
|
2
2
|
import httpx
|
3
|
-
from
|
3
|
+
from .models import (
|
4
4
|
Message,
|
5
5
|
ModelProvider,
|
6
6
|
AiRequest,
|
@@ -12,7 +12,12 @@ from mira_sdk.models import (
|
|
12
12
|
|
13
13
|
|
14
14
|
class MiraClient:
|
15
|
-
|
15
|
+
|
16
|
+
def __init__(
|
17
|
+
self,
|
18
|
+
base_url: str = "https://mira-network.alts.dev/",
|
19
|
+
api_token: Optional[str] = None,
|
20
|
+
):
|
16
21
|
"""Initialize Mira client.
|
17
22
|
|
18
23
|
Args:
|
@@ -44,9 +49,7 @@ class MiraClient:
|
|
44
49
|
response.raise_for_status()
|
45
50
|
return response.json()
|
46
51
|
|
47
|
-
async def generate(
|
48
|
-
self, request: AiRequest
|
49
|
-
) -> Union[str, AsyncGenerator[str, None]]:
|
52
|
+
async def generate(self, request: AiRequest) -> Union[str, AsyncIterator[str]]:
|
50
53
|
"""Generate text using the specified model."""
|
51
54
|
response = await self._client.post(
|
52
55
|
f"{self.base_url}/v1/chat/completions",
|
@@ -57,12 +60,7 @@ class MiraClient:
|
|
57
60
|
response.raise_for_status()
|
58
61
|
|
59
62
|
if request.stream:
|
60
|
-
|
61
|
-
async def stream_response():
|
62
|
-
async for chunk in response.aiter_text():
|
63
|
-
yield chunk
|
64
|
-
|
65
|
-
return stream_response()
|
63
|
+
return response.aiter_lines()
|
66
64
|
else:
|
67
65
|
return response.json()
|
68
66
|
|
@@ -127,7 +125,7 @@ class MiraClient:
|
|
127
125
|
async def create_api_token(self, request: ApiTokenRequest) -> Dict:
|
128
126
|
"""Create a new API token."""
|
129
127
|
response = await self._client.post(
|
130
|
-
f"{self.base_url}/tokens",
|
128
|
+
f"{self.base_url}/api-tokens",
|
131
129
|
headers=self._get_headers(),
|
132
130
|
json=request.model_dump(),
|
133
131
|
)
|
@@ -154,7 +152,7 @@ class MiraClient:
|
|
154
152
|
async def get_user_credits(self) -> Dict:
|
155
153
|
"""Get user credits information."""
|
156
154
|
response = await self._client.get(
|
157
|
-
f"{self.base_url}/credits",
|
155
|
+
f"{self.base_url}/user-credits",
|
158
156
|
headers=self._get_headers(),
|
159
157
|
)
|
160
158
|
response.raise_for_status()
|
@@ -1,7 +0,0 @@
|
|
1
|
-
mira_network-0.1.2.dist-info/METADATA,sha256=KrCNwQMJqIY3acFF9c00JXWnCnAm0Z_SArKg4dLO8_k,2915
|
2
|
-
mira_network-0.1.2.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
3
|
-
mira_network-0.1.2.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
4
|
-
mira_sdk/__init__.py,sha256=KVFj7e20pprJuOWCG9Ky_w2JqKBu8TFPCilPDKRhkyI,364
|
5
|
-
mira_sdk/client.py,sha256=F0E0ATGZXOsozbp91P6MLma5-pgT0rCo0BaEIz-yKDk,5769
|
6
|
-
mira_sdk/models.py,sha256=FQfxjK_Cs7Nt0dB1qYHd7rov3VJSVr6rNAqZqOarU48,1749
|
7
|
-
mira_network-0.1.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|