letta-nightly 0.5.2.dev20241107104040__py3-none-any.whl → 0.5.2.dev20241108104049__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/server/generate_openapi_schema.sh +12 -0
- letta/server/rest_api/app.py +32 -28
- letta/server/startup.sh +9 -3
- {letta_nightly-0.5.2.dev20241107104040.dist-info → letta_nightly-0.5.2.dev20241108104049.dist-info}/METADATA +1 -1
- {letta_nightly-0.5.2.dev20241107104040.dist-info → letta_nightly-0.5.2.dev20241108104049.dist-info}/RECORD +8 -7
- {letta_nightly-0.5.2.dev20241107104040.dist-info → letta_nightly-0.5.2.dev20241108104049.dist-info}/LICENSE +0 -0
- {letta_nightly-0.5.2.dev20241107104040.dist-info → letta_nightly-0.5.2.dev20241108104049.dist-info}/WHEEL +0 -0
- {letta_nightly-0.5.2.dev20241107104040.dist-info → letta_nightly-0.5.2.dev20241108104049.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
echo "Generating OpenAPI schema..."
|
|
3
|
+
|
|
4
|
+
# check if poetry is installed
|
|
5
|
+
if ! command -v poetry &> /dev/null
|
|
6
|
+
then
|
|
7
|
+
echo "Poetry could not be found. Please install poetry to generate the OpenAPI schema."
|
|
8
|
+
exit
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
# generate OpenAPI schema
|
|
12
|
+
poetry run python -c 'from letta.server.rest_api.app import app, generate_openapi_schema; generate_openapi_schema(app);'
|
letta/server/rest_api/app.py
CHANGED
|
@@ -63,6 +63,37 @@ from fastapi import FastAPI
|
|
|
63
63
|
log = logging.getLogger("uvicorn")
|
|
64
64
|
|
|
65
65
|
|
|
66
|
+
def generate_openapi_schema(app: FastAPI):
|
|
67
|
+
# Update the OpenAPI schema
|
|
68
|
+
if not app.openapi_schema:
|
|
69
|
+
app.openapi_schema = app.openapi()
|
|
70
|
+
|
|
71
|
+
openai_docs, letta_docs = [app.openapi_schema.copy() for _ in range(2)]
|
|
72
|
+
|
|
73
|
+
openai_docs["paths"] = {k: v for k, v in openai_docs["paths"].items() if k.startswith("/openai")}
|
|
74
|
+
openai_docs["info"]["title"] = "OpenAI Assistants API"
|
|
75
|
+
letta_docs["paths"] = {k: v for k, v in letta_docs["paths"].items() if not k.startswith("/openai")}
|
|
76
|
+
letta_docs["info"]["title"] = "Letta API"
|
|
77
|
+
letta_docs["components"]["schemas"]["LettaResponse"] = {
|
|
78
|
+
"properties": LettaResponse.model_json_schema(ref_template="#/components/schemas/LettaResponse/properties/{model}")["$defs"]
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
# Split the API docs into Letta API, and OpenAI Assistants compatible API
|
|
82
|
+
for name, docs in [
|
|
83
|
+
(
|
|
84
|
+
"openai",
|
|
85
|
+
openai_docs,
|
|
86
|
+
),
|
|
87
|
+
(
|
|
88
|
+
"letta",
|
|
89
|
+
letta_docs,
|
|
90
|
+
),
|
|
91
|
+
]:
|
|
92
|
+
if settings.cors_origins:
|
|
93
|
+
docs["servers"] = [{"url": host} for host in settings.cors_origins]
|
|
94
|
+
Path(f"openapi_{name}.json").write_text(json.dumps(docs, indent=2))
|
|
95
|
+
|
|
96
|
+
|
|
66
97
|
def create_application() -> "FastAPI":
|
|
67
98
|
"""the application start routine"""
|
|
68
99
|
# global server
|
|
@@ -122,34 +153,7 @@ def create_application() -> "FastAPI":
|
|
|
122
153
|
|
|
123
154
|
# Tool.load_default_tools(get_db_session())
|
|
124
155
|
|
|
125
|
-
|
|
126
|
-
if not app.openapi_schema:
|
|
127
|
-
app.openapi_schema = app.openapi()
|
|
128
|
-
|
|
129
|
-
openai_docs, letta_docs = [app.openapi_schema.copy() for _ in range(2)]
|
|
130
|
-
|
|
131
|
-
openai_docs["paths"] = {k: v for k, v in openai_docs["paths"].items() if k.startswith("/openai")}
|
|
132
|
-
openai_docs["info"]["title"] = "OpenAI Assistants API"
|
|
133
|
-
letta_docs["paths"] = {k: v for k, v in letta_docs["paths"].items() if not k.startswith("/openai")}
|
|
134
|
-
letta_docs["info"]["title"] = "Letta API"
|
|
135
|
-
letta_docs["components"]["schemas"]["LettaResponse"] = {
|
|
136
|
-
"properties": LettaResponse.model_json_schema(ref_template="#/components/schemas/LettaResponse/properties/{model}")["$defs"]
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
# Split the API docs into Letta API, and OpenAI Assistants compatible API
|
|
140
|
-
for name, docs in [
|
|
141
|
-
(
|
|
142
|
-
"openai",
|
|
143
|
-
openai_docs,
|
|
144
|
-
),
|
|
145
|
-
(
|
|
146
|
-
"letta",
|
|
147
|
-
letta_docs,
|
|
148
|
-
),
|
|
149
|
-
]:
|
|
150
|
-
if settings.cors_origins:
|
|
151
|
-
docs["servers"] = [{"url": host} for host in settings.cors_origins]
|
|
152
|
-
Path(f"openapi_{name}.json").write_text(json.dumps(docs, indent=2))
|
|
156
|
+
generate_openapi_schema(app)
|
|
153
157
|
|
|
154
158
|
@app.on_event("shutdown")
|
|
155
159
|
def on_shutdown():
|
letta/server/startup.sh
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
|
-
echo "Starting
|
|
2
|
+
echo "Starting Letta server at http://localhost:8283"
|
|
3
3
|
|
|
4
|
-
alembic upgrade
|
|
4
|
+
# Check if LETTA_PG_URI or LETTA_PG_DB is set and run alembic upgrade if either is
|
|
5
|
+
if [ -n "$LETTA_PG_URI" ] || [ -n "$LETTA_PG_DB" ]; then
|
|
6
|
+
echo "LETTA_PG_URI or LETTA_PG_DB is set, running alembic upgrade head"
|
|
7
|
+
alembic upgrade head
|
|
8
|
+
fi
|
|
5
9
|
|
|
6
|
-
if [ "$MEMGPT_ENVIRONMENT" = "DEVELOPMENT" ]
|
|
10
|
+
if [ "$MEMGPT_ENVIRONMENT" = "DEVELOPMENT" ]; then
|
|
7
11
|
echo "Starting in development mode!"
|
|
8
12
|
uvicorn letta.server.rest_api.app:app --reload --reload-dir /letta --host 0.0.0.0 --port 8283
|
|
9
13
|
else
|
|
14
|
+
# Production start command here (replace with the actual production command)
|
|
15
|
+
echo "Starting in production mode!"
|
|
10
16
|
uvicorn letta.server.rest_api.app:app --host 0.0.0.0 --port 8283
|
|
11
17
|
fi
|
|
@@ -155,8 +155,9 @@ letta/schemas/usage.py,sha256=lvn1ooHwLEdv6gwQpw5PBUbcwn_gwdT6HA-fCiix6sY,817
|
|
|
155
155
|
letta/schemas/user.py,sha256=V32Tgl6oqB3KznkxUz12y7agkQicjzW7VocSpj78i6Q,1526
|
|
156
156
|
letta/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
157
157
|
letta/server/constants.py,sha256=yAdGbLkzlOU_dLTx0lKDmAnj0ZgRXCEaIcPJWO69eaE,92
|
|
158
|
+
letta/server/generate_openapi_schema.sh,sha256=0OtBhkC1g6CobVmNEd_m2B6sTdppjbJLXaM95icejvE,371
|
|
158
159
|
letta/server/rest_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
159
|
-
letta/server/rest_api/app.py,sha256=
|
|
160
|
+
letta/server/rest_api/app.py,sha256=YwBC6ox8CY9XH9joiX8J--9zGYXSaGGH2OR7EeozbTU,6697
|
|
160
161
|
letta/server/rest_api/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
161
162
|
letta/server/rest_api/auth/index.py,sha256=fQBGyVylGSRfEMLQ17cZzrHd5Y1xiVylvPqH5Rl-lXQ,1378
|
|
162
163
|
letta/server/rest_api/auth_token.py,sha256=725EFEIiNj4dh70hrSd94UysmFD8vcJLrTRfNHkzxDo,774
|
|
@@ -182,7 +183,7 @@ letta/server/rest_api/routers/v1/users.py,sha256=M1wEr2IyHzuRwINYxLXTkrbAH3osLe_
|
|
|
182
183
|
letta/server/rest_api/static_files.py,sha256=NG8sN4Z5EJ8JVQdj19tkFa9iQ1kBPTab9f_CUxd_u4Q,3143
|
|
183
184
|
letta/server/rest_api/utils.py,sha256=GdHYCzXtbM5VCAYDPR0z5gnNZpRhwPld2BGZV7xT6cU,2924
|
|
184
185
|
letta/server/server.py,sha256=fOhR-Do3_56R6x5BTV9U1ZbgedSd2oR6Gu76cwaj6cg,80783
|
|
185
|
-
letta/server/startup.sh,sha256=
|
|
186
|
+
letta/server/startup.sh,sha256=wTOQOJJZw_Iec57WIu0UW0AVflk0ZMWYZWg8D3T_gSQ,698
|
|
186
187
|
letta/server/static_files/assets/index-3ab03d5b.css,sha256=OrA9W4iKJ5h2Wlr7GwdAT4wow0CM8hVit1yOxEL49Qw,54295
|
|
187
188
|
letta/server/static_files/assets/index-9fa459a2.js,sha256=j2oMcDJO9dWJaH5e-tsflbVpWK20gLWpZKJk4-Kuy6A,1815592
|
|
188
189
|
letta/server/static_files/favicon.ico,sha256=DezhLdFSbM8o81wCOZcV3riq7tFUOGQD4h6-vr-HuU0,342
|
|
@@ -204,8 +205,8 @@ letta/streaming_interface.py,sha256=_FPUWy58j50evHcpXyd7zB1wWqeCc71NCFeWh_TBvnw,
|
|
|
204
205
|
letta/streaming_utils.py,sha256=329fsvj1ZN0r0LpQtmMPZ2vSxkDBIUUwvGHZFkjm2I8,11745
|
|
205
206
|
letta/system.py,sha256=buKYPqG5n2x41hVmWpu6JUpyd7vTWED9Km2_M7dLrvk,6960
|
|
206
207
|
letta/utils.py,sha256=SXLEYhyp3gHyIjrxNIKNZZ5ittKo3KOj6zxgC_Trex0,31012
|
|
207
|
-
letta_nightly-0.5.2.
|
|
208
|
-
letta_nightly-0.5.2.
|
|
209
|
-
letta_nightly-0.5.2.
|
|
210
|
-
letta_nightly-0.5.2.
|
|
211
|
-
letta_nightly-0.5.2.
|
|
208
|
+
letta_nightly-0.5.2.dev20241108104049.dist-info/LICENSE,sha256=mExtuZ_GYJgDEI38GWdiEYZizZS4KkVt2SF1g_GPNhI,10759
|
|
209
|
+
letta_nightly-0.5.2.dev20241108104049.dist-info/METADATA,sha256=24MGy-xgrO9dYlPXhhKglmLNoeoPuciLG4FRIs8fs0g,11024
|
|
210
|
+
letta_nightly-0.5.2.dev20241108104049.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
211
|
+
letta_nightly-0.5.2.dev20241108104049.dist-info/entry_points.txt,sha256=2zdiyGNEZGV5oYBuS-y2nAAgjDgcC9yM_mHJBFSRt5U,40
|
|
212
|
+
letta_nightly-0.5.2.dev20241108104049.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|