letta-nightly 0.5.2.dev20241114104133__py3-none-any.whl → 0.5.2.dev20241116005113__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.

Potentially problematic release.


This version of letta-nightly might be problematic. Click here for more details.

letta/agent.py CHANGED
@@ -48,6 +48,7 @@ from letta.schemas.tool_rule import TerminalToolRule
48
48
  from letta.schemas.usage import LettaUsageStatistics
49
49
  from letta.services.source_manager import SourceManager
50
50
  from letta.services.user_manager import UserManager
51
+ from letta.streaming_interface import StreamingRefreshCLIInterface
51
52
  from letta.system import (
52
53
  get_heartbeat,
53
54
  get_initial_boot_messages,
@@ -229,7 +230,7 @@ class BaseAgent(ABC):
229
230
  class Agent(BaseAgent):
230
231
  def __init__(
231
232
  self,
232
- interface: Optional[AgentInterface],
233
+ interface: Optional[Union[AgentInterface, StreamingRefreshCLIInterface]],
233
234
  # agents can be created from providing agent_state
234
235
  agent_state: AgentState,
235
236
  tools: List[Tool],
@@ -242,26 +242,28 @@ def convert_anthropic_response_to_chatcompletion(
242
242
  finish_reason = remap_finish_reason(response_json["stop_reason"])
243
243
 
244
244
  if isinstance(response_json["content"], list):
245
- # inner mono + function call
246
- # TODO relax asserts
247
- assert len(response_json["content"]) == 2, response_json
248
- assert response_json["content"][0]["type"] == "text", response_json
249
- assert response_json["content"][1]["type"] == "tool_use", response_json
250
- content = strip_xml_tags(string=response_json["content"][0]["text"], tag=inner_thoughts_xml_tag)
251
- tool_calls = [
252
- ToolCall(
253
- id=response_json["content"][1]["id"],
254
- type="function",
255
- function=FunctionCall(
256
- name=response_json["content"][1]["name"],
257
- arguments=json.dumps(response_json["content"][1]["input"], indent=2),
258
- ),
259
- )
260
- ]
245
+ if len(response_json["content"]) > 1:
246
+ # inner mono + function call
247
+ assert len(response_json["content"]) == 2, response_json
248
+ assert response_json["content"][0]["type"] == "text", response_json
249
+ assert response_json["content"][1]["type"] == "tool_use", response_json
250
+ content = strip_xml_tags(string=response_json["content"][0]["text"], tag=inner_thoughts_xml_tag)
251
+ tool_calls = [
252
+ ToolCall(
253
+ id=response_json["content"][1]["id"],
254
+ type="function",
255
+ function=FunctionCall(
256
+ name=response_json["content"][1]["name"],
257
+ arguments=json.dumps(response_json["content"][1]["input"], indent=2),
258
+ ),
259
+ )
260
+ ]
261
+ else:
262
+ # Just inner mono
263
+ content = strip_xml_tags(string=response_json["content"][0]["text"], tag=inner_thoughts_xml_tag)
264
+ tool_calls = None
261
265
  else:
262
- # just inner mono
263
- content = strip_xml_tags(string=response_json["content"], tag=inner_thoughts_xml_tag)
264
- tool_calls = None
266
+ raise RuntimeError("Unexpected type for content in response_json.")
265
267
 
266
268
  assert response_json["role"] == "assistant", response_json
267
269
  choice = Choice(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: letta-nightly
3
- Version: 0.5.2.dev20241114104133
3
+ Version: 0.5.2.dev20241116005113
4
4
  Summary: Create LLM agents with long-term memory and custom tools
5
5
  License: Apache License
6
6
  Author: Letta Team
@@ -1,6 +1,6 @@
1
1
  letta/__init__.py,sha256=IMLtpH5HlbVUa1mmPpSyBpTZqVz1rsS7lbuqT7viBQ0,1014
2
2
  letta/__main__.py,sha256=6Hs2PV7EYc5Tid4g4OtcLXhqVHiNYTGzSBdoOnW2HXA,29
3
- letta/agent.py,sha256=mQxkYsG80P_KCzXN6EDmwi6tiXebabHpcYsgs7ugWP0,76952
3
+ letta/agent.py,sha256=pxKjP9kXyIsOmwb9JeAKuRHqDro5E_tdfWM-l31-x1s,77056
4
4
  letta/agent_store/chroma.py,sha256=upR5zGnGs6I6btulEYbiZdGG87BgKjxUJOQZ4Y-RQ_M,12492
5
5
  letta/agent_store/db.py,sha256=9pIeakcRls0Fi3wO2b9Jg_Qw1IBJ-_GUSpE1z-upGS0,23425
6
6
  letta/agent_store/lancedb.py,sha256=i63d4VZwj9UIOTNs5f0JZ_r5yZD-jKWz4FAH4RMpXOE,5104
@@ -36,7 +36,7 @@ letta/humans/examples/basic.txt,sha256=Lcp8YESTWvOJgO4Yf_yyQmgo5bKakeB1nIVrwEGG6
36
36
  letta/humans/examples/cs_phd.txt,sha256=9C9ZAV_VuG7GB31ksy3-_NAyk8rjE6YtVOkhp08k1xw,297
37
37
  letta/interface.py,sha256=QI4hFP0WrNsgM5qX6TbnhH1ZZxsLYr5DaccuxpEQ8S4,12768
38
38
  letta/llm_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
- letta/llm_api/anthropic.py,sha256=GZFMAGgertU7GrGK_ahz051Ce0MHXqPzh8f7AlsPslg,12887
39
+ letta/llm_api/anthropic.py,sha256=Q-6QLwSHC_YTqWJWIMjxMWsnjxgN1cnCzle5-m5A70s,13077
40
40
  letta/llm_api/azure_openai.py,sha256=Y1HKPog1XzM_f7ujUK_Gv2zQkoy5pU-1bKiUnvSxSrs,6297
41
41
  letta/llm_api/azure_openai_constants.py,sha256=oXtKrgBFHf744gyt5l1thILXgyi8NDNUrKEa2GGGpjw,278
42
42
  letta/llm_api/cohere.py,sha256=vDRd-SUGp1t_JUIdwC3RkIhwMl0OY7n-tAU9uPORYkY,14826
@@ -208,8 +208,8 @@ letta/streaming_interface.py,sha256=_FPUWy58j50evHcpXyd7zB1wWqeCc71NCFeWh_TBvnw,
208
208
  letta/streaming_utils.py,sha256=329fsvj1ZN0r0LpQtmMPZ2vSxkDBIUUwvGHZFkjm2I8,11745
209
209
  letta/system.py,sha256=buKYPqG5n2x41hVmWpu6JUpyd7vTWED9Km2_M7dLrvk,6960
210
210
  letta/utils.py,sha256=SXLEYhyp3gHyIjrxNIKNZZ5ittKo3KOj6zxgC_Trex0,31012
211
- letta_nightly-0.5.2.dev20241114104133.dist-info/LICENSE,sha256=mExtuZ_GYJgDEI38GWdiEYZizZS4KkVt2SF1g_GPNhI,10759
212
- letta_nightly-0.5.2.dev20241114104133.dist-info/METADATA,sha256=Tc9AzeU1-JqTpOlFoXMFNmbWmPcpmityzgOB_hPZwFY,11024
213
- letta_nightly-0.5.2.dev20241114104133.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
214
- letta_nightly-0.5.2.dev20241114104133.dist-info/entry_points.txt,sha256=2zdiyGNEZGV5oYBuS-y2nAAgjDgcC9yM_mHJBFSRt5U,40
215
- letta_nightly-0.5.2.dev20241114104133.dist-info/RECORD,,
211
+ letta_nightly-0.5.2.dev20241116005113.dist-info/LICENSE,sha256=mExtuZ_GYJgDEI38GWdiEYZizZS4KkVt2SF1g_GPNhI,10759
212
+ letta_nightly-0.5.2.dev20241116005113.dist-info/METADATA,sha256=7AGHkLwaj_6vOyZM3DwwrJayr1UOAUd8sn4vPG8DF4I,11024
213
+ letta_nightly-0.5.2.dev20241116005113.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
214
+ letta_nightly-0.5.2.dev20241116005113.dist-info/entry_points.txt,sha256=2zdiyGNEZGV5oYBuS-y2nAAgjDgcC9yM_mHJBFSRt5U,40
215
+ letta_nightly-0.5.2.dev20241116005113.dist-info/RECORD,,