latitude-sdk 1.0.3__py3-none-any.whl → 1.1.1__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/client/payloads.py +6 -0
- latitude_sdk/client/router.py +11 -0
- latitude_sdk/sdk/prompts.py +24 -1
- latitude_sdk/sdk/types.py +11 -0
- {latitude_sdk-1.0.3.dist-info → latitude_sdk-1.1.1.dist-info}/METADATA +2 -2
- {latitude_sdk-1.0.3.dist-info → latitude_sdk-1.1.1.dist-info}/RECORD +7 -7
- {latitude_sdk-1.0.3.dist-info → latitude_sdk-1.1.1.dist-info}/WHEEL +0 -0
latitude_sdk/client/payloads.py
CHANGED
@@ -23,6 +23,10 @@ class GetPromptRequestParams(PromptRequestParams, Model):
|
|
23
23
|
path: str
|
24
24
|
|
25
25
|
|
26
|
+
class GetAllPromptRequestParams(PromptRequestParams, Model):
|
27
|
+
pass
|
28
|
+
|
29
|
+
|
26
30
|
class GetOrCreatePromptRequestParams(PromptRequestParams, Model):
|
27
31
|
pass
|
28
32
|
|
@@ -90,6 +94,7 @@ class CreateEvaluationResultRequestBody(Model):
|
|
90
94
|
|
91
95
|
RequestParams = Union[
|
92
96
|
GetPromptRequestParams,
|
97
|
+
GetAllPromptRequestParams,
|
93
98
|
GetOrCreatePromptRequestParams,
|
94
99
|
RunPromptRequestParams,
|
95
100
|
ChatPromptRequestParams,
|
@@ -111,6 +116,7 @@ RequestBody = Union[
|
|
111
116
|
|
112
117
|
class RequestHandler(StrEnum):
|
113
118
|
GetPrompt = "GET_PROMPT"
|
119
|
+
GetAllPrompts = "GET_ALL_PROMPTS"
|
114
120
|
GetOrCreatePrompt = "GET_OR_CREATE_PROMPT"
|
115
121
|
RunPrompt = "RUN_PROMPT"
|
116
122
|
ChatPrompt = "CHAT_PROMPT"
|
latitude_sdk/client/router.py
CHANGED
@@ -4,6 +4,7 @@ from latitude_sdk.client.payloads import (
|
|
4
4
|
ChatPromptRequestParams,
|
5
5
|
CreateEvaluationResultRequestParams,
|
6
6
|
CreateLogRequestParams,
|
7
|
+
GetAllPromptRequestParams,
|
7
8
|
GetOrCreatePromptRequestParams,
|
8
9
|
GetPromptRequestParams,
|
9
10
|
RequestHandler,
|
@@ -36,6 +37,14 @@ class Router:
|
|
36
37
|
version_uuid=params.version_uuid,
|
37
38
|
).prompt(params.path)
|
38
39
|
|
40
|
+
if handler == RequestHandler.GetAllPrompts:
|
41
|
+
assert isinstance(params, GetAllPromptRequestParams)
|
42
|
+
|
43
|
+
return "GET", self.prompts(
|
44
|
+
project_id=params.project_id,
|
45
|
+
version_uuid=params.version_uuid,
|
46
|
+
).all_prompts
|
47
|
+
|
39
48
|
elif handler == RequestHandler.GetOrCreatePrompt:
|
40
49
|
assert isinstance(params, GetOrCreatePromptRequestParams)
|
41
50
|
|
@@ -94,6 +103,7 @@ class Router:
|
|
94
103
|
|
95
104
|
class Prompts(Model):
|
96
105
|
prompt: Callable[[str], str]
|
106
|
+
all_prompts: str
|
97
107
|
get_or_create: str
|
98
108
|
run: str
|
99
109
|
logs: str
|
@@ -102,6 +112,7 @@ class Router:
|
|
102
112
|
base_url = f"{self.commits_url(project_id, version_uuid)}/documents"
|
103
113
|
|
104
114
|
return self.Prompts(
|
115
|
+
all_prompts=f"{base_url}",
|
105
116
|
prompt=lambda path: f"{base_url}/{path}",
|
106
117
|
get_or_create=f"{base_url}/get-or-create",
|
107
118
|
run=f"{base_url}/run",
|
latitude_sdk/sdk/prompts.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import asyncio
|
2
|
-
from typing import Any, AsyncGenerator, Optional, Sequence, Union
|
2
|
+
from typing import Any, AsyncGenerator, List, Optional, Sequence, Union
|
3
3
|
|
4
4
|
from promptl_ai import Adapter, Message, MessageLike, Promptl, ToolMessage, ToolResultContent
|
5
5
|
from promptl_ai.bindings.types import _Message
|
@@ -9,6 +9,7 @@ from latitude_sdk.client import (
|
|
9
9
|
ChatPromptRequestParams,
|
10
10
|
Client,
|
11
11
|
ClientEvent,
|
12
|
+
GetAllPromptRequestParams,
|
12
13
|
GetOrCreatePromptRequestBody,
|
13
14
|
GetOrCreatePromptRequestParams,
|
14
15
|
GetPromptRequestParams,
|
@@ -33,6 +34,7 @@ from latitude_sdk.sdk.types import (
|
|
33
34
|
ToolResult,
|
34
35
|
_LatitudeEvent,
|
35
36
|
)
|
37
|
+
from latitude_sdk.util import Adapter as AdapterUtil
|
36
38
|
from latitude_sdk.util import Model
|
37
39
|
|
38
40
|
_PROVIDER_TO_ADAPTER = {
|
@@ -67,6 +69,13 @@ class GetPromptResult(Prompt, Model):
|
|
67
69
|
pass
|
68
70
|
|
69
71
|
|
72
|
+
_GetAllPromptResults = AdapterUtil[List[GetPromptResult]](List[GetPromptResult])
|
73
|
+
|
74
|
+
|
75
|
+
class GetAllPromptOptions(PromptOptions, Model):
|
76
|
+
pass
|
77
|
+
|
78
|
+
|
70
79
|
class GetOrCreatePromptOptions(PromptOptions, Model):
|
71
80
|
prompt: Optional[str] = None
|
72
81
|
|
@@ -283,6 +292,20 @@ class Prompts:
|
|
283
292
|
) as response:
|
284
293
|
return GetPromptResult.model_validate_json(response.content)
|
285
294
|
|
295
|
+
async def get_all(self, options: Optional[GetAllPromptOptions] = None) -> List[GetPromptResult]:
|
296
|
+
options = GetAllPromptOptions(**{**dict(self._options), **dict(options or {})})
|
297
|
+
self._ensure_prompt_options(options)
|
298
|
+
assert options.project_id is not None
|
299
|
+
|
300
|
+
async with self._client.request(
|
301
|
+
handler=RequestHandler.GetAllPrompts,
|
302
|
+
params=GetAllPromptRequestParams(
|
303
|
+
project_id=options.project_id,
|
304
|
+
version_uuid=options.version_uuid,
|
305
|
+
),
|
306
|
+
) as response:
|
307
|
+
return _GetAllPromptResults.validate_json(response.content)
|
308
|
+
|
286
309
|
async def get_or_create(
|
287
310
|
self, path: str, options: Optional[GetOrCreatePromptOptions] = None
|
288
311
|
) -> GetOrCreatePromptResult:
|
latitude_sdk/sdk/types.py
CHANGED
@@ -24,11 +24,22 @@ class Providers(StrEnum):
|
|
24
24
|
Custom = "custom"
|
25
25
|
|
26
26
|
|
27
|
+
class ParameterType(StrEnum):
|
28
|
+
Text = "text"
|
29
|
+
File = "file"
|
30
|
+
Image = "image"
|
31
|
+
|
32
|
+
|
33
|
+
class PromptParameter(Model):
|
34
|
+
type: ParameterType
|
35
|
+
|
36
|
+
|
27
37
|
class Prompt(Model):
|
28
38
|
uuid: str
|
29
39
|
path: str
|
30
40
|
content: str
|
31
41
|
config: dict[str, Any]
|
42
|
+
parameters: dict[str, PromptParameter]
|
32
43
|
provider: Optional[Providers] = None
|
33
44
|
|
34
45
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: latitude-sdk
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.1.1
|
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
|
@@ -12,7 +12,7 @@ Requires-Python: <3.13,>=3.9
|
|
12
12
|
Requires-Dist: httpx-sse>=0.4.0
|
13
13
|
Requires-Dist: httpx>=0.28.1
|
14
14
|
Requires-Dist: latitude-telemetry>=1.0.0
|
15
|
-
Requires-Dist: promptl-ai>=1.0.
|
15
|
+
Requires-Dist: promptl-ai>=1.0.3
|
16
16
|
Requires-Dist: pydantic>=2.10.3
|
17
17
|
Requires-Dist: typing-extensions>=4.12.2
|
18
18
|
Description-Content-Type: text/markdown
|
@@ -2,8 +2,8 @@ latitude_sdk/__init__.py,sha256=-AbNXLmzDZeGbRdDIOpNjdCbacOvLBflSJwQtLlZfgk,19
|
|
2
2
|
latitude_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
latitude_sdk/client/__init__.py,sha256=d8CnNB8UoGwcftiIeeC0twdg01qNvfpj-v7O40I7IiE,68
|
4
4
|
latitude_sdk/client/client.py,sha256=Oc4COkVFR1vFewVKZzUIvztJi_yTxeSMoyeML-ivVsY,4389
|
5
|
-
latitude_sdk/client/payloads.py,sha256=
|
6
|
-
latitude_sdk/client/router.py,sha256=
|
5
|
+
latitude_sdk/client/payloads.py,sha256=GCMX9my5lj9bzTQNbgs3jcr9M0b-axt5g9xqey2bnSs,2860
|
6
|
+
latitude_sdk/client/router.py,sha256=CiJnhXDJaqMh7H_bG4bOX-dlrELcpHVH_8l0ZRz7UZo,4414
|
7
7
|
latitude_sdk/env/__init__.py,sha256=66of5veJ-u1aNI025L65Rrj321AjrYevMqomTMYIrPQ,19
|
8
8
|
latitude_sdk/env/env.py,sha256=MnXexPOHE6aXcAszrDCbW7hzACUv4YtU1bfxpYwvHNw,455
|
9
9
|
latitude_sdk/sdk/__init__.py,sha256=C9LlIjfnrS7KOK3-ruXKmbT77nSQMm23nZ6-t8sO8ME,137
|
@@ -11,10 +11,10 @@ latitude_sdk/sdk/errors.py,sha256=9GlGdDE8LGy3dE2Ry_BipBg-tDbQx7LWXJfSnTJSSBE,17
|
|
11
11
|
latitude_sdk/sdk/evaluations.py,sha256=fDGtAWjdPG9OuKLit6u-jufVleC1EnshRplK6RN8iyg,2277
|
12
12
|
latitude_sdk/sdk/latitude.py,sha256=bfamm58iaUWgUCzi_llgQCRTNmdJ2haFOIkR6yozub4,2928
|
13
13
|
latitude_sdk/sdk/logs.py,sha256=CyHkRJvPl_p7wTSvR9bgxEI5akS0Tjc9FeQRb2C2vMg,1997
|
14
|
-
latitude_sdk/sdk/prompts.py,sha256=
|
15
|
-
latitude_sdk/sdk/types.py,sha256=
|
14
|
+
latitude_sdk/sdk/prompts.py,sha256=VaBZr58aQtREWFlpZnKD8tWRFgGwy8Q7TP0fLUElC48,16853
|
15
|
+
latitude_sdk/sdk/types.py,sha256=_VMTl2BEpdIfKLZexKGALzd6ml4ayYQf6_yly088BXo,8371
|
16
16
|
latitude_sdk/util/__init__.py,sha256=alIDGBnxWH4JvP-UW-7N99seBBi0r1GV1h8f1ERFBec,21
|
17
17
|
latitude_sdk/util/utils.py,sha256=hMOmF-u1QaDgOwXN6ME6n4TaQ70yZKLvijDUqNCMwXI,2844
|
18
|
-
latitude_sdk-1.
|
19
|
-
latitude_sdk-1.
|
20
|
-
latitude_sdk-1.
|
18
|
+
latitude_sdk-1.1.1.dist-info/METADATA,sha256=obkzDAsmTbzu4eB5fWVz6ndAvmgzxbn0MRVClWu1tFw,2368
|
19
|
+
latitude_sdk-1.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
20
|
+
latitude_sdk-1.1.1.dist-info/RECORD,,
|
File without changes
|