latitude-sdk 0.1.0b5__py3-none-any.whl → 0.1.0b7__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.
- latitude_sdk/sdk/latitude.py +29 -16
- latitude_sdk/util/utils.py +10 -2
- {latitude_sdk-0.1.0b5.dist-info → latitude_sdk-0.1.0b7.dist-info}/METADATA +4 -3
- {latitude_sdk-0.1.0b5.dist-info → latitude_sdk-0.1.0b7.dist-info}/RECORD +5 -5
- {latitude_sdk-0.1.0b5.dist-info → latitude_sdk-0.1.0b7.dist-info}/WHEEL +0 -0
latitude_sdk/sdk/latitude.py
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
from typing import Optional
|
2
2
|
|
3
|
+
from latitude_telemetry import InternalOptions as TelemetryInternalOptions
|
4
|
+
from latitude_telemetry import Telemetry, TelemetryOptions
|
5
|
+
|
3
6
|
from latitude_sdk.client import Client, ClientOptions, RouterOptions
|
4
7
|
from latitude_sdk.env import env
|
5
8
|
from latitude_sdk.sdk.evaluations import Evaluations
|
@@ -18,6 +21,7 @@ class InternalOptions(Model):
|
|
18
21
|
|
19
22
|
|
20
23
|
class LatitudeOptions(SdkOptions, Model):
|
24
|
+
telemetry: Optional[TelemetryOptions] = None
|
21
25
|
internal: Optional[InternalOptions] = None
|
22
26
|
|
23
27
|
|
@@ -35,42 +39,51 @@ DEFAULT_INTERNAL_OPTIONS = InternalOptions(
|
|
35
39
|
)
|
36
40
|
|
37
41
|
|
38
|
-
DEFAULT_LATITUDE_OPTIONS = LatitudeOptions(
|
42
|
+
DEFAULT_LATITUDE_OPTIONS = LatitudeOptions(
|
43
|
+
telemetry=None, # Note: Telemetry is opt-in
|
44
|
+
internal=DEFAULT_INTERNAL_OPTIONS,
|
45
|
+
)
|
39
46
|
|
40
47
|
|
41
48
|
class Latitude:
|
42
49
|
_options: LatitudeOptions
|
43
50
|
_client: Client
|
44
51
|
|
52
|
+
telemetry: Optional[Telemetry]
|
53
|
+
|
45
54
|
prompts: Prompts
|
46
55
|
logs: Logs
|
47
56
|
evaluations: Evaluations
|
48
57
|
|
49
58
|
def __init__(self, api_key: str, options: LatitudeOptions):
|
50
|
-
options.internal = options.internal or
|
51
|
-
options.internal = InternalOptions(**{**dict(DEFAULT_INTERNAL_OPTIONS), **dict(options.internal)})
|
59
|
+
options.internal = InternalOptions(**{**dict(DEFAULT_INTERNAL_OPTIONS), **dict(options.internal or {})})
|
52
60
|
options = LatitudeOptions(**{**dict(DEFAULT_LATITUDE_OPTIONS), **dict(options)})
|
61
|
+
self._options = options
|
53
62
|
|
54
|
-
assert
|
55
|
-
assert
|
56
|
-
assert
|
57
|
-
assert
|
58
|
-
assert
|
59
|
-
assert
|
63
|
+
assert self._options.internal is not None
|
64
|
+
assert self._options.internal.gateway is not None
|
65
|
+
assert self._options.internal.source is not None
|
66
|
+
assert self._options.internal.retries is not None
|
67
|
+
assert self._options.internal.delay is not None
|
68
|
+
assert self._options.internal.timeout is not None
|
60
69
|
|
61
|
-
self._options = options
|
62
70
|
self._client = Client(
|
63
71
|
ClientOptions(
|
64
72
|
api_key=api_key,
|
65
|
-
retries=
|
66
|
-
delay=
|
67
|
-
timeout=
|
68
|
-
source=
|
69
|
-
router=RouterOptions(gateway=
|
73
|
+
retries=self._options.internal.retries,
|
74
|
+
delay=self._options.internal.delay,
|
75
|
+
timeout=self._options.internal.timeout,
|
76
|
+
source=self._options.internal.source,
|
77
|
+
router=RouterOptions(gateway=self._options.internal.gateway),
|
70
78
|
)
|
71
79
|
)
|
72
80
|
|
81
|
+
if self._options.telemetry:
|
82
|
+
self._options.telemetry.internal = TelemetryInternalOptions(
|
83
|
+
**{**dict(self._options.internal), **dict(self._options.telemetry.internal or {})}
|
84
|
+
)
|
85
|
+
self.telemetry = Telemetry(api_key, self._options.telemetry)
|
86
|
+
|
73
87
|
self.prompts = Prompts(self._client, self._options)
|
74
88
|
self.logs = Logs(self._client, self._options)
|
75
89
|
self.evaluations = Evaluations(self._client, self._options)
|
76
|
-
# TODO: Telemetry - needs Telemetry SDK in Python
|
latitude_sdk/util/utils.py
CHANGED
@@ -3,7 +3,7 @@ from enum import Enum
|
|
3
3
|
from typing import Any, Callable, List, TypeVar
|
4
4
|
|
5
5
|
import pydantic
|
6
|
-
from typing_extensions import ParamSpec
|
6
|
+
from typing_extensions import ParamSpec, Self
|
7
7
|
|
8
8
|
T = TypeVar("T", str, bool, int, List[str])
|
9
9
|
|
@@ -49,7 +49,15 @@ class StrEnum(str, Enum):
|
|
49
49
|
return str(self.value)
|
50
50
|
|
51
51
|
@classmethod
|
52
|
-
def
|
52
|
+
def entries(cls) -> List[Self]:
|
53
|
+
return list(cls)
|
54
|
+
|
55
|
+
@classmethod
|
56
|
+
def names(cls) -> List[str]:
|
57
|
+
return [v.name for v in cls]
|
58
|
+
|
59
|
+
@classmethod
|
60
|
+
def values(cls) -> List[str]:
|
53
61
|
return [v.value for v in cls]
|
54
62
|
|
55
63
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: latitude-sdk
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.0b7
|
4
4
|
Summary: Latitude SDK for Python
|
5
5
|
Project-URL: repository, https://github.com/latitude-dev/latitude-llm/tree/main/packages/sdks/python
|
6
6
|
Project-URL: homepage, https://github.com/latitude-dev/latitude-llm/tree/main/packages/sdks/python#readme
|
@@ -8,9 +8,10 @@ Project-URL: documentation, https://github.com/latitude-dev/latitude-llm/tree/ma
|
|
8
8
|
Author-email: Latitude Data SL <hello@latitude.so>
|
9
9
|
Maintainer-email: Latitude Data SL <hello@latitude.so>
|
10
10
|
License-Expression: LGPL-3.0
|
11
|
-
Requires-Python:
|
11
|
+
Requires-Python: <3.13,>=3.9
|
12
12
|
Requires-Dist: httpx-sse>=0.4.0
|
13
13
|
Requires-Dist: httpx>=0.28.1
|
14
|
+
Requires-Dist: latitude-telemetry>=0.1.0b5
|
14
15
|
Requires-Dist: pydantic>=2.10.3
|
15
16
|
Requires-Dist: typing-extensions>=4.12.2
|
16
17
|
Description-Content-Type: text/markdown
|
@@ -21,7 +22,7 @@ Description-Content-Type: text/markdown
|
|
21
22
|
pip install latitude-sdk
|
22
23
|
```
|
23
24
|
|
24
|
-
Requires Python `3.
|
25
|
+
Requires Python `3.9` or higher.
|
25
26
|
|
26
27
|
Go to the [documentation](https://docs.latitude.so/guides/sdk/python) to learn more.
|
27
28
|
|
@@ -9,12 +9,12 @@ latitude_sdk/env/env.py,sha256=MnXexPOHE6aXcAszrDCbW7hzACUv4YtU1bfxpYwvHNw,455
|
|
9
9
|
latitude_sdk/sdk/__init__.py,sha256=C9LlIjfnrS7KOK3-ruXKmbT77nSQMm23nZ6-t8sO8ME,137
|
10
10
|
latitude_sdk/sdk/errors.py,sha256=9GlGdDE8LGy3dE2Ry_BipBg-tDbQx7LWXJfSnTJSSBE,1747
|
11
11
|
latitude_sdk/sdk/evaluations.py,sha256=ASWfNfH124qeahzhAn-gb2Ep4QIew5uDveY5NbNsNfk,2086
|
12
|
-
latitude_sdk/sdk/latitude.py,sha256=
|
12
|
+
latitude_sdk/sdk/latitude.py,sha256=tVXxQeq9WAMv3ndsCE8V2cbzmGy3roUCMldhJiXOXoE,2985
|
13
13
|
latitude_sdk/sdk/logs.py,sha256=UBlQzNq8AtWVkeVztqUWTs78jGkfA8a2r6wOhasUpxs,2056
|
14
14
|
latitude_sdk/sdk/prompts.py,sha256=VaqI3qbVpcSbiT5xtd63eEwbIGTdMusDSoZeQZO8z4g,10134
|
15
15
|
latitude_sdk/sdk/types.py,sha256=1sBtKNppipuayPj3j8qoUzMekIO0DxSBBXYNCEVsZjU,7866
|
16
16
|
latitude_sdk/util/__init__.py,sha256=alIDGBnxWH4JvP-UW-7N99seBBi0r1GV1h8f1ERFBec,21
|
17
|
-
latitude_sdk/util/utils.py,sha256=
|
18
|
-
latitude_sdk-0.1.
|
19
|
-
latitude_sdk-0.1.
|
20
|
-
latitude_sdk-0.1.
|
17
|
+
latitude_sdk/util/utils.py,sha256=MzEEIhM7yQKJ0btcf1U9rcRz7geHkYXEjGCDnLpNCSw,2885
|
18
|
+
latitude_sdk-0.1.0b7.dist-info/METADATA,sha256=mKO1GdbeXDSYwRmKXM58mLJUl_2SyRFcqqQ3qarEG4c,2031
|
19
|
+
latitude_sdk-0.1.0b7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
20
|
+
latitude_sdk-0.1.0b7.dist-info/RECORD,,
|
File without changes
|