letta-nightly 0.6.9.dev20250119103943__py3-none-any.whl → 0.6.10.dev20250120193553__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.

Files changed (35) hide show
  1. letta/__init__.py +1 -1
  2. letta/agent.py +40 -23
  3. letta/client/client.py +10 -2
  4. letta/errors.py +14 -0
  5. letta/functions/ast_parsers.py +105 -0
  6. letta/llm_api/anthropic.py +130 -82
  7. letta/llm_api/aws_bedrock.py +134 -0
  8. letta/llm_api/llm_api_tools.py +30 -7
  9. letta/orm/__init__.py +1 -0
  10. letta/orm/job.py +2 -4
  11. letta/orm/message.py +5 -1
  12. letta/orm/step.py +54 -0
  13. letta/schemas/embedding_config.py +1 -0
  14. letta/schemas/letta_message.py +24 -0
  15. letta/schemas/letta_response.py +1 -9
  16. letta/schemas/llm_config.py +1 -0
  17. letta/schemas/message.py +1 -0
  18. letta/schemas/providers.py +60 -3
  19. letta/schemas/step.py +31 -0
  20. letta/server/rest_api/app.py +21 -6
  21. letta/server/rest_api/routers/v1/agents.py +15 -2
  22. letta/server/rest_api/routers/v1/llms.py +2 -2
  23. letta/server/rest_api/routers/v1/runs.py +12 -2
  24. letta/server/server.py +9 -3
  25. letta/services/agent_manager.py +4 -3
  26. letta/services/job_manager.py +11 -13
  27. letta/services/provider_manager.py +19 -7
  28. letta/services/step_manager.py +87 -0
  29. letta/settings.py +21 -1
  30. {letta_nightly-0.6.9.dev20250119103943.dist-info → letta_nightly-0.6.10.dev20250120193553.dist-info}/METADATA +8 -6
  31. {letta_nightly-0.6.9.dev20250119103943.dist-info → letta_nightly-0.6.10.dev20250120193553.dist-info}/RECORD +34 -30
  32. letta/credentials.py +0 -149
  33. {letta_nightly-0.6.9.dev20250119103943.dist-info → letta_nightly-0.6.10.dev20250120193553.dist-info}/LICENSE +0 -0
  34. {letta_nightly-0.6.9.dev20250119103943.dist-info → letta_nightly-0.6.10.dev20250120193553.dist-info}/WHEEL +0 -0
  35. {letta_nightly-0.6.9.dev20250119103943.dist-info → letta_nightly-0.6.10.dev20250120193553.dist-info}/entry_points.txt +0 -0
letta/credentials.py DELETED
@@ -1,149 +0,0 @@
1
- import configparser
2
- import os
3
- from dataclasses import dataclass
4
- from typing import Optional
5
-
6
- from letta.config import get_field, set_field
7
- from letta.constants import LETTA_DIR
8
-
9
- SUPPORTED_AUTH_TYPES = ["bearer_token", "api_key"]
10
-
11
-
12
- @dataclass
13
- class LettaCredentials:
14
- # credentials for Letta
15
- credentials_path: str = os.path.join(LETTA_DIR, "credentials")
16
-
17
- # openai config
18
- openai_auth_type: str = "bearer_token"
19
- openai_key: Optional[str] = os.getenv("OPENAI_API_KEY")
20
-
21
- # gemini config
22
- google_ai_key: Optional[str] = None
23
- google_ai_service_endpoint: Optional[str] = None
24
-
25
- # anthropic config
26
- anthropic_key: Optional[str] = os.getenv("ANTHROPIC_API_KEY")
27
-
28
- # cohere config
29
- cohere_key: Optional[str] = None
30
-
31
- # azure config
32
- azure_auth_type: str = "api_key"
33
- azure_key: Optional[str] = os.getenv("AZURE_OPENAI_API_KEY")
34
-
35
- # groq config
36
- groq_key: Optional[str] = os.getenv("GROQ_API_KEY")
37
-
38
- # base llm / model
39
- azure_version: Optional[str] = None
40
- azure_endpoint: Optional[str] = None
41
- azure_deployment: Optional[str] = None
42
- # embeddings
43
- azure_embedding_version: Optional[str] = None
44
- azure_embedding_endpoint: Optional[str] = None
45
- azure_embedding_deployment: Optional[str] = None
46
-
47
- # custom llm API config
48
- openllm_auth_type: Optional[str] = None
49
- openllm_key: Optional[str] = None
50
-
51
- @classmethod
52
- def load(cls) -> "LettaCredentials":
53
- config = configparser.ConfigParser()
54
-
55
- # allow overriding with env variables
56
- if os.getenv("MEMGPT_CREDENTIALS_PATH"):
57
- credentials_path = os.getenv("MEMGPT_CREDENTIALS_PATH")
58
- else:
59
- credentials_path = LettaCredentials.credentials_path
60
-
61
- if os.path.exists(credentials_path):
62
- # read existing credentials
63
- config.read(credentials_path)
64
- config_dict = {
65
- # openai
66
- "openai_auth_type": get_field(config, "openai", "auth_type"),
67
- "openai_key": get_field(config, "openai", "key"),
68
- # azure
69
- "azure_auth_type": get_field(config, "azure", "auth_type"),
70
- "azure_key": get_field(config, "azure", "key"),
71
- "azure_version": get_field(config, "azure", "version"),
72
- "azure_endpoint": get_field(config, "azure", "endpoint"),
73
- "azure_deployment": get_field(config, "azure", "deployment"),
74
- "azure_embedding_version": get_field(config, "azure", "embedding_version"),
75
- "azure_embedding_endpoint": get_field(config, "azure", "embedding_endpoint"),
76
- "azure_embedding_deployment": get_field(config, "azure", "embedding_deployment"),
77
- # gemini
78
- "google_ai_key": get_field(config, "google_ai", "key"),
79
- # "google_ai_service_endpoint": get_field(config, "google_ai", "service_endpoint"),
80
- # anthropic
81
- "anthropic_key": get_field(config, "anthropic", "key"),
82
- # cohere
83
- "cohere_key": get_field(config, "cohere", "key"),
84
- # groq
85
- "groq_key": get_field(config, "groq", "key"),
86
- # open llm
87
- "openllm_auth_type": get_field(config, "openllm", "auth_type"),
88
- "openllm_key": get_field(config, "openllm", "key"),
89
- # path
90
- "credentials_path": credentials_path,
91
- }
92
- config_dict = {k: v for k, v in config_dict.items() if v is not None}
93
- return cls(**config_dict)
94
-
95
- # create new config
96
- config = cls(credentials_path=credentials_path)
97
- config.save() # save updated config
98
- return config
99
-
100
- def save(self):
101
- pass
102
-
103
- config = configparser.ConfigParser()
104
- # openai config
105
- set_field(config, "openai", "auth_type", self.openai_auth_type)
106
- set_field(config, "openai", "key", self.openai_key)
107
-
108
- # azure config
109
- set_field(config, "azure", "auth_type", self.azure_auth_type)
110
- set_field(config, "azure", "key", self.azure_key)
111
- set_field(config, "azure", "version", self.azure_version)
112
- set_field(config, "azure", "endpoint", self.azure_endpoint)
113
- set_field(config, "azure", "deployment", self.azure_deployment)
114
- set_field(config, "azure", "embedding_version", self.azure_embedding_version)
115
- set_field(config, "azure", "embedding_endpoint", self.azure_embedding_endpoint)
116
- set_field(config, "azure", "embedding_deployment", self.azure_embedding_deployment)
117
-
118
- # gemini
119
- set_field(config, "google_ai", "key", self.google_ai_key)
120
- # set_field(config, "google_ai", "service_endpoint", self.google_ai_service_endpoint)
121
-
122
- # anthropic
123
- set_field(config, "anthropic", "key", self.anthropic_key)
124
-
125
- # cohere
126
- set_field(config, "cohere", "key", self.cohere_key)
127
-
128
- # groq
129
- set_field(config, "groq", "key", self.groq_key)
130
-
131
- # openllm config
132
- set_field(config, "openllm", "auth_type", self.openllm_auth_type)
133
- set_field(config, "openllm", "key", self.openllm_key)
134
-
135
- if not os.path.exists(LETTA_DIR):
136
- os.makedirs(LETTA_DIR, exist_ok=True)
137
- with open(self.credentials_path, "w", encoding="utf-8") as f:
138
- config.write(f)
139
-
140
- @staticmethod
141
- def exists():
142
- # allow overriding with env variables
143
- if os.getenv("MEMGPT_CREDENTIALS_PATH"):
144
- credentials_path = os.getenv("MEMGPT_CREDENTIALS_PATH")
145
- else:
146
- credentials_path = LettaCredentials.credentials_path
147
-
148
- assert not os.path.isdir(credentials_path), f"Credentials path {credentials_path} cannot be set to a directory."
149
- return os.path.exists(credentials_path)