runapi-nemotron 0.1.1__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.
- runapi_nemotron-0.1.1/LICENSE +21 -0
- runapi_nemotron-0.1.1/PKG-INFO +36 -0
- runapi_nemotron-0.1.1/README.md +12 -0
- runapi_nemotron-0.1.1/pyproject.toml +42 -0
- runapi_nemotron-0.1.1/src/runapi/nemotron/__init__.py +24 -0
- runapi_nemotron-0.1.1/src/runapi/nemotron/client.py +13 -0
- runapi_nemotron-0.1.1/src/runapi/nemotron/py.typed +0 -0
- runapi_nemotron-0.1.1/src/runapi/nemotron/resources/__init__.py +0 -0
- runapi_nemotron-0.1.1/src/runapi/nemotron/resources/speech_to_text.py +53 -0
- runapi_nemotron-0.1.1/src/runapi/nemotron/types.py +13 -0
- runapi_nemotron-0.1.1/tests/test_client.py +18 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 RunAPI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: runapi-nemotron
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: RunAPI Nemotron SDK for speech-to-text integration
|
|
5
|
+
Project-URL: Homepage, https://runapi.ai/models/nemotron
|
|
6
|
+
Project-URL: Documentation, https://runapi.ai/docs/resources/sdks
|
|
7
|
+
Project-URL: Source, https://github.com/runapi-ai/nemotron-sdk
|
|
8
|
+
Project-URL: Issues, https://github.com/runapi-ai/nemotron-sdk/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/runapi-ai/nemotron-sdk/blob/main/CHANGELOG.md
|
|
10
|
+
Project-URL: Release Notes, https://github.com/runapi-ai/nemotron-sdk/releases/tag/python%2Fv0.1.1
|
|
11
|
+
Author-email: RunAPI <contact@runapi.ai>
|
|
12
|
+
License-Expression: Apache-2.0
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Keywords: api,audio,golang,java,maven,nemotron,python,ruby,runapi,runapi-ai,sdk,speech-to-text,transcription,typescript
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Requires-Dist: runapi-core~=0.12.0
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# Nemotron SDK for RunAPI
|
|
26
|
+
|
|
27
|
+
Transcribe audio with Nemotron 3.5 through the asynchronous speech-to-text API.
|
|
28
|
+
Create a task with `model: "nemotron-3.5-transcribe"` and `source_audio_url`, then fetch its result by task ID.
|
|
29
|
+
Optional `timestamps` includes word timestamps and `target_language` selects the transcription language. Omit `target_language` when `timestamps` is true.
|
|
30
|
+
Completed results contain `text`, fractional-second `duration`, a transcript `url`, and `expires_at`.
|
|
31
|
+
|
|
32
|
+
[Model documentation](https://runapi.ai/models/nemotron) · [Pricing](https://runapi.ai/models/nemotron) · [SDK guide](https://runapi.ai/docs/resources/sdks)
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
pip install runapi-nemotron
|
|
36
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Nemotron SDK for RunAPI
|
|
2
|
+
|
|
3
|
+
Transcribe audio with Nemotron 3.5 through the asynchronous speech-to-text API.
|
|
4
|
+
Create a task with `model: "nemotron-3.5-transcribe"` and `source_audio_url`, then fetch its result by task ID.
|
|
5
|
+
Optional `timestamps` includes word timestamps and `target_language` selects the transcription language. Omit `target_language` when `timestamps` is true.
|
|
6
|
+
Completed results contain `text`, fractional-second `duration`, a transcript `url`, and `expires_at`.
|
|
7
|
+
|
|
8
|
+
[Model documentation](https://runapi.ai/models/nemotron) · [Pricing](https://runapi.ai/models/nemotron) · [SDK guide](https://runapi.ai/docs/resources/sdks)
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
pip install runapi-nemotron
|
|
12
|
+
```
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "runapi-nemotron"
|
|
7
|
+
version = "0.1.1"
|
|
8
|
+
description = "RunAPI Nemotron SDK for speech-to-text integration"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Programming Language :: Python :: 3",
|
|
13
|
+
"Programming Language :: Python :: 3.10",
|
|
14
|
+
"Programming Language :: Python :: 3.11",
|
|
15
|
+
"Programming Language :: Python :: 3.12",
|
|
16
|
+
"Programming Language :: Python :: 3.13",
|
|
17
|
+
"Programming Language :: Python :: 3.14",
|
|
18
|
+
]
|
|
19
|
+
license = "Apache-2.0"
|
|
20
|
+
authors = [{ name = "RunAPI", email = "contact@runapi.ai" }]
|
|
21
|
+
keywords = ["runapi", "runapi-ai", "nemotron", "transcription", "speech-to-text", "audio", "api", "sdk", "typescript", "python", "ruby", "golang", "java", "maven"]
|
|
22
|
+
dependencies = ["runapi-core~=0.12.0"]
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
Homepage = "https://runapi.ai/models/nemotron"
|
|
26
|
+
Documentation = "https://runapi.ai/docs/resources/sdks"
|
|
27
|
+
Source = "https://github.com/runapi-ai/nemotron-sdk"
|
|
28
|
+
Issues = "https://github.com/runapi-ai/nemotron-sdk/issues"
|
|
29
|
+
Changelog = "https://github.com/runapi-ai/nemotron-sdk/blob/main/CHANGELOG.md"
|
|
30
|
+
"Release Notes" = "https://github.com/runapi-ai/nemotron-sdk/releases/tag/python%2Fv0.1.1"
|
|
31
|
+
|
|
32
|
+
[tool.hatch.build.targets.wheel]
|
|
33
|
+
packages = ["src/runapi"]
|
|
34
|
+
|
|
35
|
+
[tool.uv]
|
|
36
|
+
package = true
|
|
37
|
+
|
|
38
|
+
[dependency-groups]
|
|
39
|
+
dev = ["pytest>=8"]
|
|
40
|
+
|
|
41
|
+
[tool.runapi]
|
|
42
|
+
slug = "nemotron"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Nemotron client for RunAPI."""
|
|
2
|
+
|
|
3
|
+
from runapi.core import (
|
|
4
|
+
AuthenticationError,
|
|
5
|
+
InsufficientCreditsError,
|
|
6
|
+
NotFoundError,
|
|
7
|
+
RateLimitError,
|
|
8
|
+
TaskFailedError,
|
|
9
|
+
TaskTimeoutError,
|
|
10
|
+
ValidationError,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
from .client import NemotronClient
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"NemotronClient",
|
|
17
|
+
"AuthenticationError",
|
|
18
|
+
"RateLimitError",
|
|
19
|
+
"InsufficientCreditsError",
|
|
20
|
+
"NotFoundError",
|
|
21
|
+
"ValidationError",
|
|
22
|
+
"TaskFailedError",
|
|
23
|
+
"TaskTimeoutError",
|
|
24
|
+
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Nemotron audio transcription client."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Optional
|
|
4
|
+
|
|
5
|
+
from runapi.core import ProviderClient
|
|
6
|
+
|
|
7
|
+
from .resources.speech_to_text import SpeechToText
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class NemotronClient(ProviderClient):
|
|
11
|
+
def __init__(self, api_key: Optional[str] = None, **options: Any) -> None:
|
|
12
|
+
super().__init__(api_key, **options)
|
|
13
|
+
self.speech_to_text = SpeechToText(self._http)
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""Nemotron speech-to-text resource."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Optional
|
|
6
|
+
|
|
7
|
+
from runapi.core import Resource, RequestOptions
|
|
8
|
+
|
|
9
|
+
from ..types import CompletedSpeechToTextResponse, SpeechToTextResponse
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class SpeechToText(Resource):
|
|
13
|
+
"""Transcribe speech audio to text with Nemotron models."""
|
|
14
|
+
|
|
15
|
+
ENDPOINT = "/api/v1/nemotron/speech_to_text"
|
|
16
|
+
|
|
17
|
+
RESPONSE_CLASS = SpeechToTextResponse
|
|
18
|
+
COMPLETED_RESPONSE_CLASS = CompletedSpeechToTextResponse
|
|
19
|
+
|
|
20
|
+
def run(self, options: Optional[RequestOptions] = None, **params: Any) -> Any:
|
|
21
|
+
"""Create a speech-to-text task and poll until it completes.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
**params: Transcription parameters including model and source_audio_url.
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
The completed speech-to-text response.
|
|
28
|
+
"""
|
|
29
|
+
task = self.create(options=options, **params)
|
|
30
|
+
return self._poll_until_complete(lambda: self.get(task.id, options=options))
|
|
31
|
+
|
|
32
|
+
def create(self, options: Optional[RequestOptions] = None, **params: Any) -> Any:
|
|
33
|
+
"""Create a speech-to-text task and return immediately with an id.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
**params: Transcription parameters including model and source_audio_url.
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
The task creation result with an id.
|
|
40
|
+
"""
|
|
41
|
+
compacted = self._compact_params(params)
|
|
42
|
+
return self._request("post", self.ENDPOINT, body=compacted, options=options)
|
|
43
|
+
|
|
44
|
+
def get(self, id: str, options: Optional[RequestOptions] = None) -> Any:
|
|
45
|
+
"""Fetch the current status of a speech-to-text task.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
id: Task id.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
The current speech-to-text status.
|
|
52
|
+
"""
|
|
53
|
+
return self._request("get", f"{self.ENDPOINT}/{id}", options=options)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from runapi.core import TaskResponse, optional, required
|
|
2
|
+
|
|
3
|
+
class SpeechToTextResponse(TaskResponse):
|
|
4
|
+
text = optional(str)
|
|
5
|
+
duration = optional(float)
|
|
6
|
+
url = optional(str)
|
|
7
|
+
expires_at = optional(str)
|
|
8
|
+
|
|
9
|
+
class CompletedSpeechToTextResponse(SpeechToTextResponse):
|
|
10
|
+
text = required(str)
|
|
11
|
+
duration = required(float)
|
|
12
|
+
url = required(str)
|
|
13
|
+
expires_at = required(str)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from runapi.nemotron import NemotronClient
|
|
2
|
+
|
|
3
|
+
class FakeHttp:
|
|
4
|
+
def __init__(self):
|
|
5
|
+
self.calls = []
|
|
6
|
+
def request(self, method, path, body=None, options=None):
|
|
7
|
+
self.calls.append((method, path, body))
|
|
8
|
+
return {"id": "task_1", "status": "completed", "text": "Hello", "duration": 12.64, "url": "https://file.runapi.ai/transcript.json", "expires_at": "2026-12-01T00:00:00Z"}
|
|
9
|
+
|
|
10
|
+
def test_transcription_create_and_get():
|
|
11
|
+
http = FakeHttp()
|
|
12
|
+
client = NemotronClient(api_key="test", http_client=http)
|
|
13
|
+
task = client.speech_to_text.create(model="nemotron-3.5-transcribe", source_audio_url="https://cdn.runapi.ai/public/samples/voice.mp3", timestamps=False, target_language="en")
|
|
14
|
+
assert task.id == "task_1"
|
|
15
|
+
assert http.calls[0] == ("post", "/api/v1/nemotron/speech_to_text", {"model": "nemotron-3.5-transcribe", "source_audio_url": "https://cdn.runapi.ai/public/samples/voice.mp3", "timestamps": False, "target_language": "en"})
|
|
16
|
+
result = client.speech_to_text.get(task.id)
|
|
17
|
+
assert http.calls[1] == ("get", "/api/v1/nemotron/speech_to_text/task_1", None)
|
|
18
|
+
assert (result.text, result.duration, result.url, result.expires_at) == ("Hello", 12.64, "https://file.runapi.ai/transcript.json", "2026-12-01T00:00:00Z")
|