relancify-sdk 0.1.0__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,2 @@
1
+ include README.md
2
+ recursive-include relancify_sdk *.py
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.4
2
+ Name: relancify-sdk
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the Relancify API.
5
+ Author: Relancify
6
+ Project-URL: Homepage, https://www.relancify.com
7
+ Project-URL: Repository, https://github.com/NKSTUD/relancify-sdk
8
+ Project-URL: Documentation, https://www.relancify.com
9
+ Keywords: relancify,sdk,voice,agent,api
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+ Requires-Dist: httpx<1.0,>=0.25
22
+
23
+ # Relancify SDK (Python)
24
+
25
+ Official Python SDK for the Relancify API.
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ pip install relancify-sdk
31
+ ```
32
+
33
+ ## Quickstart
34
+
35
+ ```python
36
+ from relancify_sdk import RelancifyClient
37
+
38
+ client = RelancifyClient(
39
+ base_url="https://api.relancify.com/api/v1",
40
+ api_key="<your_api_key>",
41
+ )
42
+
43
+ agents = client.agents.list()
44
+ print(len(agents))
45
+
46
+ client.close()
47
+ ```
48
+
49
+ ## Available resources
50
+
51
+ - `client.agents`
52
+ - `client.runtime`
53
+ - `client.users`
54
+ - `client.voices`
55
+ - `client.api_keys`
56
+
57
+ ## Notes
58
+
59
+ - The SDK uses synchronous `httpx`.
60
+ - HTTP errors are raised as `relancify_sdk.errors.ApiError`.
61
+
62
+ ## Security best practices
63
+
64
+ - Never hardcode API keys or bearer tokens in source code.
65
+ - Use environment variables or a secure secret manager.
66
+ - Rotate credentials periodically.
67
+ - Prefer short-lived access tokens when possible.
@@ -0,0 +1,45 @@
1
+ # Relancify SDK (Python)
2
+
3
+ Official Python SDK for the Relancify API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install relancify-sdk
9
+ ```
10
+
11
+ ## Quickstart
12
+
13
+ ```python
14
+ from relancify_sdk import RelancifyClient
15
+
16
+ client = RelancifyClient(
17
+ base_url="https://api.relancify.com/api/v1",
18
+ api_key="<your_api_key>",
19
+ )
20
+
21
+ agents = client.agents.list()
22
+ print(len(agents))
23
+
24
+ client.close()
25
+ ```
26
+
27
+ ## Available resources
28
+
29
+ - `client.agents`
30
+ - `client.runtime`
31
+ - `client.users`
32
+ - `client.voices`
33
+ - `client.api_keys`
34
+
35
+ ## Notes
36
+
37
+ - The SDK uses synchronous `httpx`.
38
+ - HTTP errors are raised as `relancify_sdk.errors.ApiError`.
39
+
40
+ ## Security best practices
41
+
42
+ - Never hardcode API keys or bearer tokens in source code.
43
+ - Use environment variables or a secure secret manager.
44
+ - Rotate credentials periodically.
45
+ - Prefer short-lived access tokens when possible.
@@ -0,0 +1,36 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "relancify-sdk"
7
+ version = "0.1.0"
8
+ description = "Official Python SDK for the Relancify API."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ dependencies = [
12
+ "httpx>=0.25,<1.0",
13
+ ]
14
+ authors = [
15
+ { name = "Relancify" },
16
+ ]
17
+ keywords = ["relancify", "sdk", "voice", "agent", "api"]
18
+ classifiers = [
19
+ "Development Status :: 3 - Alpha",
20
+ "Intended Audience :: Developers",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3 :: Only",
23
+ "Programming Language :: Python :: 3.9",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Topic :: Software Development :: Libraries :: Python Modules",
28
+ ]
29
+
30
+ [project.urls]
31
+ Homepage = "https://www.relancify.com"
32
+ Repository = "https://github.com/NKSTUD/relancify-sdk"
33
+ Documentation = "https://www.relancify.com"
34
+
35
+ [tool.setuptools.packages.find]
36
+ include = ["relancify_sdk*"]
@@ -0,0 +1,6 @@
1
+ from relancify_sdk.client import RelancifyClient
2
+ from relancify_sdk.errors import ApiError, RelancifyError
3
+
4
+ __version__ = "0.1.0"
5
+
6
+ __all__ = ["RelancifyClient", "RelancifyError", "ApiError", "__version__"]
@@ -0,0 +1,16 @@
1
+ from dataclasses import dataclass
2
+ from typing import Dict, Optional
3
+
4
+
5
+ @dataclass(frozen=True)
6
+ class AuthConfig:
7
+ api_key: Optional[str] = None
8
+ bearer: Optional[str] = None
9
+
10
+ def apply(self, headers: Dict[str, str]) -> Dict[str, str]:
11
+ resolved = dict(headers)
12
+ if self.api_key:
13
+ resolved["X-API-Key"] = self.api_key
14
+ if self.bearer:
15
+ resolved["Authorization"] = f"Bearer {self.bearer}"
16
+ return resolved
@@ -0,0 +1,29 @@
1
+ from typing import Optional
2
+
3
+ from relancify_sdk.auth import AuthConfig
4
+ from relancify_sdk.http import HttpClient
5
+ from relancify_sdk.resources.agents import AgentsResource
6
+ from relancify_sdk.resources.api_keys import ApiKeysResource
7
+ from relancify_sdk.resources.runtime import RuntimeResource
8
+ from relancify_sdk.resources.users import UsersResource
9
+ from relancify_sdk.resources.voices import VoicesResource
10
+
11
+
12
+ class RelancifyClient:
13
+ def __init__(
14
+ self,
15
+ base_url: str = "http://localhost:8000/api/v1",
16
+ api_key: Optional[str] = None,
17
+ bearer: Optional[str] = None,
18
+ timeout: float = 30.0,
19
+ ) -> None:
20
+ auth = AuthConfig(api_key=api_key, bearer=bearer)
21
+ self._http = HttpClient(base_url=base_url, auth=auth, timeout=timeout)
22
+ self.agents = AgentsResource(self._http)
23
+ self.api_keys = ApiKeysResource(self._http)
24
+ self.runtime = RuntimeResource(self._http)
25
+ self.users = UsersResource(self._http)
26
+ self.voices = VoicesResource(self._http)
27
+
28
+ def close(self) -> None:
29
+ self._http.close()
@@ -0,0 +1,12 @@
1
+ from typing import Any, Optional
2
+
3
+
4
+ class RelancifyError(Exception):
5
+ pass
6
+
7
+
8
+ class ApiError(RelancifyError):
9
+ def __init__(self, message: str, status_code: Optional[int] = None, detail: Any = None) -> None:
10
+ super().__init__(message)
11
+ self.status_code = status_code
12
+ self.detail = detail
@@ -0,0 +1,53 @@
1
+ from typing import Any, Dict, Optional
2
+
3
+ import httpx
4
+
5
+ from relancify_sdk.auth import AuthConfig
6
+ from relancify_sdk.errors import ApiError
7
+
8
+
9
+ class HttpClient:
10
+ def __init__(
11
+ self,
12
+ base_url: str,
13
+ auth: AuthConfig,
14
+ timeout: float = 30.0,
15
+ ) -> None:
16
+ self._base_url = base_url.rstrip("/")
17
+ self._client = httpx.Client(base_url=self._base_url, timeout=timeout)
18
+ self._auth = auth
19
+
20
+ @property
21
+ def base_url(self) -> str:
22
+ return self._base_url
23
+
24
+ def request(
25
+ self,
26
+ method: str,
27
+ path: str,
28
+ json: Optional[Dict[str, Any]] = None,
29
+ headers: Optional[Dict[str, str]] = None,
30
+ ) -> Any:
31
+ payload_headers = headers or {}
32
+ merged_headers = self._auth.apply(payload_headers)
33
+ response = self._client.request(method, path, json=json, headers=merged_headers)
34
+ if response.status_code >= 400:
35
+ detail = None
36
+ try:
37
+ detail = response.json()
38
+ except ValueError:
39
+ detail = response.text
40
+ raise ApiError(
41
+ message=detail.get("detail") if isinstance(detail, dict) else str(detail),
42
+ status_code=response.status_code,
43
+ detail=detail,
44
+ )
45
+ if response.status_code == 204:
46
+ return None
47
+ content_type = response.headers.get("content-type", "")
48
+ if "application/json" in content_type:
49
+ return response.json()
50
+ return response.text
51
+
52
+ def close(self) -> None:
53
+ self._client.close()
@@ -0,0 +1 @@
1
+ __all__ = ["agents", "api_keys", "runtime", "users", "voices"]
@@ -0,0 +1,63 @@
1
+ from typing import Any, Dict, List, Optional
2
+
3
+ from relancify_sdk.http import HttpClient
4
+
5
+
6
+ class AgentsResource:
7
+ def __init__(self, client: HttpClient) -> None:
8
+ self._client = client
9
+
10
+ def list(self) -> List[Dict[str, Any]]:
11
+ return self._client.request("GET", "/agents")
12
+
13
+ def get(self, agent_id: str) -> Dict[str, Any]:
14
+ return self._client.request("GET", f"/agents/{agent_id}")
15
+
16
+ def create(self, payload: Dict[str, Any], sync: bool = True) -> Dict[str, Any]:
17
+ path = "/agents/sync" if sync else "/agents"
18
+ return self._client.request("POST", path, json=payload)
19
+
20
+ def update(self, agent_id: str, payload: Dict[str, Any], sync: bool = True) -> Dict[str, Any]:
21
+ path = f"/agents/{agent_id}/sync" if sync else f"/agents/{agent_id}"
22
+ return self._client.request("PUT", path, json=payload)
23
+
24
+ def delete(self, agent_id: str) -> None:
25
+ self._client.request("DELETE", f"/agents/{agent_id}")
26
+
27
+ def get_provider_config(self, agent_id: str) -> Dict[str, Any]:
28
+ return self._client.request("GET", f"/agents/{agent_id}/provider")
29
+
30
+ def create_runtime_session(self, agent_id: str) -> Dict[str, Any]:
31
+ return self._client.request("POST", f"/agents/{agent_id}/runtime/session")
32
+
33
+ def normalize_runtime_event(self, agent_id: str, event: Dict[str, Any]) -> Dict[str, Any]:
34
+ return self._client.request(
35
+ "POST",
36
+ f"/agents/{agent_id}/runtime/events/normalize",
37
+ json={"event": event},
38
+ )
39
+
40
+ def compile_runtime_event(
41
+ self,
42
+ agent_id: str,
43
+ *,
44
+ event_type: str,
45
+ event_id: Optional[str] = None,
46
+ text: Optional[str] = None,
47
+ audio_base64: Optional[str] = None,
48
+ metadata: Optional[Dict[str, Any]] = None,
49
+ raw_payload: Optional[Dict[str, Any]] = None,
50
+ ) -> Dict[str, Any]:
51
+ payload: Dict[str, Any] = {
52
+ "type": event_type,
53
+ "event_id": event_id,
54
+ "text": text,
55
+ "audio_base64": audio_base64,
56
+ "metadata": metadata or {},
57
+ "raw_payload": raw_payload or {},
58
+ }
59
+ return self._client.request(
60
+ "POST",
61
+ f"/agents/{agent_id}/runtime/events/compile",
62
+ json=payload,
63
+ )
@@ -0,0 +1,17 @@
1
+ from typing import Any, Dict, List
2
+
3
+ from relancify_sdk.http import HttpClient
4
+
5
+
6
+ class ApiKeysResource:
7
+ def __init__(self, client: HttpClient) -> None:
8
+ self._client = client
9
+
10
+ def list(self) -> List[Dict[str, Any]]:
11
+ return self._client.request("GET", "/api-keys")
12
+
13
+ def create(self, payload: Dict[str, Any]) -> Dict[str, Any]:
14
+ return self._client.request("POST", "/api-keys", json=payload)
15
+
16
+ def revoke(self, api_key_id: str) -> None:
17
+ self._client.request("DELETE", f"/api-keys/{api_key_id}")
@@ -0,0 +1,29 @@
1
+ from typing import Any, Dict, Optional
2
+ from urllib.parse import quote
3
+
4
+ from relancify_sdk.http import HttpClient
5
+
6
+
7
+ class RuntimeResource:
8
+ def __init__(self, client: HttpClient) -> None:
9
+ self._client = client
10
+
11
+ def get_session(self, session_id: str) -> Dict[str, Any]:
12
+ return self._client.request("GET", f"/runtime/sessions/{session_id}")
13
+
14
+ def close_session(self, session_id: str) -> Dict[str, Any]:
15
+ return self._client.request("DELETE", f"/runtime/sessions/{session_id}")
16
+
17
+ def build_websocket_url(
18
+ self, session_id: str, access_token: Optional[str] = None
19
+ ) -> str:
20
+ ws_base = self._client.base_url
21
+ if ws_base.startswith("https://"):
22
+ ws_base = "wss://" + ws_base[len("https://") :]
23
+ elif ws_base.startswith("http://"):
24
+ ws_base = "ws://" + ws_base[len("http://") :]
25
+
26
+ if access_token:
27
+ token = quote(access_token, safe="")
28
+ return f"{ws_base}/runtime/sessions/{session_id}?access_token={token}"
29
+ return f"{ws_base}/runtime/sessions/{session_id}"
@@ -0,0 +1,11 @@
1
+ from typing import Any, Dict
2
+
3
+ from relancify_sdk.http import HttpClient
4
+
5
+
6
+ class UsersResource:
7
+ def __init__(self, client: HttpClient) -> None:
8
+ self._client = client
9
+
10
+ def me(self) -> Dict[str, Any]:
11
+ return self._client.request("GET", "/users/me")
@@ -0,0 +1,11 @@
1
+ from typing import Any, Dict, List
2
+
3
+ from relancify_sdk.http import HttpClient
4
+
5
+
6
+ class VoicesResource:
7
+ def __init__(self, client: HttpClient) -> None:
8
+ self._client = client
9
+
10
+ def list(self) -> List[Dict[str, Any]]:
11
+ return self._client.request("GET", "/voices")
@@ -0,0 +1 @@
1
+ __all__ = []
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.4
2
+ Name: relancify-sdk
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the Relancify API.
5
+ Author: Relancify
6
+ Project-URL: Homepage, https://www.relancify.com
7
+ Project-URL: Repository, https://github.com/NKSTUD/relancify-sdk
8
+ Project-URL: Documentation, https://www.relancify.com
9
+ Keywords: relancify,sdk,voice,agent,api
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+ Requires-Dist: httpx<1.0,>=0.25
22
+
23
+ # Relancify SDK (Python)
24
+
25
+ Official Python SDK for the Relancify API.
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ pip install relancify-sdk
31
+ ```
32
+
33
+ ## Quickstart
34
+
35
+ ```python
36
+ from relancify_sdk import RelancifyClient
37
+
38
+ client = RelancifyClient(
39
+ base_url="https://api.relancify.com/api/v1",
40
+ api_key="<your_api_key>",
41
+ )
42
+
43
+ agents = client.agents.list()
44
+ print(len(agents))
45
+
46
+ client.close()
47
+ ```
48
+
49
+ ## Available resources
50
+
51
+ - `client.agents`
52
+ - `client.runtime`
53
+ - `client.users`
54
+ - `client.voices`
55
+ - `client.api_keys`
56
+
57
+ ## Notes
58
+
59
+ - The SDK uses synchronous `httpx`.
60
+ - HTTP errors are raised as `relancify_sdk.errors.ApiError`.
61
+
62
+ ## Security best practices
63
+
64
+ - Never hardcode API keys or bearer tokens in source code.
65
+ - Use environment variables or a secure secret manager.
66
+ - Rotate credentials periodically.
67
+ - Prefer short-lived access tokens when possible.
@@ -0,0 +1,20 @@
1
+ MANIFEST.in
2
+ README.md
3
+ pyproject.toml
4
+ relancify_sdk/__init__.py
5
+ relancify_sdk/auth.py
6
+ relancify_sdk/client.py
7
+ relancify_sdk/errors.py
8
+ relancify_sdk/http.py
9
+ relancify_sdk.egg-info/PKG-INFO
10
+ relancify_sdk.egg-info/SOURCES.txt
11
+ relancify_sdk.egg-info/dependency_links.txt
12
+ relancify_sdk.egg-info/requires.txt
13
+ relancify_sdk.egg-info/top_level.txt
14
+ relancify_sdk/resources/__init__.py
15
+ relancify_sdk/resources/agents.py
16
+ relancify_sdk/resources/api_keys.py
17
+ relancify_sdk/resources/runtime.py
18
+ relancify_sdk/resources/users.py
19
+ relancify_sdk/resources/voices.py
20
+ relancify_sdk/types/__init__.py
@@ -0,0 +1 @@
1
+ httpx<1.0,>=0.25
@@ -0,0 +1 @@
1
+ relancify_sdk
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+