letta-nightly 0.5.2.dev20241116104032__py3-none-any.whl → 0.5.2.dev20241118104226__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
@@ -1582,6 +1582,10 @@ class Agent(BaseAgent):
1582
1582
  functions_definitions=available_functions_definitions,
1583
1583
  )
1584
1584
 
1585
+ def count_tokens(self) -> int:
1586
+ """Count the tokens in the current context window"""
1587
+ return self.get_context_window().context_window_size_current
1588
+
1585
1589
 
1586
1590
  def save_agent(agent: Agent, ms: MetadataStore):
1587
1591
  """Save agent to metadata store"""
letta/main.py CHANGED
@@ -254,6 +254,15 @@ def run_agent_loop(
254
254
  )
255
255
  continue
256
256
 
257
+ elif user_input.lower() == "/tokens":
258
+ tokens = letta_agent.count_tokens()
259
+ typer.secho(
260
+ f"{tokens}/{letta_agent.agent_state.llm_config.context_window}",
261
+ fg=typer.colors.GREEN,
262
+ bold=True,
263
+ )
264
+ continue
265
+
257
266
  elif user_input.lower().startswith("/add_function"):
258
267
  try:
259
268
  if len(user_input) < len("/add_function "):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: letta-nightly
3
- Version: 0.5.2.dev20241116104032
3
+ Version: 0.5.2.dev20241118104226
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=pxKjP9kXyIsOmwb9JeAKuRHqDro5E_tdfWM-l31-x1s,77056
3
+ letta/agent.py,sha256=dQ0gtD0mPbWAvOTlPHHW2iYDfqgVwUZyOCgunKWZkGA,77222
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
@@ -83,7 +83,7 @@ letta/local_llm/webui/legacy_api.py,sha256=k3H3y4qp2Fs-XmP24iSIEyvq6wjWFWBzklY3-
83
83
  letta/local_llm/webui/legacy_settings.py,sha256=BLmd3TSx5StnY3ibjwaxYATPt_Lvq-o1rlcc_-Q1JcU,538
84
84
  letta/local_llm/webui/settings.py,sha256=gmLHfiOl1u4JmlAZU2d2O8YKF9lafdakyjwR_ftVPh8,552
85
85
  letta/log.py,sha256=Oy5b71AXfrnQShxI_4ULo5U3kmZJG01bXbP_64Nr4Fk,2105
86
- letta/main.py,sha256=h-qPQn_Ok5wf2cf54RFPfe8yp6sCmE-Kp9mBk_HZf7o,18797
86
+ letta/main.py,sha256=cFnjnbzyrRRM5sZeRAnGVq_rPIgJRHRFyFNCY--sRI4,19163
87
87
  letta/memory.py,sha256=YupXOvzVJXH59RW4XWBrd7qMNEYaMbtWXCheKeWZwpU,17873
88
88
  letta/metadata.py,sha256=xgwOPX_KQUl8OGxql2VAqe3ksg8EBD5gbctEDnM4RPk,22860
89
89
  letta/o1_agent.py,sha256=LqATgTpkc02-nCH_F87EOvgxLjdjT9F07kdzj3zSdQg,3118
@@ -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.dev20241116104032.dist-info/LICENSE,sha256=mExtuZ_GYJgDEI38GWdiEYZizZS4KkVt2SF1g_GPNhI,10759
212
- letta_nightly-0.5.2.dev20241116104032.dist-info/METADATA,sha256=92tSVHmsrsVzZEAxDeWv-LXu1I7SrXmHfuecz4SNR_s,11024
213
- letta_nightly-0.5.2.dev20241116104032.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
214
- letta_nightly-0.5.2.dev20241116104032.dist-info/entry_points.txt,sha256=2zdiyGNEZGV5oYBuS-y2nAAgjDgcC9yM_mHJBFSRt5U,40
215
- letta_nightly-0.5.2.dev20241116104032.dist-info/RECORD,,
211
+ letta_nightly-0.5.2.dev20241118104226.dist-info/LICENSE,sha256=mExtuZ_GYJgDEI38GWdiEYZizZS4KkVt2SF1g_GPNhI,10759
212
+ letta_nightly-0.5.2.dev20241118104226.dist-info/METADATA,sha256=_UTZODVLg4EJ1VdWLFwZIS6H00QBoPpxyUGOfbqrDR0,11024
213
+ letta_nightly-0.5.2.dev20241118104226.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
214
+ letta_nightly-0.5.2.dev20241118104226.dist-info/entry_points.txt,sha256=2zdiyGNEZGV5oYBuS-y2nAAgjDgcC9yM_mHJBFSRt5U,40
215
+ letta_nightly-0.5.2.dev20241118104226.dist-info/RECORD,,