Skip to content

Commit d4bdb82

Browse files
authored
chore: add various fixes (#3026)
2 parents 06fc7bb + ed74c59 commit d4bdb82

File tree

14 files changed

+939
-146
lines changed

14 files changed

+939
-146
lines changed

fern/openapi.json

Lines changed: 199 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10137,6 +10137,45 @@
1013710137
}
1013810138
}
1013910139
},
10140+
"/v1/providers/{provider_id}/check": {
10141+
"post": {
10142+
"tags": ["providers"],
10143+
"summary": "Check Existing Provider",
10144+
"description": "Verify the API key and additional parameters for an existing provider.",
10145+
"operationId": "check_existing_provider",
10146+
"parameters": [
10147+
{
10148+
"name": "provider_id",
10149+
"in": "path",
10150+
"required": true,
10151+
"schema": {
10152+
"type": "string",
10153+
"title": "Provider Id"
10154+
}
10155+
}
10156+
],
10157+
"responses": {
10158+
"200": {
10159+
"description": "Successful Response",
10160+
"content": {
10161+
"application/json": {
10162+
"schema": {}
10163+
}
10164+
}
10165+
},
10166+
"422": {
10167+
"description": "Validation Error",
10168+
"content": {
10169+
"application/json": {
10170+
"schema": {
10171+
"$ref": "#/components/schemas/HTTPValidationError"
10172+
}
10173+
}
10174+
}
10175+
}
10176+
}
10177+
}
10178+
},
1014010179
"/v1/runs/": {
1014110180
"get": {
1014210181
"tags": ["runs"],
@@ -29731,7 +29770,7 @@
2973129770
"anyOf": [
2973229771
{
2973329772
"items": {
29734-
"$ref": "#/components/schemas/ToolReturn"
29773+
"$ref": "#/components/schemas/letta__schemas__message__ToolReturn"
2973529774
},
2973629775
"type": "array"
2973729776
},
@@ -33842,7 +33881,25 @@
3384233881
"$ref": "#/components/schemas/ToolCallDelta"
3384333882
}
3384433883
],
33845-
"title": "Tool Call"
33884+
"title": "Tool Call",
33885+
"deprecated": true
33886+
},
33887+
"tool_calls": {
33888+
"anyOf": [
33889+
{
33890+
"items": {
33891+
"$ref": "#/components/schemas/ToolCall"
33892+
},
33893+
"type": "array"
33894+
},
33895+
{
33896+
"$ref": "#/components/schemas/ToolCallDelta"
33897+
},
33898+
{
33899+
"type": "null"
33900+
}
33901+
],
33902+
"title": "Tool Calls"
3384633903
}
3384733904
},
3384833905
"type": "object",
@@ -34073,7 +34130,7 @@
3407334130
"required": ["name", "description", "parameters"],
3407434131
"title": "ToolJSONSchema"
3407534132
},
34076-
"ToolReturn": {
34133+
"ToolReturn-Input": {
3407734134
"properties": {
3407834135
"tool_call_id": {
3407934136
"anyOf": [
@@ -34264,16 +34321,19 @@
3426434321
},
3426534322
"tool_return": {
3426634323
"type": "string",
34267-
"title": "Tool Return"
34324+
"title": "Tool Return",
34325+
"deprecated": true
3426834326
},
3426934327
"status": {
3427034328
"type": "string",
3427134329
"enum": ["success", "error"],
34272-
"title": "Status"
34330+
"title": "Status",
34331+
"deprecated": true
3427334332
},
3427434333
"tool_call_id": {
3427534334
"type": "string",
34276-
"title": "Tool Call Id"
34335+
"title": "Tool Call Id",
34336+
"deprecated": true
3427734337
},
3427834338
"stdout": {
3427934339
"anyOf": [
@@ -34287,7 +34347,8 @@
3428734347
"type": "null"
3428834348
}
3428934349
],
34290-
"title": "Stdout"
34350+
"title": "Stdout",
34351+
"deprecated": true
3429134352
},
3429234353
"stderr": {
3429334354
"anyOf": [
@@ -34301,13 +34362,28 @@
3430134362
"type": "null"
3430234363
}
3430334364
],
34304-
"title": "Stderr"
34365+
"title": "Stderr",
34366+
"deprecated": true
34367+
},
34368+
"tool_returns": {
34369+
"anyOf": [
34370+
{
34371+
"items": {
34372+
"$ref": "#/components/schemas/letta__schemas__letta_message__ToolReturn"
34373+
},
34374+
"type": "array"
34375+
},
34376+
{
34377+
"type": "null"
34378+
}
34379+
],
34380+
"title": "Tool Returns"
3430534381
}
3430634382
},
3430734383
"type": "object",
3430834384
"required": ["id", "date", "tool_return", "status", "tool_call_id"],
3430934385
"title": "ToolReturnMessage",
34310-
"description": "A message representing the return value of a tool call (generated by Letta executing the requested tool).\n\nArgs:\n id (str): The ID of the message\n date (datetime): The date the message was created in ISO format\n name (Optional[str]): The name of the sender of the message\n tool_return (str): The return value of the tool\n status (Literal[\"success\", \"error\"]): The status of the tool call\n tool_call_id (str): A unique identifier for the tool call that generated this message\n stdout (Optional[List(str)]): Captured stdout (e.g. prints, logs) from the tool invocation\n stderr (Optional[List(str)]): Captured stderr from the tool invocation"
34386+
"description": "A message representing the return value of a tool call (generated by Letta executing the requested tool).\n\nArgs:\n id (str): The ID of the message\n date (datetime): The date the message was created in ISO format\n name (Optional[str]): The name of the sender of the message\n tool_return (str): The return value of the tool (deprecated, use tool_returns)\n status (Literal[\"success\", \"error\"]): The status of the tool call (deprecated, use tool_returns)\n tool_call_id (str): A unique identifier for the tool call that generated this message (deprecated, use tool_returns)\n stdout (Optional[List(str)]): Captured stdout (e.g. prints, logs) from the tool invocation (deprecated, use tool_returns)\n stderr (Optional[List(str)]): Captured stderr from the tool invocation (deprecated, use tool_returns)\n tool_returns (Optional[List[ToolReturn]]): List of tool returns for multi-tool support"
3431134387
},
3431234388
"ToolRunFromSource": {
3431334389
"properties": {
@@ -36449,7 +36525,7 @@
3644936525
"anyOf": [
3645036526
{
3645136527
"items": {
36452-
"$ref": "#/components/schemas/ToolReturn"
36528+
"$ref": "#/components/schemas/ToolReturn-Input"
3645336529
},
3645436530
"type": "array"
3645536531
},
@@ -36695,6 +36771,119 @@
3669536771
"title": "ToolSchema",
3669636772
"description": "Tool with human-readable ID for agent file"
3669736773
},
36774+
"letta__schemas__letta_message__ToolReturn": {
36775+
"properties": {
36776+
"tool_return": {
36777+
"type": "string",
36778+
"title": "Tool Return"
36779+
},
36780+
"status": {
36781+
"type": "string",
36782+
"enum": ["success", "error"],
36783+
"title": "Status"
36784+
},
36785+
"tool_call_id": {
36786+
"type": "string",
36787+
"title": "Tool Call Id"
36788+
},
36789+
"stdout": {
36790+
"anyOf": [
36791+
{
36792+
"items": {
36793+
"type": "string"
36794+
},
36795+
"type": "array"
36796+
},
36797+
{
36798+
"type": "null"
36799+
}
36800+
],
36801+
"title": "Stdout"
36802+
},
36803+
"stderr": {
36804+
"anyOf": [
36805+
{
36806+
"items": {
36807+
"type": "string"
36808+
},
36809+
"type": "array"
36810+
},
36811+
{
36812+
"type": "null"
36813+
}
36814+
],
36815+
"title": "Stderr"
36816+
}
36817+
},
36818+
"type": "object",
36819+
"required": ["tool_return", "status", "tool_call_id"],
36820+
"title": "ToolReturn"
36821+
},
36822+
"letta__schemas__message__ToolReturn": {
36823+
"properties": {
36824+
"tool_call_id": {
36825+
"anyOf": [
36826+
{},
36827+
{
36828+
"type": "null"
36829+
}
36830+
],
36831+
"title": "Tool Call Id",
36832+
"description": "The ID for the tool call"
36833+
},
36834+
"status": {
36835+
"type": "string",
36836+
"enum": ["success", "error"],
36837+
"title": "Status",
36838+
"description": "The status of the tool call"
36839+
},
36840+
"stdout": {
36841+
"anyOf": [
36842+
{
36843+
"items": {
36844+
"type": "string"
36845+
},
36846+
"type": "array"
36847+
},
36848+
{
36849+
"type": "null"
36850+
}
36851+
],
36852+
"title": "Stdout",
36853+
"description": "Captured stdout (e.g. prints, logs) from the tool invocation"
36854+
},
36855+
"stderr": {
36856+
"anyOf": [
36857+
{
36858+
"items": {
36859+
"type": "string"
36860+
},
36861+
"type": "array"
36862+
},
36863+
{
36864+
"type": "null"
36865+
}
36866+
],
36867+
"title": "Stderr",
36868+
"description": "Captured stderr from the tool invocation"
36869+
},
36870+
"func_response": {
36871+
"anyOf": [
36872+
{
36873+
"type": "string"
36874+
},
36875+
{
36876+
"type": "null"
36877+
}
36878+
],
36879+
"title": "Func Response",
36880+
"description": "The function response string"
36881+
}
36882+
},
36883+
"type": "object",
36884+
"required": ["status"],
36885+
"title": "ToolReturn"
36886+
},
3669836887
"letta__serialize_schemas__pydantic_agent_schema__AgentSchema": {
3669936888
"properties": {
3670036889
"agent_type": {

letta/interfaces/anthropic_streaming_interface.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,11 @@ async def _process_event(
279279
if prev_message_type and prev_message_type != "tool_call_message":
280280
message_index += 1
281281
if self.tool_call_name not in self.requires_approval_tools:
282+
tool_call_delta = ToolCallDelta(name=self.tool_call_name, tool_call_id=self.tool_call_id)
282283
tool_call_msg = ToolCallMessage(
283284
id=self.letta_message_id,
284-
tool_call=ToolCallDelta(name=self.tool_call_name, tool_call_id=self.tool_call_id),
285+
tool_call=tool_call_delta,
286+
tool_calls=tool_call_delta,
285287
date=datetime.now(timezone.utc).isoformat(),
286288
otid=Message.generate_otid_from_id(self.letta_message_id, message_index),
287289
run_id=self.run_id,
@@ -423,15 +425,17 @@ async def _process_event(
423425
tool_call_args += buffered_msg.tool_call.arguments if buffered_msg.tool_call.arguments else ""
424426
tool_call_args = tool_call_args.replace(f'"{INNER_THOUGHTS_KWARG}": "{current_inner_thoughts}"', "")
425427

428+
tool_call_delta = ToolCallDelta(
429+
name=self.tool_call_name,
430+
tool_call_id=self.tool_call_id,
431+
arguments=tool_call_args,
432+
)
426433
tool_call_msg = ToolCallMessage(
427434
id=self.tool_call_buffer[0].id,
428435
otid=Message.generate_otid_from_id(self.tool_call_buffer[0].id, message_index),
429436
date=self.tool_call_buffer[0].date,
430-
tool_call=ToolCallDelta(
431-
name=self.tool_call_name,
432-
tool_call_id=self.tool_call_id,
433-
arguments=tool_call_args,
434-
),
437+
tool_call=tool_call_delta,
438+
tool_calls=tool_call_delta,
435439
run_id=self.run_id,
436440
)
437441
prev_message_type = tool_call_msg.message_type
@@ -467,9 +471,13 @@ async def _process_event(
467471
run_id=self.run_id,
468472
)
469473
else:
474+
tool_call_delta = ToolCallDelta(
475+
name=self.tool_call_name, tool_call_id=self.tool_call_id, arguments=delta.partial_json
476+
)
470477
tool_call_msg = ToolCallMessage(
471478
id=self.letta_message_id,
472-
tool_call=ToolCallDelta(name=self.tool_call_name, tool_call_id=self.tool_call_id, arguments=delta.partial_json),
479+
tool_call=tool_call_delta,
480+
tool_calls=tool_call_delta,
473481
date=datetime.now(timezone.utc).isoformat(),
474482
run_id=self.run_id,
475483
)
@@ -778,9 +786,11 @@ async def _process_event(
778786
else:
779787
if prev_message_type and prev_message_type != "tool_call_message":
780788
message_index += 1
789+
tool_call_delta = ToolCallDelta(name=self.tool_call_name, tool_call_id=self.tool_call_id)
781790
tool_call_msg = ToolCallMessage(
782791
id=self.letta_message_id,
783-
tool_call=ToolCallDelta(name=self.tool_call_name, tool_call_id=self.tool_call_id),
792+
tool_call=tool_call_delta,
793+
tool_calls=tool_call_delta,
784794
date=datetime.now(timezone.utc).isoformat(),
785795
otid=Message.generate_otid_from_id(self.letta_message_id, message_index),
786796
run_id=self.run_id,
@@ -860,9 +870,11 @@ async def _process_event(
860870
else:
861871
if prev_message_type and prev_message_type != "tool_call_message":
862872
message_index += 1
873+
tool_call_delta = ToolCallDelta(name=self.tool_call_name, tool_call_id=self.tool_call_id, arguments=delta.partial_json)
863874
tool_call_msg = ToolCallMessage(
864875
id=self.letta_message_id,
865-
tool_call=ToolCallDelta(name=self.tool_call_name, tool_call_id=self.tool_call_id, arguments=delta.partial_json),
876+
tool_call=tool_call_delta,
877+
tool_calls=tool_call_delta,
866878
date=datetime.now(timezone.utc).isoformat(),
867879
otid=Message.generate_otid_from_id(self.letta_message_id, message_index),
868880
run_id=self.run_id,

letta/interfaces/gemini_streaming_interface.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,15 +273,17 @@ async def _process_event(
273273
else:
274274
if prev_message_type and prev_message_type != "tool_call_message":
275275
message_index += 1
276+
tool_call_delta = ToolCallDelta(
277+
name=name,
278+
arguments=arguments_str,
279+
tool_call_id=call_id,
280+
)
276281
yield ToolCallMessage(
277282
id=self.letta_message_id,
278283
otid=Message.generate_otid_from_id(self.letta_message_id, message_index),
279284
date=datetime.now(timezone.utc),
280-
tool_call=ToolCallDelta(
281-
name=name,
282-
arguments=arguments_str,
283-
tool_call_id=call_id,
284-
),
285+
tool_call=tool_call_delta,
286+
tool_calls=tool_call_delta,
285287
run_id=self.run_id,
286288
step_id=self.step_id,
287289
)

0 commit comments

Comments
 (0)