latitude-sdk 0.1.0b7__tar.gz → 0.1.0b8__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.
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/PKG-INFO +2 -2
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/pyproject.toml +2 -2
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/src/latitude_sdk/sdk/latitude.py +0 -4
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/src/latitude_sdk/sdk/logs.py +8 -3
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/src/latitude_sdk/sdk/prompts.py +6 -3
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/src/latitude_sdk/sdk/types.py +2 -1
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/src/latitude_sdk/util/utils.py +1 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/tests/utils/utils.py +20 -11
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/uv.lock +26 -5
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/.gitignore +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/.python-version +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/README.md +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/scripts/format.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/scripts/lint.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/scripts/test.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/src/latitude_sdk/__init__.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/src/latitude_sdk/client/__init__.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/src/latitude_sdk/client/client.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/src/latitude_sdk/client/payloads.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/src/latitude_sdk/client/router.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/src/latitude_sdk/env/__init__.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/src/latitude_sdk/env/env.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/src/latitude_sdk/py.typed +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/src/latitude_sdk/sdk/__init__.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/src/latitude_sdk/sdk/errors.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/src/latitude_sdk/sdk/evaluations.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/src/latitude_sdk/util/__init__.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/tests/__init__.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/tests/evaluations/__init__.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/tests/evaluations/create_result_test.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/tests/evaluations/trigger_test.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/tests/logs/__init__.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/tests/logs/create_test.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/tests/prompts/__init__.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/tests/prompts/chat_test.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/tests/prompts/get_or_create_test.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/tests/prompts/get_test.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/tests/prompts/run_test.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/tests/utils/__init__.py +0 -0
- {latitude_sdk-0.1.0b7 → latitude_sdk-0.1.0b8}/tests/utils/fixtures.py +0 -0
@@ -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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "latitude-sdk"
|
3
|
-
version = "0.1.0-beta.
|
3
|
+
version = "0.1.0-beta.8"
|
4
4
|
description = "Latitude SDK for Python"
|
5
5
|
authors = [{ name = "Latitude Data SL", email = "hello@latitude.so" }]
|
6
6
|
maintainers = [{ name = "Latitude Data SL", email = "hello@latitude.so" }]
|
@@ -15,7 +15,7 @@ dependencies = [
|
|
15
15
|
"httpx-sse>=0.4.0",
|
16
16
|
"pydantic>=2.10.3",
|
17
17
|
"typing-extensions>=4.12.2",
|
18
|
-
"latitude-telemetry>=0.1.
|
18
|
+
"latitude-telemetry>=0.1.0b6",
|
19
19
|
]
|
20
20
|
|
21
21
|
[dependency-groups]
|
@@ -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)
|
@@ -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:
|
@@ -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:
|
@@ -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):
|
@@ -4,11 +4,12 @@ from unittest import IsolatedAsyncioTestCase
|
|
4
4
|
|
5
5
|
import httpx
|
6
6
|
import respx
|
7
|
+
from latitude_telemetry import InternalOptions as TelemetryInternalOptions
|
8
|
+
from latitude_telemetry import TelemetryOptions
|
7
9
|
|
8
10
|
from latitude_sdk import (
|
9
11
|
AssistantMessage,
|
10
12
|
FileContent,
|
11
|
-
GatewayOptions,
|
12
13
|
ImageContent,
|
13
14
|
InternalOptions,
|
14
15
|
Latitude,
|
@@ -30,16 +31,23 @@ class TestCase(IsolatedAsyncioTestCase):
|
|
30
31
|
def setUp(self):
|
31
32
|
self.maxDiff = None
|
32
33
|
|
33
|
-
|
34
|
-
gateway
|
35
|
-
host
|
36
|
-
port
|
37
|
-
ssl
|
38
|
-
api_version
|
39
|
-
|
40
|
-
retries
|
41
|
-
delay
|
42
|
-
timeout
|
34
|
+
internal_options = {
|
35
|
+
"gateway": {
|
36
|
+
"host": "fake-host.com",
|
37
|
+
"port": 443,
|
38
|
+
"ssl": True,
|
39
|
+
"api_version": "v2",
|
40
|
+
},
|
41
|
+
"retries": 3,
|
42
|
+
"delay": 0,
|
43
|
+
"timeout": 0.5,
|
44
|
+
}
|
45
|
+
|
46
|
+
self.internal_options = InternalOptions.model_validate(internal_options)
|
47
|
+
self.telemetry_options = TelemetryOptions(
|
48
|
+
instrumentors=[],
|
49
|
+
disable_batch=True,
|
50
|
+
internal=TelemetryInternalOptions.model_validate(internal_options),
|
43
51
|
)
|
44
52
|
self.api_key = "fake-api-key"
|
45
53
|
self.project_id = 31
|
@@ -60,6 +68,7 @@ class TestCase(IsolatedAsyncioTestCase):
|
|
60
68
|
LatitudeOptions(
|
61
69
|
project_id=self.project_id,
|
62
70
|
version_uuid=self.version_uuid,
|
71
|
+
telemetry=self.telemetry_options,
|
63
72
|
internal=self.internal_options,
|
64
73
|
),
|
65
74
|
)
|
@@ -304,7 +304,7 @@ wheels = [
|
|
304
304
|
|
305
305
|
[[package]]
|
306
306
|
name = "latitude-sdk"
|
307
|
-
version = "0.1.
|
307
|
+
version = "0.1.0b8"
|
308
308
|
source = { editable = "." }
|
309
309
|
dependencies = [
|
310
310
|
{ name = "httpx" },
|
@@ -329,7 +329,7 @@ dev = [
|
|
329
329
|
requires-dist = [
|
330
330
|
{ name = "httpx", specifier = ">=0.28.1" },
|
331
331
|
{ name = "httpx-sse", specifier = ">=0.4.0" },
|
332
|
-
{ name = "latitude-telemetry", specifier = ">=0.1.
|
332
|
+
{ name = "latitude-telemetry", specifier = ">=0.1.0b6" },
|
333
333
|
{ name = "pydantic", specifier = ">=2.10.3" },
|
334
334
|
{ name = "typing-extensions", specifier = ">=4.12.2" },
|
335
335
|
]
|
@@ -347,11 +347,13 @@ dev = [
|
|
347
347
|
|
348
348
|
[[package]]
|
349
349
|
name = "latitude-telemetry"
|
350
|
-
version = "0.1.
|
350
|
+
version = "0.1.0b6"
|
351
351
|
source = { registry = "https://pypi.org/simple" }
|
352
352
|
dependencies = [
|
353
353
|
{ name = "httpx" },
|
354
|
+
{ name = "openinference-instrumentation-dspy" },
|
354
355
|
{ name = "openinference-instrumentation-litellm" },
|
356
|
+
{ name = "openinference-semantic-conventions" },
|
355
357
|
{ name = "opentelemetry-api" },
|
356
358
|
{ name = "opentelemetry-instrumentation-alephalpha" },
|
357
359
|
{ name = "opentelemetry-instrumentation-anthropic" },
|
@@ -373,12 +375,13 @@ dependencies = [
|
|
373
375
|
{ name = "opentelemetry-instrumentation-vertexai" },
|
374
376
|
{ name = "opentelemetry-instrumentation-watsonx" },
|
375
377
|
{ name = "opentelemetry-sdk" },
|
378
|
+
{ name = "opentelemetry-semantic-conventions-ai" },
|
376
379
|
{ name = "pydantic" },
|
377
380
|
{ name = "typing-extensions" },
|
378
381
|
]
|
379
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
382
|
+
sdist = { url = "https://files.pythonhosted.org/packages/87/00/8347857b4d2bb8c66a1a9252c79174ca761b34aa4bfc92dc887dcfea2572/latitude_telemetry-0.1.0b6.tar.gz", hash = "sha256:38f3c7a877d7bdab7ed0e6d71d5f1d2ea23fe6cd7d1231b058ed3b00110f5f99", size = 125748 }
|
380
383
|
wheels = [
|
381
|
-
{ url = "https://files.pythonhosted.org/packages/
|
384
|
+
{ url = "https://files.pythonhosted.org/packages/e2/f2/888f0ee097a4e10c5b8804954984c2ade96ff300a3707752fa601ee58c47/latitude_telemetry-0.1.0b6-py3-none-any.whl", hash = "sha256:abeecc9cd499dfbcd0cfa4f3f55a5556fcc0b01653b35c431a7c74043ecf2fc1", size = 10790 },
|
382
385
|
]
|
383
386
|
|
384
387
|
[[package]]
|
@@ -404,6 +407,24 @@ wheels = [
|
|
404
407
|
{ url = "https://files.pythonhosted.org/packages/98/9e/78eeaa7917fece691c0ee48a9c514382f9cb3af2970d8254ce2a194a5b78/openinference_instrumentation-0.1.20-py3-none-any.whl", hash = "sha256:6e680e0ddb6edd829f797bc9ca82ba4c2f359d5bc64492b9e931fdf2223a1b08", size = 14646 },
|
405
408
|
]
|
406
409
|
|
410
|
+
[[package]]
|
411
|
+
name = "openinference-instrumentation-dspy"
|
412
|
+
version = "0.1.14"
|
413
|
+
source = { registry = "https://pypi.org/simple" }
|
414
|
+
dependencies = [
|
415
|
+
{ name = "openinference-instrumentation" },
|
416
|
+
{ name = "openinference-semantic-conventions" },
|
417
|
+
{ name = "opentelemetry-api" },
|
418
|
+
{ name = "opentelemetry-instrumentation" },
|
419
|
+
{ name = "opentelemetry-semantic-conventions" },
|
420
|
+
{ name = "typing-extensions" },
|
421
|
+
{ name = "wrapt" },
|
422
|
+
]
|
423
|
+
sdist = { url = "https://files.pythonhosted.org/packages/a7/a9/4f210b49473f5e64fd8466d4e1a0999f8bc152c59e6a27c43af9b316ef51/openinference_instrumentation_dspy-0.1.14.tar.gz", hash = "sha256:d0f4c7a14f85bf79dfcca06923d275b484be7fad1944ff683fab5280a9889378", size = 19254 }
|
424
|
+
wheels = [
|
425
|
+
{ url = "https://files.pythonhosted.org/packages/86/06/af72341040dec13d381a51bcdcd8105fd9c491aabab5bb7ce09ca26e7042/openinference_instrumentation_dspy-0.1.14-py3-none-any.whl", hash = "sha256:c67ae94b7b241c62e589b6db25f485683b6b798c10b0fd232adaae7302dacf74", size = 13113 },
|
426
|
+
]
|
427
|
+
|
407
428
|
[[package]]
|
408
429
|
name = "openinference-instrumentation-litellm"
|
409
430
|
version = "0.1.6"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|