latitude-sdk 0.1.0b7__py3-none-any.whl → 0.1.0b8__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 +0 -4
- latitude_sdk/sdk/logs.py +8 -3
- latitude_sdk/sdk/prompts.py +6 -3
- latitude_sdk/sdk/types.py +2 -1
- latitude_sdk/util/utils.py +1 -0
- {latitude_sdk-0.1.0b7.dist-info → latitude_sdk-0.1.0b8.dist-info}/METADATA +2 -2
- {latitude_sdk-0.1.0b7.dist-info → latitude_sdk-0.1.0b8.dist-info}/RECORD +8 -8
- {latitude_sdk-0.1.0b7.dist-info → latitude_sdk-0.1.0b8.dist-info}/WHEEL +0 -0
latitude_sdk/sdk/latitude.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
from typing import Optional
|
2
2
|
|
3
|
-
from latitude_telemetry import InternalOptions as TelemetryInternalOptions
|
4
3
|
from latitude_telemetry import Telemetry, TelemetryOptions
|
5
4
|
|
6
5
|
from latitude_sdk.client import Client, ClientOptions, RouterOptions
|
@@ -79,9 +78,6 @@ class Latitude:
|
|
79
78
|
)
|
80
79
|
|
81
80
|
if self._options.telemetry:
|
82
|
-
self._options.telemetry.internal = TelemetryInternalOptions(
|
83
|
-
**{**dict(self._options.internal), **dict(self._options.telemetry.internal or {})}
|
84
|
-
)
|
85
81
|
self.telemetry = Telemetry(api_key, self._options.telemetry)
|
86
82
|
|
87
83
|
self.prompts = Prompts(self._client, self._options)
|
latitude_sdk/sdk/logs.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import Any, Dict, Optional, Sequence, Union
|
2
2
|
|
3
3
|
from latitude_sdk.client import Client, CreateLogRequestBody, CreateLogRequestParams, RequestHandler
|
4
4
|
from latitude_sdk.sdk.errors import ApiError, ApiErrorCodes
|
@@ -6,6 +6,7 @@ from latitude_sdk.sdk.types import (
|
|
6
6
|
Log,
|
7
7
|
Message,
|
8
8
|
SdkOptions,
|
9
|
+
_Message,
|
9
10
|
)
|
10
11
|
from latitude_sdk.util import Model
|
11
12
|
|
@@ -45,12 +46,16 @@ class Logs:
|
|
45
46
|
|
46
47
|
return LogOptions(project_id=project_id, version_uuid=version_uuid)
|
47
48
|
|
48
|
-
async def create(
|
49
|
+
async def create(
|
50
|
+
self, path: str, messages: Sequence[Union[Message, Dict[str, Any]]], options: CreateLogOptions
|
51
|
+
) -> CreateLogResult:
|
49
52
|
log_options = self._ensure_options(options)
|
50
53
|
options = CreateLogOptions(**{**dict(options), **dict(log_options)})
|
51
54
|
|
52
55
|
assert options.project_id is not None
|
53
56
|
|
57
|
+
messages = [_Message.validate_python(message) for message in messages]
|
58
|
+
|
54
59
|
async with self._client.request(
|
55
60
|
handler=RequestHandler.CreateLog,
|
56
61
|
params=CreateLogRequestParams(
|
@@ -59,7 +64,7 @@ class Logs:
|
|
59
64
|
),
|
60
65
|
body=CreateLogRequestBody(
|
61
66
|
path=path,
|
62
|
-
messages=
|
67
|
+
messages=messages,
|
63
68
|
response=options.response,
|
64
69
|
),
|
65
70
|
) as response:
|
latitude_sdk/sdk/prompts.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Any, AsyncGenerator, Dict,
|
1
|
+
from typing import Any, AsyncGenerator, Dict, List, Optional, Sequence, Union
|
2
2
|
|
3
3
|
from latitude_sdk.client import (
|
4
4
|
ChatPromptRequestBody,
|
@@ -25,6 +25,7 @@ from latitude_sdk.sdk.types import (
|
|
25
25
|
SdkOptions,
|
26
26
|
StreamCallbacks,
|
27
27
|
StreamEvents,
|
28
|
+
_Message,
|
28
29
|
)
|
29
30
|
from latitude_sdk.util import Model
|
30
31
|
|
@@ -248,16 +249,18 @@ class Prompts:
|
|
248
249
|
return None
|
249
250
|
|
250
251
|
async def chat(
|
251
|
-
self, uuid: str, messages:
|
252
|
+
self, uuid: str, messages: Sequence[Union[Message, Dict[str, Any]]], options: ChatPromptOptions
|
252
253
|
) -> Optional[ChatPromptResult]:
|
253
254
|
try:
|
255
|
+
messages = [_Message.validate_python(message) for message in messages]
|
256
|
+
|
254
257
|
async with self._client.request(
|
255
258
|
handler=RequestHandler.ChatPrompt,
|
256
259
|
params=ChatPromptRequestParams(
|
257
260
|
conversation_uuid=uuid,
|
258
261
|
),
|
259
262
|
body=ChatPromptRequestBody(
|
260
|
-
messages=
|
263
|
+
messages=messages,
|
261
264
|
stream=options.stream,
|
262
265
|
),
|
263
266
|
) as response:
|
latitude_sdk/sdk/types.py
CHANGED
@@ -2,7 +2,7 @@ from datetime import datetime
|
|
2
2
|
from typing import Any, Dict, List, Literal, Optional, Protocol, Union, runtime_checkable
|
3
3
|
|
4
4
|
from latitude_sdk.sdk.errors import ApiError
|
5
|
-
from latitude_sdk.util import Field, Model, StrEnum
|
5
|
+
from latitude_sdk.util import Adapter, Field, Model, StrEnum
|
6
6
|
|
7
7
|
|
8
8
|
class DbErrorRef(Model):
|
@@ -106,6 +106,7 @@ class ToolMessage(Model):
|
|
106
106
|
|
107
107
|
|
108
108
|
Message = Union[SystemMessage, UserMessage, AssistantMessage, ToolMessage]
|
109
|
+
_Message = Adapter(Message)
|
109
110
|
|
110
111
|
|
111
112
|
class ModelUsage(Model):
|
latitude_sdk/util/utils.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: latitude-sdk
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.0b8
|
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
|
@@ -11,7 +11,7 @@ License-Expression: LGPL-3.0
|
|
11
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.
|
14
|
+
Requires-Dist: latitude-telemetry>=0.1.0b6
|
15
15
|
Requires-Dist: pydantic>=2.10.3
|
16
16
|
Requires-Dist: typing-extensions>=4.12.2
|
17
17
|
Description-Content-Type: text/markdown
|
@@ -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=
|
13
|
-
latitude_sdk/sdk/logs.py,sha256
|
14
|
-
latitude_sdk/sdk/prompts.py,sha256=
|
15
|
-
latitude_sdk/sdk/types.py,sha256=
|
12
|
+
latitude_sdk/sdk/latitude.py,sha256=GdkwdxtTSmfldLo17pJme8MWpjuHQy7JFDRYLg0l4cg,2724
|
13
|
+
latitude_sdk/sdk/logs.py,sha256=-_jYlxKW8Hgq1nZ7QtNbaEg1eWuMUbeeA32jtFsDvNk,2199
|
14
|
+
latitude_sdk/sdk/prompts.py,sha256=vh2WYSEQbArnqadfJ9mBwtpmEBzEJObUkNB6O87S9QQ,10256
|
15
|
+
latitude_sdk/sdk/types.py,sha256=RPJA3cM8tJ6udwS4gi0LLlJPPrS10mSb6q4OaKmNsU4,7903
|
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=06phYKGKnlO0WcU3coMXpqyrHOVDvE0mFzvqTRJGbD8,2916
|
18
|
+
latitude_sdk-0.1.0b8.dist-info/METADATA,sha256=Lsolipk18n_fM7hvfIXaTDuJZ7rOQLXZIr_fWmq3eKw,2031
|
19
|
+
latitude_sdk-0.1.0b8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
20
|
+
latitude_sdk-0.1.0b8.dist-info/RECORD,,
|
File without changes
|