letta-nightly 0.4.1.dev20241004104123__py3-none-any.whl → 0.4.1.dev20241006104046__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/cli/cli.py +30 -365
- letta/cli/cli_config.py +70 -27
- letta/client/client.py +103 -11
- letta/config.py +80 -80
- letta/constants.py +6 -0
- letta/credentials.py +10 -1
- letta/errors.py +63 -5
- letta/llm_api/llm_api_tools.py +110 -52
- letta/local_llm/chat_completion_proxy.py +0 -3
- letta/main.py +1 -2
- letta/metadata.py +12 -0
- letta/providers.py +232 -0
- letta/schemas/block.py +1 -1
- letta/schemas/letta_request.py +17 -0
- letta/schemas/letta_response.py +11 -0
- letta/schemas/llm_config.py +18 -2
- letta/schemas/message.py +40 -13
- letta/server/rest_api/app.py +5 -0
- letta/server/rest_api/interface.py +115 -24
- letta/server/rest_api/routers/v1/agents.py +36 -3
- letta/server/rest_api/routers/v1/llms.py +6 -2
- letta/server/server.py +60 -87
- letta/server/static_files/assets/index-3ab03d5b.css +1 -0
- letta/server/static_files/assets/{index-4d08d8a3.js → index-9a9c449b.js} +69 -69
- letta/server/static_files/index.html +2 -2
- letta/settings.py +144 -114
- letta/utils.py +6 -1
- {letta_nightly-0.4.1.dev20241004104123.dist-info → letta_nightly-0.4.1.dev20241006104046.dist-info}/METADATA +1 -1
- {letta_nightly-0.4.1.dev20241004104123.dist-info → letta_nightly-0.4.1.dev20241006104046.dist-info}/RECORD +32 -32
- letta/local_llm/groq/api.py +0 -97
- letta/server/static_files/assets/index-156816da.css +0 -1
- {letta_nightly-0.4.1.dev20241004104123.dist-info → letta_nightly-0.4.1.dev20241006104046.dist-info}/LICENSE +0 -0
- {letta_nightly-0.4.1.dev20241004104123.dist-info → letta_nightly-0.4.1.dev20241006104046.dist-info}/WHEEL +0 -0
- {letta_nightly-0.4.1.dev20241004104123.dist-info → letta_nightly-0.4.1.dev20241006104046.dist-info}/entry_points.txt +0 -0
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
</script>
|
|
32
|
-
<script type="module" crossorigin src="/assets/index-
|
|
33
|
-
<link rel="stylesheet" href="/assets/index-
|
|
32
|
+
<script type="module" crossorigin src="/assets/index-9a9c449b.js"></script>
|
|
33
|
+
<link rel="stylesheet" href="/assets/index-3ab03d5b.css">
|
|
34
34
|
</head>
|
|
35
35
|
<body>
|
|
36
36
|
<div class="h-full w-full" id="root"></div>
|
letta/settings.py
CHANGED
|
@@ -1,13 +1,42 @@
|
|
|
1
|
-
import os
|
|
2
1
|
from pathlib import Path
|
|
3
2
|
from typing import Optional
|
|
4
3
|
|
|
5
4
|
from pydantic import Field
|
|
6
5
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
|
|
8
|
+
class ModelSettings(BaseSettings):
|
|
9
|
+
|
|
10
|
+
# env_prefix='my_prefix_'
|
|
11
|
+
|
|
12
|
+
# openai
|
|
13
|
+
openai_api_key: Optional[str] = None
|
|
14
|
+
# TODO: provide overriding BASE_URL?
|
|
15
|
+
|
|
16
|
+
# grok
|
|
17
|
+
grok_api_key: Optional[str] = None
|
|
18
|
+
|
|
19
|
+
# anthropic
|
|
20
|
+
anthropic_api_key: Optional[str] = None
|
|
21
|
+
|
|
22
|
+
# ollama
|
|
23
|
+
ollama_base_url: Optional[str] = None
|
|
24
|
+
|
|
25
|
+
# azure
|
|
26
|
+
azure_deployment: Optional[str] = None
|
|
27
|
+
|
|
28
|
+
# google ai
|
|
29
|
+
gemini_api_key: Optional[str] = None
|
|
30
|
+
|
|
31
|
+
# vLLM
|
|
32
|
+
vllm_base_url: Optional[str] = None
|
|
33
|
+
|
|
34
|
+
# openllm
|
|
35
|
+
openllm_auth_type: Optional[str] = None
|
|
36
|
+
openllm_api_key: Optional[str] = None
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
cors_origins = ["http://letta.localhost", "http://localhost:8283", "http://localhost:8083", "http://localhost:3000"]
|
|
11
40
|
|
|
12
41
|
|
|
13
42
|
class Settings(BaseSettings):
|
|
@@ -15,7 +44,7 @@ class Settings(BaseSettings):
|
|
|
15
44
|
|
|
16
45
|
letta_dir: Optional[Path] = Field(Path.home() / ".letta", env="LETTA_DIR")
|
|
17
46
|
debug: Optional[bool] = False
|
|
18
|
-
cors_origins: Optional[list] =
|
|
47
|
+
cors_origins: Optional[list] = cors_origins
|
|
19
48
|
|
|
20
49
|
# database configuration
|
|
21
50
|
pg_db: Optional[str] = None
|
|
@@ -25,115 +54,115 @@ class Settings(BaseSettings):
|
|
|
25
54
|
pg_port: Optional[int] = None
|
|
26
55
|
pg_uri: Optional[str] = None # option to specifiy full uri
|
|
27
56
|
|
|
28
|
-
|
|
29
|
-
llm_endpoint: Optional[str] = None
|
|
30
|
-
llm_endpoint_type: Optional[str] = None
|
|
31
|
-
llm_model: Optional[str] = None
|
|
32
|
-
llm_context_window: Optional[int] = None
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
embedding_endpoint: Optional[str] = None
|
|
36
|
-
embedding_endpoint_type: Optional[str] = None
|
|
37
|
-
embedding_dim: Optional[int] = None
|
|
38
|
-
embedding_model: Optional[str] = None
|
|
39
|
-
embedding_chunk_size: int = 300
|
|
40
|
-
|
|
41
|
-
@property
|
|
42
|
-
def llm_config(self):
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
@property
|
|
91
|
-
def embedding_config(self):
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
57
|
+
## llm configuration
|
|
58
|
+
# llm_endpoint: Optional[str] = None
|
|
59
|
+
# llm_endpoint_type: Optional[str] = None
|
|
60
|
+
# llm_model: Optional[str] = None
|
|
61
|
+
# llm_context_window: Optional[int] = None
|
|
62
|
+
|
|
63
|
+
## embedding configuration
|
|
64
|
+
# embedding_endpoint: Optional[str] = None
|
|
65
|
+
# embedding_endpoint_type: Optional[str] = None
|
|
66
|
+
# embedding_dim: Optional[int] = None
|
|
67
|
+
# embedding_model: Optional[str] = None
|
|
68
|
+
# embedding_chunk_size: int = 300
|
|
69
|
+
|
|
70
|
+
# @property
|
|
71
|
+
# def llm_config(self):
|
|
72
|
+
|
|
73
|
+
# # try to get LLM config from settings
|
|
74
|
+
# if self.llm_endpoint and self.llm_endpoint_type and self.llm_model and self.llm_context_window:
|
|
75
|
+
# return LLMConfig(
|
|
76
|
+
# model=self.llm_model,
|
|
77
|
+
# model_endpoint_type=self.llm_endpoint_type,
|
|
78
|
+
# model_endpoint=self.llm_endpoint,
|
|
79
|
+
# model_wrapper=None,
|
|
80
|
+
# context_window=self.llm_context_window,
|
|
81
|
+
# )
|
|
82
|
+
# else:
|
|
83
|
+
# if not self.llm_endpoint:
|
|
84
|
+
# printd(f"No LETTA_LLM_ENDPOINT provided")
|
|
85
|
+
# if not self.llm_endpoint_type:
|
|
86
|
+
# printd(f"No LETTA_LLM_ENDPOINT_TYPE provided")
|
|
87
|
+
# if not self.llm_model:
|
|
88
|
+
# printd(f"No LETTA_LLM_MODEL provided")
|
|
89
|
+
# if not self.llm_context_window:
|
|
90
|
+
# printd(f"No LETTA_LLM_CONTEX_WINDOW provided")
|
|
91
|
+
|
|
92
|
+
# # quickstart options
|
|
93
|
+
# if self.llm_model:
|
|
94
|
+
# try:
|
|
95
|
+
# return LLMConfig.default_config(self.llm_model)
|
|
96
|
+
# except ValueError:
|
|
97
|
+
# pass
|
|
98
|
+
|
|
99
|
+
# # try to read from config file (last resort)
|
|
100
|
+
# from letta.config import LettaConfig
|
|
101
|
+
|
|
102
|
+
# if LettaConfig.exists():
|
|
103
|
+
# config = LettaConfig.load()
|
|
104
|
+
# llm_config = LLMConfig(
|
|
105
|
+
# model=config.default_llm_config.model,
|
|
106
|
+
# model_endpoint_type=config.default_llm_config.model_endpoint_type,
|
|
107
|
+
# model_endpoint=config.default_llm_config.model_endpoint,
|
|
108
|
+
# model_wrapper=config.default_llm_config.model_wrapper,
|
|
109
|
+
# context_window=config.default_llm_config.context_window,
|
|
110
|
+
# )
|
|
111
|
+
# return llm_config
|
|
112
|
+
|
|
113
|
+
# # check OpenAI API key
|
|
114
|
+
# if os.getenv("OPENAI_API_KEY"):
|
|
115
|
+
# return LLMConfig.default_config(self.llm_model if self.llm_model else "gpt-4")
|
|
116
|
+
|
|
117
|
+
# return LLMConfig.default_config("letta")
|
|
118
|
+
|
|
119
|
+
# @property
|
|
120
|
+
# def embedding_config(self):
|
|
121
|
+
|
|
122
|
+
# # try to get LLM config from settings
|
|
123
|
+
# if self.embedding_endpoint and self.embedding_endpoint_type and self.embedding_model and self.embedding_dim:
|
|
124
|
+
# return EmbeddingConfig(
|
|
125
|
+
# embedding_model=self.embedding_model,
|
|
126
|
+
# embedding_endpoint_type=self.embedding_endpoint_type,
|
|
127
|
+
# embedding_endpoint=self.embedding_endpoint,
|
|
128
|
+
# embedding_dim=self.embedding_dim,
|
|
129
|
+
# embedding_chunk_size=self.embedding_chunk_size,
|
|
130
|
+
# )
|
|
131
|
+
# else:
|
|
132
|
+
# if not self.embedding_endpoint:
|
|
133
|
+
# printd(f"No LETTA_EMBEDDING_ENDPOINT provided")
|
|
134
|
+
# if not self.embedding_endpoint_type:
|
|
135
|
+
# printd(f"No LETTA_EMBEDDING_ENDPOINT_TYPE provided")
|
|
136
|
+
# if not self.embedding_model:
|
|
137
|
+
# printd(f"No LETTA_EMBEDDING_MODEL provided")
|
|
138
|
+
# if not self.embedding_dim:
|
|
139
|
+
# printd(f"No LETTA_EMBEDDING_DIM provided")
|
|
140
|
+
|
|
141
|
+
# # TODO
|
|
142
|
+
# ## quickstart options
|
|
143
|
+
# # if self.embedding_model:
|
|
144
|
+
# # try:
|
|
145
|
+
# # return EmbeddingConfig.default_config(self.embedding_model)
|
|
146
|
+
# # except ValueError as e:
|
|
147
|
+
# # pass
|
|
148
|
+
|
|
149
|
+
# # try to read from config file (last resort)
|
|
150
|
+
# from letta.config import LettaConfig
|
|
151
|
+
|
|
152
|
+
# if LettaConfig.exists():
|
|
153
|
+
# config = LettaConfig.load()
|
|
154
|
+
# return EmbeddingConfig(
|
|
155
|
+
# embedding_model=config.default_embedding_config.embedding_model,
|
|
156
|
+
# embedding_endpoint_type=config.default_embedding_config.embedding_endpoint_type,
|
|
157
|
+
# embedding_endpoint=config.default_embedding_config.embedding_endpoint,
|
|
158
|
+
# embedding_dim=config.default_embedding_config.embedding_dim,
|
|
159
|
+
# embedding_chunk_size=config.default_embedding_config.embedding_chunk_size,
|
|
160
|
+
# )
|
|
161
|
+
|
|
162
|
+
# if os.getenv("OPENAI_API_KEY"):
|
|
163
|
+
# return EmbeddingConfig.default_config(self.embedding_model if self.embedding_model else "text-embedding-ada-002")
|
|
164
|
+
|
|
165
|
+
# return EmbeddingConfig.default_config("letta")
|
|
137
166
|
|
|
138
167
|
@property
|
|
139
168
|
def letta_pg_uri(self) -> str:
|
|
@@ -165,3 +194,4 @@ class TestSettings(Settings):
|
|
|
165
194
|
# singleton
|
|
166
195
|
settings = Settings(_env_parse_none_str="None")
|
|
167
196
|
test_settings = TestSettings()
|
|
197
|
+
model_settings = ModelSettings()
|
letta/utils.py
CHANGED
|
@@ -1058,7 +1058,12 @@ def create_uuid_from_string(val: str):
|
|
|
1058
1058
|
|
|
1059
1059
|
|
|
1060
1060
|
def json_dumps(data, indent=2):
|
|
1061
|
-
|
|
1061
|
+
def safe_serializer(obj):
|
|
1062
|
+
if isinstance(obj, datetime):
|
|
1063
|
+
return obj.isoformat()
|
|
1064
|
+
raise TypeError(f"Type {type(obj)} not serializable")
|
|
1065
|
+
|
|
1066
|
+
return json.dumps(data, indent=indent, default=safe_serializer, ensure_ascii=False)
|
|
1062
1067
|
|
|
1063
1068
|
|
|
1064
1069
|
def json_loads(data):
|
|
@@ -9,23 +9,23 @@ letta/agent_store/qdrant.py,sha256=qIEJhXJb6GzcT4wp8iV5Ox5W1CFMvcPViTI4HLSh59E,7
|
|
|
9
9
|
letta/agent_store/storage.py,sha256=QWrPdIEJCnsPg1xnPrG1xbOXmbjpz37ZNhvuH52M7A8,6642
|
|
10
10
|
letta/benchmark/benchmark.py,sha256=ebvnwfp3yezaXOQyGXkYCDYpsmre-b9hvNtnyx4xkG0,3701
|
|
11
11
|
letta/benchmark/constants.py,sha256=aXc5gdpMGJT327VuxsT5FngbCK2J41PQYeICBO7g_RE,536
|
|
12
|
-
letta/cli/cli.py,sha256=
|
|
13
|
-
letta/cli/cli_config.py,sha256=
|
|
12
|
+
letta/cli/cli.py,sha256=LYSz_pWjexOCV81doM4WNMMlUGwtF2FCLgBxiY8mgXE,15777
|
|
13
|
+
letta/cli/cli_config.py,sha256=eY4D4SVJJghaatyrmsQw87sQ4NoozokEIeK0jfDJINY,58769
|
|
14
14
|
letta/cli/cli_load.py,sha256=aVlGWiNEUs_eG793HLl7cES-dEIuA1CJfZpT1Cm8Uo4,4591
|
|
15
15
|
letta/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
letta/client/admin.py,sha256=itdH1dGL143Je5tkZl8dQ1PavjepClar3QasxpbX1cI,7397
|
|
17
|
-
letta/client/client.py,sha256=
|
|
17
|
+
letta/client/client.py,sha256=1uKCChE9jdygCDKRb-GvhQqp8rtMB0_aGGBDanRBbq0,84186
|
|
18
18
|
letta/client/streaming.py,sha256=bfWlUu7z7EoPfKxBqIarYxGKyrL7Pj79BlliToqcCgI,4592
|
|
19
19
|
letta/client/utils.py,sha256=NMFts6bFsHTV0yW3BRRo2HSqGr6Gr3tj1kNtkUCgMCA,2262
|
|
20
|
-
letta/config.py,sha256=
|
|
20
|
+
letta/config.py,sha256=j2I90fOh9d9__kOYObwTDLbvVwYR50rIql5nzrvREKg,19161
|
|
21
21
|
letta/configs/anthropic.json,sha256=Buds8qZXR1f_vR1X9e2LxOHIEufAEWFjLovV0g0nbIU,408
|
|
22
22
|
letta/configs/letta_hosted.json,sha256=pMXFCjX2liBeBY1M2Wgu9GwEicN8tveO1VPoNHpWbRc,365
|
|
23
23
|
letta/configs/openai.json,sha256=z0izsHi7vAj_kJrd3XNgxej61HjPIJobABbhvxL0d8g,373
|
|
24
|
-
letta/constants.py,sha256=
|
|
25
|
-
letta/credentials.py,sha256=
|
|
24
|
+
letta/constants.py,sha256=VV6T8O4w4ju8q5CrPCbvPwHlUTltkeFji-r7hz8LTIw,5930
|
|
25
|
+
letta/credentials.py,sha256=a6kMA479oSsZR8ReZ3epLcGjR64fq2IEhjFOget0eF8,5773
|
|
26
26
|
letta/data_sources/connectors.py,sha256=E2rJNqVT4WEvxBqOQl0YgNKa_JQXkG0h1luw_XLcTis,10232
|
|
27
27
|
letta/embeddings.py,sha256=GPF9ILCQT7n71fxyMV8mRjXBSGfUwPLUE88h81UOc5I,8020
|
|
28
|
-
letta/errors.py,sha256=
|
|
28
|
+
letta/errors.py,sha256=6LDbTACVrQU4mwsVYjUatBSgYvbV6qGdDIbZIODbe-Y,2888
|
|
29
29
|
letta/functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
30
|
letta/functions/function_sets/base.py,sha256=N4QmOjL6gDEyOg67ocF6zVKM-NquTo-yXG_T8r18buA,6440
|
|
31
31
|
letta/functions/function_sets/extras.py,sha256=Jik3UiDqYTm4Lam1XPTvuVjvgUHwIAhopsnbmVhGMBg,4732
|
|
@@ -41,18 +41,17 @@ letta/llm_api/anthropic.py,sha256=nxMuLW7kIw6QLZW77M_fH7HSPV-ckFF50DVqvLRRFqg,13
|
|
|
41
41
|
letta/llm_api/azure_openai.py,sha256=NjAVifNpjbTSGa9dZ4lS12sjwRWZBsmB1wlIGD4m4aI,6900
|
|
42
42
|
letta/llm_api/cohere.py,sha256=vDRd-SUGp1t_JUIdwC3RkIhwMl0OY7n-tAU9uPORYkY,14826
|
|
43
43
|
letta/llm_api/google_ai.py,sha256=Ksf4vlYoWRe5JtiPOqxaArDnjUbAS8fxX_zwgt-2buQ,19100
|
|
44
|
-
letta/llm_api/llm_api_tools.py,sha256=
|
|
44
|
+
letta/llm_api/llm_api_tools.py,sha256=08nAcrfnqJa8BoFuKoMJGdyTSBWcRSwWYwe1RJcwx6M,23230
|
|
45
45
|
letta/llm_api/openai.py,sha256=BViGY7gybFgK8qmvVn_HDAHGd_lcWxMRzrzF0imzfdY,21154
|
|
46
46
|
letta/local_llm/README.md,sha256=hFJyw5B0TU2jrh9nb0zGZMgdH-Ei1dSRfhvPQG_NSoU,168
|
|
47
47
|
letta/local_llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
|
-
letta/local_llm/chat_completion_proxy.py,sha256=
|
|
48
|
+
letta/local_llm/chat_completion_proxy.py,sha256=PXgNveahts5DbZ7GVcPShxmrDKropL81PY2JHc31yAA,13091
|
|
49
49
|
letta/local_llm/constants.py,sha256=3WHAOvhdlDQajqSQaLKYMpI24pAwbWJKqS4KhCeb4vQ,1051
|
|
50
50
|
letta/local_llm/function_parser.py,sha256=BlNsGo1VzyfY5KdF_RwjRQNOWIsaudo7o37u1W5eg0s,2626
|
|
51
51
|
letta/local_llm/grammars/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
52
52
|
letta/local_llm/grammars/gbnf_grammar_generator.py,sha256=zrATMMTZ3Trhg3egnk7N7p5qwH90hmfT_TVV7tjabGI,56377
|
|
53
53
|
letta/local_llm/grammars/json.gbnf,sha256=LNnIFYaChKuE7GU9H7tLThVi8vFnZNzrFJYBU7_HVsY,667
|
|
54
54
|
letta/local_llm/grammars/json_func_calls_with_inner_thoughts.gbnf,sha256=aHc_OGwEWhrb0_mAkvDI56C3wxZGep2VqvgoPIQ4Ey4,3255
|
|
55
|
-
letta/local_llm/groq/api.py,sha256=HlIlegv6uS2SkOHrYIY2c91-VHUAbZN71HAsBzotjzg,4268
|
|
56
55
|
letta/local_llm/json_parser.py,sha256=qmZxZxsYP_8y-yEDbkykwTVGuFfv_2uqh3BjzikMlF8,7492
|
|
57
56
|
letta/local_llm/koboldcpp/api.py,sha256=iNUVEec9nS0HPbBuDDENujRvR-_sdWgMcxRnYKNDUSA,2567
|
|
58
57
|
letta/local_llm/koboldcpp/settings.py,sha256=joF5SBRbQnFyzi0oYlj6QKLG5wxp2ODNIcMTsTE4FqE,516
|
|
@@ -82,9 +81,9 @@ letta/local_llm/webui/legacy_api.py,sha256=k3H3y4qp2Fs-XmP24iSIEyvq6wjWFWBzklY3-
|
|
|
82
81
|
letta/local_llm/webui/legacy_settings.py,sha256=BLmd3TSx5StnY3ibjwaxYATPt_Lvq-o1rlcc_-Q1JcU,538
|
|
83
82
|
letta/local_llm/webui/settings.py,sha256=gmLHfiOl1u4JmlAZU2d2O8YKF9lafdakyjwR_ftVPh8,552
|
|
84
83
|
letta/log.py,sha256=QHquDnL7oUAvdKlAwUlCK9zXKDMUjrU9WA0bxnMsP0Y,2101
|
|
85
|
-
letta/main.py,sha256=
|
|
84
|
+
letta/main.py,sha256=szOwPfU6O8Lyy8kP5dtB385v8EWOKfo0fz0-ss-aT3Y,18495
|
|
86
85
|
letta/memory.py,sha256=6q1x3-PY-PeXzAt6hvP-UF1ajvroPZ7XW-5nLy-JhMo,17657
|
|
87
|
-
letta/metadata.py,sha256
|
|
86
|
+
letta/metadata.py,sha256=gD67ZO2nhjcLbG2qUfALTo3SLac6I-c1iYpCGrGX7GE,33153
|
|
88
87
|
letta/openai_backcompat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
89
88
|
letta/openai_backcompat/openai_object.py,sha256=Y1ZS1sATP60qxJiOsjOP3NbwSzuzvkNAvb3DeuhM5Uk,13490
|
|
90
89
|
letta/persistence_manager.py,sha256=LlLgEDpSafCPAiyKmuq0NvVAnfBkZo6TWbGIKYQjQBs,5200
|
|
@@ -108,10 +107,11 @@ letta/prompts/system/memgpt_doc.txt,sha256=AsT55NOORoH-K-p0fxklrDRZ3qHs4MIKMuR-M
|
|
|
108
107
|
letta/prompts/system/memgpt_gpt35_extralong.txt,sha256=FheNhYoIzNz6qnJKhVquZVSMj3HduC48reFaX7Pf7ig,5046
|
|
109
108
|
letta/prompts/system/memgpt_intuitive_knowledge.txt,sha256=sA7c3urYqREVnSBI81nTGImXAekqC0Fxc7RojFqud1g,2966
|
|
110
109
|
letta/prompts/system/memgpt_modified_chat.txt,sha256=HOaPVurEftD8KsuwsclDgE2afIfklMjxhuSO96q1-6I,4656
|
|
110
|
+
letta/providers.py,sha256=D2rpjphebGiqQqnx1j8t9_P1QHuH7_a_kvru5hcuG1I,7680
|
|
111
111
|
letta/pytest.ini,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
112
112
|
letta/schemas/agent.py,sha256=OUnKIKK2WRtXp5F9tGiaWL-h80Ep5LZFK0K85vulzr4,5856
|
|
113
113
|
letta/schemas/api_key.py,sha256=u07yzzMn-hBAHZIIKbWY16KsgiFjSNR8lAghpMUo3_4,682
|
|
114
|
-
letta/schemas/block.py,sha256=
|
|
114
|
+
letta/schemas/block.py,sha256=1_GwFtfykloYU4Mp2DV3-DqkvsKo79Mu3LAzVYOgMzk,3998
|
|
115
115
|
letta/schemas/document.py,sha256=JpvU0YkvOVLvHaDNcg-ihFzpeHC2zqsWBgyJ6zHnfNw,745
|
|
116
116
|
letta/schemas/embedding_config.py,sha256=KhEOStOD8VbHFyLI9pkQVbTG1Av2g-Ql0yf9M868LME,2570
|
|
117
117
|
letta/schemas/enums.py,sha256=WfRYpLh_pD-VyhEnp3Y6pPfx063zq2o4jky6PulqO8w,629
|
|
@@ -119,11 +119,11 @@ letta/schemas/health.py,sha256=zT6mYovvD17iJRuu2rcaQQzbEEYrkwvAE9TB7iU824c,139
|
|
|
119
119
|
letta/schemas/job.py,sha256=bYDrjbJm2B4LUTSkLUdQR_HDhL2E23g0EHf7E23ezYU,1547
|
|
120
120
|
letta/schemas/letta_base.py,sha256=4QXFgyjCHqIagi8B6_4nmqb9eoJ52Y6aCxBxQpGX48M,2832
|
|
121
121
|
letta/schemas/letta_message.py,sha256=Slgxa59qZfdvqXuCVHOt03u-7JL456ZY-WLaK5UYYKU,6234
|
|
122
|
-
letta/schemas/letta_request.py,sha256=
|
|
123
|
-
letta/schemas/letta_response.py,sha256=
|
|
124
|
-
letta/schemas/llm_config.py,sha256
|
|
122
|
+
letta/schemas/letta_request.py,sha256=Fv4hZKLMefCISwxuElXB0vsGDjqnzZuCbCbHPUPTirQ,1852
|
|
123
|
+
letta/schemas/letta_response.py,sha256=_UJoO3UtC3F5DtQCHzdiGM1SHNPYPKvopIWqg8t5YZw,1564
|
|
124
|
+
letta/schemas/llm_config.py,sha256=UE49Sg1gxiAqYQ3l6QUdMMfT7GOflztx6mDsR9KTcQE,2501
|
|
125
125
|
letta/schemas/memory.py,sha256=mDJbe9mzTw0HSn6tiouC3z32r-8Fc_EaeqxDy_hXf0U,9327
|
|
126
|
-
letta/schemas/message.py,sha256=
|
|
126
|
+
letta/schemas/message.py,sha256=1C6lz4yvMTusE8zORKbi_BKnb_X_-RuUvdpM5YeZ21o,33409
|
|
127
127
|
letta/schemas/openai/chat_completion_request.py,sha256=Fa7xnSnG7WUQounJhnDu0fTSxoR6xOAh2bODuqmfypI,3345
|
|
128
128
|
letta/schemas/openai/chat_completion_response.py,sha256=9i-ckINar697u9kBYltd7Hs1JvF6DmQYuVgVXoTzAY4,3846
|
|
129
129
|
letta/schemas/openai/chat_completions.py,sha256=V0ZPIIk-ds3O6MAkNHMz8zh1hqMFSPrTcYr88WDYzWE,3588
|
|
@@ -142,11 +142,11 @@ letta/server/rest_api/admin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
|
|
|
142
142
|
letta/server/rest_api/admin/agents.py,sha256=cFNDU4Z8wGpcWXuo5aBgX6CcxLzPpTFYnTIaiF-3qvw,564
|
|
143
143
|
letta/server/rest_api/admin/tools.py,sha256=gZfngjH27PGT1pDw2PUZpenbdJG21xK2IIO-YSitn3o,3183
|
|
144
144
|
letta/server/rest_api/admin/users.py,sha256=IIec8G2yxVZtSo8dYrQPktVj8XIsZMptxigxmgULKO8,3480
|
|
145
|
-
letta/server/rest_api/app.py,sha256=
|
|
145
|
+
letta/server/rest_api/app.py,sha256=QF9Jl1H8_6OpMtJslbQJLtH584GQprfovp3p7MwEor8,6845
|
|
146
146
|
letta/server/rest_api/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
147
147
|
letta/server/rest_api/auth/index.py,sha256=fQBGyVylGSRfEMLQ17cZzrHd5Y1xiVylvPqH5Rl-lXQ,1378
|
|
148
148
|
letta/server/rest_api/auth_token.py,sha256=725EFEIiNj4dh70hrSd94UysmFD8vcJLrTRfNHkzxDo,774
|
|
149
|
-
letta/server/rest_api/interface.py,sha256=
|
|
149
|
+
letta/server/rest_api/interface.py,sha256=s_XyR6SRU1F2KpKbjtnv9zPHyXKgXvY4_mn2KtlyAMc,35606
|
|
150
150
|
letta/server/rest_api/routers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
151
151
|
letta/server/rest_api/routers/openai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
152
152
|
letta/server/rest_api/routers/openai/assistants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -156,23 +156,23 @@ letta/server/rest_api/routers/openai/assistants/threads.py,sha256=5-5XsbEDLIZ_xy
|
|
|
156
156
|
letta/server/rest_api/routers/openai/chat_completions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
157
157
|
letta/server/rest_api/routers/openai/chat_completions/chat_completions.py,sha256=5RxCClOm0JCDzLAbh1K8C-dGIrERKUxC4DJPlMcPcgw,4758
|
|
158
158
|
letta/server/rest_api/routers/v1/__init__.py,sha256=sqlVZa-u9DJwdRsp0_8YUGrac9DHguIB4wETlEDRylA,666
|
|
159
|
-
letta/server/rest_api/routers/v1/agents.py,sha256=
|
|
159
|
+
letta/server/rest_api/routers/v1/agents.py,sha256=cBlaV8zZCxlAnO49wWQBZY-sXd7NQ3XFMzctW_BljlQ,21411
|
|
160
160
|
letta/server/rest_api/routers/v1/blocks.py,sha256=xY-9k2e2dTRsU9Zh-kT164Z977O0Ed_YYBjLaWKbDpE,2293
|
|
161
161
|
letta/server/rest_api/routers/v1/health.py,sha256=pKCuVESlVOhGIb4VC4K-H82eZqfghmT6kvj2iOkkKuc,401
|
|
162
162
|
letta/server/rest_api/routers/v1/jobs.py,sha256=YHEKALAkSCvF_gzIhvsTkqaLdIhFBYrTNmwCtnzohhM,1574
|
|
163
|
-
letta/server/rest_api/routers/v1/llms.py,sha256=
|
|
163
|
+
letta/server/rest_api/routers/v1/llms.py,sha256=TcyvSx6MEM3je5F4DysL7ligmssL_pFlJaaO4uL95VY,877
|
|
164
164
|
letta/server/rest_api/routers/v1/organizations.py,sha256=i3S9E1hu2Zj9g0pRv6wnQhz1VJ_RMIHCrGzgwY-Wj3Y,1945
|
|
165
165
|
letta/server/rest_api/routers/v1/sources.py,sha256=H2cfoiHcWxmHUhiSJ5s2Ty0I3W7Ex7DfdEkS9d7Ejos,6272
|
|
166
166
|
letta/server/rest_api/routers/v1/tools.py,sha256=nKiPO4S9NwxZEQ6wSPBROiNdQtvoxqlEDjk3gBe_Bdk,2729
|
|
167
167
|
letta/server/rest_api/routers/v1/users.py,sha256=Y2rDvHOG1B5FLSOjutY3R22vt48IngbZ-9h8CohG5rc,3378
|
|
168
168
|
letta/server/rest_api/static_files.py,sha256=NG8sN4Z5EJ8JVQdj19tkFa9iQ1kBPTab9f_CUxd_u4Q,3143
|
|
169
169
|
letta/server/rest_api/utils.py,sha256=Fc2ZGKzLaBa2sEtSTVjJ8D5M0xIwsWC0CVAOIJaD3rY,2176
|
|
170
|
-
letta/server/server.py,sha256=
|
|
170
|
+
letta/server/server.py,sha256=tnquG6ba8EoMub-_Rsj0QE0zffGc30EipUnvq7nFvEI,81781
|
|
171
171
|
letta/server/startup.sh,sha256=jeGV7B_PS0hS-tT6o6GpACrUbV9WV1NI2L9aLoUDDtc,311
|
|
172
|
-
letta/server/static_files/assets/index-
|
|
173
|
-
letta/server/static_files/assets/index-
|
|
172
|
+
letta/server/static_files/assets/index-3ab03d5b.css,sha256=OrA9W4iKJ5h2Wlr7GwdAT4wow0CM8hVit1yOxEL49Qw,54295
|
|
173
|
+
letta/server/static_files/assets/index-9a9c449b.js,sha256=qoWUq6_kuLhE9NFkNeCBptgq-oERW46r0tB3JlWe_qc,1818951
|
|
174
174
|
letta/server/static_files/favicon.ico,sha256=DezhLdFSbM8o81wCOZcV3riq7tFUOGQD4h6-vr-HuU0,342
|
|
175
|
-
letta/server/static_files/index.html,sha256=
|
|
175
|
+
letta/server/static_files/index.html,sha256=NR2p31u83BVYw0m92tPB24GK0_HopWpQARoGafN7nNI,1198
|
|
176
176
|
letta/server/static_files/memgpt_logo_transparent.png,sha256=7l6niNb4MlUILxLlUZPxIE1TEHj_Z9f9XDxoST3d7Vw,85383
|
|
177
177
|
letta/server/utils.py,sha256=rRvW6L1lzau4u9boamiyZH54lf5tQ91ypXzUW9cfSPA,1667
|
|
178
178
|
letta/server/ws_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -180,12 +180,12 @@ letta/server/ws_api/example_client.py,sha256=95AA5UFgTlNJ0FUQkLxli8dKNx48MNm3eWG
|
|
|
180
180
|
letta/server/ws_api/interface.py,sha256=TWl9vkcMCnLsUtgsuENZ-ku2oMDA-OUTzLh_yNRoMa4,4120
|
|
181
181
|
letta/server/ws_api/protocol.py,sha256=M_-gM5iuDBwa1cuN2IGNCG5GxMJwU2d3XW93XALv9s8,1821
|
|
182
182
|
letta/server/ws_api/server.py,sha256=C2Kv48PCwl46DQFb0ZP30s86KJLQ6dZk2AhWQEZn9pY,6004
|
|
183
|
-
letta/settings.py,sha256=
|
|
183
|
+
letta/settings.py,sha256=8rJayHBCsM_3TgrBhyVXkHEVVDaJgObpyfYvhrhu6pg,7148
|
|
184
184
|
letta/streaming_interface.py,sha256=LPY1NmXtptcjdHrfVOOKL4-v3AyUD8SIyQMt1Dypd1A,15532
|
|
185
185
|
letta/system.py,sha256=buKYPqG5n2x41hVmWpu6JUpyd7vTWED9Km2_M7dLrvk,6960
|
|
186
|
-
letta/utils.py,sha256=
|
|
187
|
-
letta_nightly-0.4.1.
|
|
188
|
-
letta_nightly-0.4.1.
|
|
189
|
-
letta_nightly-0.4.1.
|
|
190
|
-
letta_nightly-0.4.1.
|
|
191
|
-
letta_nightly-0.4.1.
|
|
186
|
+
letta/utils.py,sha256=neUs7mxNfndzRL5XUxerr8Lic6w7qnyyvf8FBwMnyWw,30852
|
|
187
|
+
letta_nightly-0.4.1.dev20241006104046.dist-info/LICENSE,sha256=mExtuZ_GYJgDEI38GWdiEYZizZS4KkVt2SF1g_GPNhI,10759
|
|
188
|
+
letta_nightly-0.4.1.dev20241006104046.dist-info/METADATA,sha256=VYOnVMciVBp01ELJmJ0FmMp-lNE9eX7NUeq79q7PEZQ,5967
|
|
189
|
+
letta_nightly-0.4.1.dev20241006104046.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
190
|
+
letta_nightly-0.4.1.dev20241006104046.dist-info/entry_points.txt,sha256=2zdiyGNEZGV5oYBuS-y2nAAgjDgcC9yM_mHJBFSRt5U,40
|
|
191
|
+
letta_nightly-0.4.1.dev20241006104046.dist-info/RECORD,,
|
letta/local_llm/groq/api.py
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
from typing import Tuple
|
|
2
|
-
from urllib.parse import urljoin
|
|
3
|
-
|
|
4
|
-
from letta.local_llm.settings.settings import get_completions_settings
|
|
5
|
-
from letta.local_llm.utils import post_json_auth_request
|
|
6
|
-
from letta.utils import count_tokens
|
|
7
|
-
|
|
8
|
-
API_CHAT_SUFFIX = "/v1/chat/completions"
|
|
9
|
-
# LMSTUDIO_API_COMPLETIONS_SUFFIX = "/v1/completions"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def get_groq_completion(endpoint: str, auth_type: str, auth_key: str, model: str, prompt: str, context_window: int) -> Tuple[str, dict]:
|
|
13
|
-
"""TODO no support for function calling OR raw completions, so we need to route the request into /chat/completions instead"""
|
|
14
|
-
from letta.utils import printd
|
|
15
|
-
|
|
16
|
-
prompt_tokens = count_tokens(prompt)
|
|
17
|
-
if prompt_tokens > context_window:
|
|
18
|
-
raise Exception(f"Request exceeds maximum context length ({prompt_tokens} > {context_window} tokens)")
|
|
19
|
-
|
|
20
|
-
settings = get_completions_settings()
|
|
21
|
-
settings.update(
|
|
22
|
-
{
|
|
23
|
-
# see https://console.groq.com/docs/text-chat, supports:
|
|
24
|
-
# "temperature": ,
|
|
25
|
-
# "max_tokens": ,
|
|
26
|
-
# "top_p",
|
|
27
|
-
# "stream",
|
|
28
|
-
# "stop",
|
|
29
|
-
# Groq only allows 4 stop tokens
|
|
30
|
-
"stop": [
|
|
31
|
-
"\nUSER",
|
|
32
|
-
"\nASSISTANT",
|
|
33
|
-
"\nFUNCTION",
|
|
34
|
-
# "\nFUNCTION RETURN",
|
|
35
|
-
# "<|im_start|>",
|
|
36
|
-
# "<|im_end|>",
|
|
37
|
-
# "<|im_sep|>",
|
|
38
|
-
# # airoboros specific
|
|
39
|
-
# "\n### ",
|
|
40
|
-
# # '\n' +
|
|
41
|
-
# # '</s>',
|
|
42
|
-
# # '<|',
|
|
43
|
-
# "\n#",
|
|
44
|
-
# # "\n\n\n",
|
|
45
|
-
# # prevent chaining function calls / multi json objects / run-on generations
|
|
46
|
-
# # NOTE: this requires the ability to patch the extra '}}' back into the prompt
|
|
47
|
-
" }\n}\n",
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
URI = urljoin(endpoint.strip("/") + "/", API_CHAT_SUFFIX.strip("/"))
|
|
53
|
-
|
|
54
|
-
# Settings for the generation, includes the prompt + stop tokens, max length, etc
|
|
55
|
-
request = settings
|
|
56
|
-
request["model"] = model
|
|
57
|
-
request["max_tokens"] = context_window
|
|
58
|
-
# NOTE: Hack for chat/completion-only endpoints: put the entire completion string inside the first message
|
|
59
|
-
message_structure = [{"role": "user", "content": prompt}]
|
|
60
|
-
request["messages"] = message_structure
|
|
61
|
-
|
|
62
|
-
if not endpoint.startswith(("http://", "https://")):
|
|
63
|
-
raise ValueError(f"Provided OPENAI_API_BASE value ({endpoint}) must begin with http:// or https://")
|
|
64
|
-
|
|
65
|
-
try:
|
|
66
|
-
response = post_json_auth_request(uri=URI, json_payload=request, auth_type=auth_type, auth_key=auth_key)
|
|
67
|
-
if response.status_code == 200:
|
|
68
|
-
result_full = response.json()
|
|
69
|
-
printd(f"JSON API response:\n{result_full}")
|
|
70
|
-
result = result_full["choices"][0]["message"]["content"]
|
|
71
|
-
usage = result_full.get("usage", None)
|
|
72
|
-
else:
|
|
73
|
-
# Example error: msg={"error":"Context length exceeded. Tokens in context: 8000, Context length: 8000"}
|
|
74
|
-
if "context length" in str(response.text).lower():
|
|
75
|
-
# "exceeds context length" is what appears in the LM Studio error message
|
|
76
|
-
# raise an alternate exception that matches OpenAI's message, which is "maximum context length"
|
|
77
|
-
raise Exception(f"Request exceeds maximum context length (code={response.status_code}, msg={response.text}, URI={URI})")
|
|
78
|
-
else:
|
|
79
|
-
raise Exception(
|
|
80
|
-
f"API call got non-200 response code (code={response.status_code}, msg={response.text}) for address: {URI}."
|
|
81
|
-
+ f" Make sure that the inference server is running and reachable at {URI}."
|
|
82
|
-
)
|
|
83
|
-
except:
|
|
84
|
-
# TODO handle gracefully
|
|
85
|
-
raise
|
|
86
|
-
|
|
87
|
-
# Pass usage statistics back to main thread
|
|
88
|
-
# These are used to compute memory warning messages
|
|
89
|
-
completion_tokens = usage.get("completion_tokens", None) if usage is not None else None
|
|
90
|
-
total_tokens = prompt_tokens + completion_tokens if completion_tokens is not None else None
|
|
91
|
-
usage = {
|
|
92
|
-
"prompt_tokens": prompt_tokens, # can grab from usage dict, but it's usually wrong (set to 0)
|
|
93
|
-
"completion_tokens": completion_tokens,
|
|
94
|
-
"total_tokens": total_tokens,
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return result, usage
|