latitude-sdk 2.0.2__tar.gz → 2.1.1__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-2.0.2 → latitude_sdk-2.1.1}/PKG-INFO +2 -2
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/pyproject.toml +2 -2
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/src/latitude_sdk/sdk/prompts.py +33 -11
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/src/latitude_sdk/sdk/types.py +15 -10
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/tests/utils/fixtures.py +101 -4
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/uv.lock +5 -6
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/.gitignore +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/.python-version +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/README.md +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/scripts/format.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/scripts/lint.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/scripts/test.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/src/latitude_sdk/__init__.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/src/latitude_sdk/client/__init__.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/src/latitude_sdk/client/client.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/src/latitude_sdk/client/payloads.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/src/latitude_sdk/client/router.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/src/latitude_sdk/env/__init__.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/src/latitude_sdk/env/env.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/src/latitude_sdk/py.typed +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/src/latitude_sdk/sdk/__init__.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/src/latitude_sdk/sdk/errors.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/src/latitude_sdk/sdk/evaluations.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/src/latitude_sdk/sdk/latitude.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/src/latitude_sdk/sdk/logs.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/src/latitude_sdk/util/__init__.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/src/latitude_sdk/util/utils.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/tests/__init__.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/tests/evaluations/__init__.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/tests/evaluations/create_result_test.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/tests/evaluations/trigger_test.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/tests/logs/__init__.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/tests/logs/create_test.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/tests/prompts/__init__.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/tests/prompts/chat_test.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/tests/prompts/get_all_test.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/tests/prompts/get_or_create_test.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/tests/prompts/get_test.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/tests/prompts/render_chain_test.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/tests/prompts/render_test.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/tests/prompts/run_test.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/tests/utils/__init__.py +0 -0
- {latitude_sdk-2.0.2 → latitude_sdk-2.1.1}/tests/utils/utils.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: latitude-sdk
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.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
|
@@ -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: promptl-ai>=1.0.
|
14
|
+
Requires-Dist: promptl-ai>=1.0.6
|
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 = "2.
|
3
|
+
version = "2.1.1"
|
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
|
-
"promptl-ai>=1.0.
|
18
|
+
"promptl-ai>=1.0.6",
|
19
19
|
]
|
20
20
|
|
21
21
|
[dependency-groups]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import asyncio
|
2
|
-
from typing import Any, AsyncGenerator, List, Optional, Sequence, Union
|
2
|
+
from typing import Any, AsyncGenerator, List, Optional, Sequence, Tuple, Union
|
3
3
|
|
4
4
|
from promptl_ai import Adapter, Message, MessageLike, Promptl, ToolMessage, ToolResultContent
|
5
5
|
from promptl_ai.bindings.types import _Message
|
@@ -19,6 +19,7 @@ from latitude_sdk.client import (
|
|
19
19
|
)
|
20
20
|
from latitude_sdk.sdk.errors import ApiError, ApiErrorCodes
|
21
21
|
from latitude_sdk.sdk.types import (
|
22
|
+
AGENT_END_TOOL_NAME,
|
22
23
|
ChainEvents,
|
23
24
|
FinishedResult,
|
24
25
|
OnStep,
|
@@ -29,7 +30,6 @@ from latitude_sdk.sdk.types import (
|
|
29
30
|
SdkOptions,
|
30
31
|
StreamCallbacks,
|
31
32
|
StreamEvents,
|
32
|
-
StreamTypes,
|
33
33
|
ToolCall,
|
34
34
|
ToolResult,
|
35
35
|
_LatitudeEvent,
|
@@ -110,7 +110,7 @@ class RenderPromptOptions(Model):
|
|
110
110
|
|
111
111
|
|
112
112
|
class RenderPromptResult(Model):
|
113
|
-
messages:
|
113
|
+
messages: List[MessageLike]
|
114
114
|
config: dict[str, Any]
|
115
115
|
|
116
116
|
|
@@ -142,13 +142,28 @@ class Prompts:
|
|
142
142
|
response="Project ID is required",
|
143
143
|
)
|
144
144
|
|
145
|
+
async def _extract_agent_tool_requests(
|
146
|
+
self, tool_requests: List[ToolCall]
|
147
|
+
) -> Tuple[List[ToolCall], List[ToolCall]]:
|
148
|
+
agent: List[ToolCall] = []
|
149
|
+
other: List[ToolCall] = []
|
150
|
+
|
151
|
+
for tool in tool_requests:
|
152
|
+
if tool.name == AGENT_END_TOOL_NAME:
|
153
|
+
agent.append(tool)
|
154
|
+
else:
|
155
|
+
other.append(tool)
|
156
|
+
|
157
|
+
return agent, other
|
158
|
+
|
145
159
|
async def _handle_stream(
|
146
160
|
self, stream: AsyncGenerator[ClientEvent, Any], on_event: Optional[StreamCallbacks.OnEvent]
|
147
161
|
) -> FinishedResult:
|
148
162
|
uuid = None
|
149
|
-
conversation:
|
163
|
+
conversation: List[Message] = []
|
150
164
|
response = None
|
151
|
-
|
165
|
+
agent_response = None
|
166
|
+
tool_requests: List[ToolCall] = []
|
152
167
|
|
153
168
|
async for stream_event in stream:
|
154
169
|
event = None
|
@@ -195,7 +210,17 @@ class Prompts:
|
|
195
210
|
response="Stream ended without a chain-complete event. Missing uuid or response.",
|
196
211
|
)
|
197
212
|
|
198
|
-
|
213
|
+
agent_requests, tool_requests = await self._extract_agent_tool_requests(tool_requests)
|
214
|
+
if len(agent_requests) > 0:
|
215
|
+
agent_response = agent_requests[0].arguments
|
216
|
+
|
217
|
+
return FinishedResult(
|
218
|
+
uuid=uuid,
|
219
|
+
conversation=conversation,
|
220
|
+
response=response,
|
221
|
+
agent_response=agent_response,
|
222
|
+
tool_requests=tool_requests,
|
223
|
+
)
|
199
224
|
|
200
225
|
@staticmethod
|
201
226
|
def _pause_tool_execution() -> Any:
|
@@ -220,9 +245,6 @@ class Prompts:
|
|
220
245
|
async def _handle_tool_calls(
|
221
246
|
self, result: FinishedResult, options: Union[RunPromptOptions, ChatPromptOptions]
|
222
247
|
) -> Optional[FinishedResult]:
|
223
|
-
# Seems Python cannot infer the type
|
224
|
-
assert result.response.type == StreamTypes.Text and result.tool_requests is not None
|
225
|
-
|
226
248
|
if not options.tools:
|
227
249
|
raise ApiError(
|
228
250
|
status=400,
|
@@ -350,7 +372,7 @@ class Prompts:
|
|
350
372
|
else:
|
351
373
|
result = RunPromptResult.model_validate_json(response.content)
|
352
374
|
|
353
|
-
if options.tools and result.
|
375
|
+
if options.tools and result.tool_requests:
|
354
376
|
try:
|
355
377
|
# NOTE: The last sdk.chat called will already call on_finished
|
356
378
|
final_result = await self._handle_tool_calls(result, options)
|
@@ -402,7 +424,7 @@ class Prompts:
|
|
402
424
|
else:
|
403
425
|
result = ChatPromptResult.model_validate_json(response.content)
|
404
426
|
|
405
|
-
if options.tools and result.
|
427
|
+
if options.tools and result.tool_requests:
|
406
428
|
try:
|
407
429
|
# NOTE: The last sdk.chat called will already call on_finished
|
408
430
|
final_result = await self._handle_tool_calls(result, options)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from datetime import datetime
|
2
|
-
from typing import Any, Callable, Literal, Optional, Protocol, Sequence, Union, runtime_checkable
|
2
|
+
from typing import Any, Callable, List, Literal, Optional, Protocol, Sequence, Union, runtime_checkable
|
3
3
|
|
4
4
|
from promptl_ai import Message, MessageLike
|
5
5
|
|
@@ -59,6 +59,10 @@ class FinishReason(StrEnum):
|
|
59
59
|
Unknown = "unknown"
|
60
60
|
|
61
61
|
|
62
|
+
AGENT_START_TOOL_NAME = "start_autonomous_chain"
|
63
|
+
AGENT_END_TOOL_NAME = "end_autonomous_chain"
|
64
|
+
|
65
|
+
|
62
66
|
class ToolCall(Model):
|
63
67
|
id: str
|
64
68
|
name: str
|
@@ -80,7 +84,7 @@ class StreamTypes(StrEnum):
|
|
80
84
|
class ChainTextResponse(Model):
|
81
85
|
type: Literal[StreamTypes.Text] = Field(default=StreamTypes.Text, alias=str("streamType"))
|
82
86
|
text: str
|
83
|
-
tool_calls:
|
87
|
+
tool_calls: List[ToolCall] = Field(alias=str("toolCalls"))
|
84
88
|
usage: ModelUsage
|
85
89
|
|
86
90
|
|
@@ -122,7 +126,7 @@ class ChainEvents(StrEnum):
|
|
122
126
|
|
123
127
|
class GenericChainEvent(Model):
|
124
128
|
event: Literal[StreamEvents.Latitude] = StreamEvents.Latitude
|
125
|
-
messages:
|
129
|
+
messages: List[Message]
|
126
130
|
uuid: str
|
127
131
|
|
128
132
|
|
@@ -149,7 +153,7 @@ class ChainEventProviderCompleted(GenericChainEvent):
|
|
149
153
|
|
150
154
|
class ChainEventToolsStarted(GenericChainEvent):
|
151
155
|
type: Literal[ChainEvents.ToolsStarted] = ChainEvents.ToolsStarted
|
152
|
-
tools:
|
156
|
+
tools: List[ToolCall]
|
153
157
|
|
154
158
|
|
155
159
|
class ChainEventToolCompleted(GenericChainEvent):
|
@@ -173,7 +177,7 @@ class ChainEventChainError(GenericChainEvent):
|
|
173
177
|
|
174
178
|
class ChainEventToolsRequested(GenericChainEvent):
|
175
179
|
type: Literal[ChainEvents.ToolsRequested] = ChainEvents.ToolsRequested
|
176
|
-
tools:
|
180
|
+
tools: List[ToolCall]
|
177
181
|
|
178
182
|
|
179
183
|
ChainEvent = Union[
|
@@ -195,9 +199,10 @@ _LatitudeEvent = Adapter[LatitudeEvent](LatitudeEvent)
|
|
195
199
|
|
196
200
|
class FinishedResult(Model):
|
197
201
|
uuid: str
|
198
|
-
conversation:
|
202
|
+
conversation: List[Message]
|
199
203
|
response: ChainResponse
|
200
|
-
|
204
|
+
agent_response: Optional[dict[str, Any]] = Field(default=None, alias=str("agentResponse"))
|
205
|
+
tool_requests: List[ToolCall] = Field(alias=str("toolRequests"))
|
201
206
|
|
202
207
|
|
203
208
|
StreamEvent = Union[ProviderEvent, LatitudeEvent]
|
@@ -271,9 +276,9 @@ class OnToolCallDetails(Model):
|
|
271
276
|
id: str
|
272
277
|
name: str
|
273
278
|
conversation_uuid: str
|
274
|
-
messages:
|
279
|
+
messages: List[Message]
|
275
280
|
pause_execution: Callable[[], ToolResult]
|
276
|
-
requested_tool_calls:
|
281
|
+
requested_tool_calls: List[ToolCall]
|
277
282
|
|
278
283
|
|
279
284
|
@runtime_checkable
|
@@ -284,7 +289,7 @@ class OnToolCall(Protocol):
|
|
284
289
|
@runtime_checkable
|
285
290
|
class OnStep(Protocol):
|
286
291
|
async def __call__(
|
287
|
-
self, messages:
|
292
|
+
self, messages: List[MessageLike], config: dict[str, Any]
|
288
293
|
) -> Union[str, MessageLike, Sequence[MessageLike]]: ...
|
289
294
|
|
290
295
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import json
|
2
2
|
from datetime import datetime
|
3
|
-
from typing import Any
|
3
|
+
from typing import Any
|
4
4
|
from unittest import mock
|
5
5
|
|
6
6
|
from promptl_ai import (
|
@@ -15,6 +15,7 @@ from promptl_ai import (
|
|
15
15
|
)
|
16
16
|
|
17
17
|
from latitude_sdk import (
|
18
|
+
AGENT_END_TOOL_NAME,
|
18
19
|
ApiError,
|
19
20
|
ApiErrorCodes,
|
20
21
|
ChainError,
|
@@ -510,6 +511,19 @@ data: {
|
|
510
511
|
""".strip(),
|
511
512
|
f"""
|
512
513
|
event: provider-event
|
514
|
+
data: {
|
515
|
+
json.dumps(
|
516
|
+
{
|
517
|
+
"type": "tool-call",
|
518
|
+
"toolCallId": "toolu_K12398312kjadbsadZ77JAS4",
|
519
|
+
"toolName": AGENT_END_TOOL_NAME,
|
520
|
+
"args": {"response": "I used the calculator!"},
|
521
|
+
},
|
522
|
+
)
|
523
|
+
}
|
524
|
+
""".strip(),
|
525
|
+
f"""
|
526
|
+
event: provider-event
|
513
527
|
data: {
|
514
528
|
json.dumps(
|
515
529
|
{
|
@@ -567,6 +581,11 @@ data: {
|
|
567
581
|
"name": "calculator",
|
568
582
|
"arguments": {"expression": "9.9 less than 9.11"},
|
569
583
|
},
|
584
|
+
{
|
585
|
+
"id": "toolu_K12398312kjadbsadZ77JAS4",
|
586
|
+
"name": AGENT_END_TOOL_NAME,
|
587
|
+
"arguments": {"response": "I used the calculator!"},
|
588
|
+
},
|
570
589
|
],
|
571
590
|
"usage": {"promptTokens": 61, "completionTokens": 9, "totalTokens": 70},
|
572
591
|
},
|
@@ -608,6 +627,11 @@ data: {
|
|
608
627
|
"toolName": "calculator",
|
609
628
|
"args": {"expression": "9.9 less than 9.11"},
|
610
629
|
},
|
630
|
+
{
|
631
|
+
"toolCallId": "toolu_K12398312kjadbsadZ77JAS4",
|
632
|
+
"toolName": AGENT_END_TOOL_NAME,
|
633
|
+
"args": {"response": "I used the calculator!"},
|
634
|
+
},
|
611
635
|
],
|
612
636
|
},
|
613
637
|
],
|
@@ -647,6 +671,11 @@ data: {
|
|
647
671
|
"name": "calculator",
|
648
672
|
"arguments": {"expression": "9.9 less than 9.11"},
|
649
673
|
},
|
674
|
+
{
|
675
|
+
"id": "toolu_K12398312kjadbsadZ77JAS4",
|
676
|
+
"name": AGENT_END_TOOL_NAME,
|
677
|
+
"arguments": {"response": "I used the calculator!"},
|
678
|
+
},
|
650
679
|
],
|
651
680
|
},
|
652
681
|
ensure_ascii=False,
|
@@ -698,6 +727,11 @@ data: {
|
|
698
727
|
"toolName": "calculator",
|
699
728
|
"args": {"expression": "9.9 less than 9.11"},
|
700
729
|
},
|
730
|
+
{
|
731
|
+
"toolCallId": "toolu_K12398312kjadbsadZ77JAS4",
|
732
|
+
"toolName": AGENT_END_TOOL_NAME,
|
733
|
+
"args": {"response": "I used the calculator!"},
|
734
|
+
},
|
701
735
|
],
|
702
736
|
},
|
703
737
|
],
|
@@ -752,6 +786,11 @@ data: {
|
|
752
786
|
"toolName": "calculator",
|
753
787
|
"args": {"expression": "9.9 less than 9.11"},
|
754
788
|
},
|
789
|
+
{
|
790
|
+
"toolCallId": "toolu_K12398312kjadbsadZ77JAS4",
|
791
|
+
"toolName": AGENT_END_TOOL_NAME,
|
792
|
+
"args": {"response": "I used the calculator!"},
|
793
|
+
},
|
755
794
|
],
|
756
795
|
},
|
757
796
|
],
|
@@ -904,6 +943,13 @@ CONVERSATION_EVENTS: list[StreamEvent] = [
|
|
904
943
|
"toolName": "calculator",
|
905
944
|
"args": {"expression": "9.9 less than 9.11"},
|
906
945
|
},
|
946
|
+
{
|
947
|
+
"event": StreamEvents.Provider,
|
948
|
+
"type": "tool-call",
|
949
|
+
"toolCallId": "toolu_K12398312kjadbsadZ77JAS4",
|
950
|
+
"toolName": AGENT_END_TOOL_NAME,
|
951
|
+
"args": {"response": "I used the calculator!"},
|
952
|
+
},
|
907
953
|
{
|
908
954
|
"event": StreamEvents.Provider,
|
909
955
|
"type": "step-finish",
|
@@ -941,6 +987,11 @@ CONVERSATION_EVENTS: list[StreamEvent] = [
|
|
941
987
|
name="calculator",
|
942
988
|
arguments={"expression": "9.9 less than 9.11"},
|
943
989
|
),
|
990
|
+
ToolCall(
|
991
|
+
id="toolu_K12398312kjadbsadZ77JAS4",
|
992
|
+
name=AGENT_END_TOOL_NAME,
|
993
|
+
arguments={"response": "I used the calculator!"},
|
994
|
+
),
|
944
995
|
],
|
945
996
|
usage=ModelUsage(prompt_tokens=61, completion_tokens=9, total_tokens=70),
|
946
997
|
),
|
@@ -963,6 +1014,11 @@ CONVERSATION_EVENTS: list[StreamEvent] = [
|
|
963
1014
|
name="calculator",
|
964
1015
|
arguments={"expression": "9.9 less than 9.11"},
|
965
1016
|
),
|
1017
|
+
ToolCallContent(
|
1018
|
+
id="toolu_K12398312kjadbsadZ77JAS4",
|
1019
|
+
name=AGENT_END_TOOL_NAME,
|
1020
|
+
arguments={"response": "I used the calculator!"},
|
1021
|
+
),
|
966
1022
|
]
|
967
1023
|
),
|
968
1024
|
],
|
@@ -981,6 +1037,11 @@ CONVERSATION_EVENTS: list[StreamEvent] = [
|
|
981
1037
|
ToolCall(
|
982
1038
|
id="toolu_B0398l23AOdTDshkg1UuQhZ3", name="calculator", arguments={"expression": "9.9 less than 9.11"}
|
983
1039
|
),
|
1040
|
+
ToolCall(
|
1041
|
+
id="toolu_K12398312kjadbsadZ77JAS4",
|
1042
|
+
name=AGENT_END_TOOL_NAME,
|
1043
|
+
arguments={"response": "I used the calculator!"},
|
1044
|
+
),
|
984
1045
|
],
|
985
1046
|
),
|
986
1047
|
ChainEventStepCompleted(
|
@@ -1006,6 +1067,11 @@ CONVERSATION_EVENTS: list[StreamEvent] = [
|
|
1006
1067
|
name="calculator",
|
1007
1068
|
arguments={"expression": "9.9 less than 9.11"},
|
1008
1069
|
),
|
1070
|
+
ToolCallContent(
|
1071
|
+
id="toolu_K12398312kjadbsadZ77JAS4",
|
1072
|
+
name=AGENT_END_TOOL_NAME,
|
1073
|
+
arguments={"response": "I used the calculator!"},
|
1074
|
+
),
|
1009
1075
|
]
|
1010
1076
|
),
|
1011
1077
|
],
|
@@ -1033,6 +1099,11 @@ CONVERSATION_EVENTS: list[StreamEvent] = [
|
|
1033
1099
|
name="calculator",
|
1034
1100
|
arguments={"expression": "9.9 less than 9.11"},
|
1035
1101
|
),
|
1102
|
+
ToolCallContent(
|
1103
|
+
id="toolu_K12398312kjadbsadZ77JAS4",
|
1104
|
+
name=AGENT_END_TOOL_NAME,
|
1105
|
+
arguments={"response": "I used the calculator!"},
|
1106
|
+
),
|
1036
1107
|
]
|
1037
1108
|
),
|
1038
1109
|
],
|
@@ -1126,6 +1197,12 @@ CONVERSATION_FINISHED_RESULT_RESPONSE: dict[str, Any] = {
|
|
1126
1197
|
"toolName": "calculator",
|
1127
1198
|
"args": {"expression": "9.9 less than 9.11"},
|
1128
1199
|
},
|
1200
|
+
{
|
1201
|
+
"type": "tool-call",
|
1202
|
+
"toolCallId": "toolu_K12398312kjadbsadZ77JAS4",
|
1203
|
+
"toolName": AGENT_END_TOOL_NAME,
|
1204
|
+
"args": {"response": "I used the calculator!"},
|
1205
|
+
},
|
1129
1206
|
],
|
1130
1207
|
"toolCalls": [
|
1131
1208
|
{
|
@@ -1138,6 +1215,11 @@ CONVERSATION_FINISHED_RESULT_RESPONSE: dict[str, Any] = {
|
|
1138
1215
|
"name": "calculator",
|
1139
1216
|
"arguments": {"expression": "9.9 less than 9.11"},
|
1140
1217
|
},
|
1218
|
+
{
|
1219
|
+
"id": "toolu_K12398312kjadbsadZ77JAS4",
|
1220
|
+
"name": AGENT_END_TOOL_NAME,
|
1221
|
+
"arguments": {"response": "I used the calculator!"},
|
1222
|
+
},
|
1141
1223
|
],
|
1142
1224
|
},
|
1143
1225
|
],
|
@@ -1155,9 +1237,15 @@ CONVERSATION_FINISHED_RESULT_RESPONSE: dict[str, Any] = {
|
|
1155
1237
|
"name": "calculator",
|
1156
1238
|
"arguments": {"expression": "9.9 less than 9.11"},
|
1157
1239
|
},
|
1240
|
+
{
|
1241
|
+
"id": "toolu_K12398312kjadbsadZ77JAS4",
|
1242
|
+
"name": AGENT_END_TOOL_NAME,
|
1243
|
+
"arguments": {"response": "I used the calculator!"},
|
1244
|
+
},
|
1158
1245
|
],
|
1159
1246
|
"usage": {"promptTokens": 61, "completionTokens": 9, "totalTokens": 70},
|
1160
1247
|
},
|
1248
|
+
"agent_response": {"response": "I used the calculator!"},
|
1161
1249
|
}
|
1162
1250
|
|
1163
1251
|
CONVERSATION_FINISHED_RESULT = FinishedResult(
|
@@ -1183,6 +1271,11 @@ CONVERSATION_FINISHED_RESULT = FinishedResult(
|
|
1183
1271
|
name="calculator",
|
1184
1272
|
arguments={"expression": "9.9 less than 9.11"},
|
1185
1273
|
),
|
1274
|
+
ToolCallContent(
|
1275
|
+
id="toolu_K12398312kjadbsadZ77JAS4",
|
1276
|
+
name=AGENT_END_TOOL_NAME,
|
1277
|
+
arguments={"response": "I used the calculator!"},
|
1278
|
+
),
|
1186
1279
|
]
|
1187
1280
|
),
|
1188
1281
|
],
|
@@ -1199,6 +1292,11 @@ CONVERSATION_FINISHED_RESULT = FinishedResult(
|
|
1199
1292
|
name="calculator",
|
1200
1293
|
arguments={"expression": "9.9 less than 9.11"},
|
1201
1294
|
),
|
1295
|
+
ToolCall(
|
1296
|
+
id="toolu_K12398312kjadbsadZ77JAS4",
|
1297
|
+
name=AGENT_END_TOOL_NAME,
|
1298
|
+
arguments={"response": "I used the calculator!"},
|
1299
|
+
),
|
1202
1300
|
],
|
1203
1301
|
usage=ModelUsage(prompt_tokens=61, completion_tokens=9, total_tokens=70),
|
1204
1302
|
),
|
@@ -1214,11 +1312,10 @@ CONVERSATION_FINISHED_RESULT = FinishedResult(
|
|
1214
1312
|
arguments={"expression": "9.9 less than 9.11"},
|
1215
1313
|
),
|
1216
1314
|
],
|
1315
|
+
agent_response={"response": "I used the calculator!"},
|
1217
1316
|
)
|
1218
1317
|
|
1219
|
-
|
1220
|
-
|
1221
|
-
CONVERSATION_TOOL_CALLS = cast(ChainTextResponse, CONVERSATION_FINISHED_RESULT.response).tool_calls
|
1318
|
+
CONVERSATION_TOOL_CALLS = CONVERSATION_FINISHED_RESULT.tool_requests
|
1222
1319
|
|
1223
1320
|
CONVERSATION_TOOL_RESULTS = [
|
1224
1321
|
ToolResult(
|
@@ -1,5 +1,4 @@
|
|
1
1
|
version = 1
|
2
|
-
revision = 1
|
3
2
|
requires-python = ">=3.9, <3.13"
|
4
3
|
|
5
4
|
[[package]]
|
@@ -140,7 +139,7 @@ wheels = [
|
|
140
139
|
|
141
140
|
[[package]]
|
142
141
|
name = "latitude-sdk"
|
143
|
-
version = "2.
|
142
|
+
version = "2.1.1"
|
144
143
|
source = { editable = "." }
|
145
144
|
dependencies = [
|
146
145
|
{ name = "httpx" },
|
@@ -165,7 +164,7 @@ dev = [
|
|
165
164
|
requires-dist = [
|
166
165
|
{ name = "httpx", specifier = ">=0.28.1" },
|
167
166
|
{ name = "httpx-sse", specifier = ">=0.4.0" },
|
168
|
-
{ name = "promptl-ai", specifier = ">=1.0.
|
167
|
+
{ name = "promptl-ai", specifier = ">=1.0.6" },
|
169
168
|
{ name = "pydantic", specifier = ">=2.10.3" },
|
170
169
|
{ name = "typing-extensions", specifier = ">=4.12.2" },
|
171
170
|
]
|
@@ -210,16 +209,16 @@ wheels = [
|
|
210
209
|
|
211
210
|
[[package]]
|
212
211
|
name = "promptl-ai"
|
213
|
-
version = "1.0.
|
212
|
+
version = "1.0.6"
|
214
213
|
source = { registry = "https://pypi.org/simple" }
|
215
214
|
dependencies = [
|
216
215
|
{ name = "pydantic" },
|
217
216
|
{ name = "typing-extensions" },
|
218
217
|
{ name = "wasmtime" },
|
219
218
|
]
|
220
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
219
|
+
sdist = { url = "https://files.pythonhosted.org/packages/81/cf/25354b4f34a028840729b9a33421e6e2adca9ea5920450f63fc606ed4fbd/promptl_ai-1.0.6.tar.gz", hash = "sha256:caf8ab08b77341384cd6f68e68b305447a7ecb86b161acb9a56c6b1d68b6d1b8", size = 1013653 }
|
221
220
|
wheels = [
|
222
|
-
{ url = "https://files.pythonhosted.org/packages/
|
221
|
+
{ url = "https://files.pythonhosted.org/packages/12/3b/64dba92f43a697c04a7fc2a11988bde9d48ef7ced9d232b709d059b25bd1/promptl_ai-1.0.6-py3-none-any.whl", hash = "sha256:d991ef54fb979c789a927fadb6c6f7038ab08635875c355e002ba33025cd1843", size = 1002087 },
|
223
222
|
]
|
224
223
|
|
225
224
|
[[package]]
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|