arize-phoenix 12.3.0__py3-none-any.whl → 12.4.0__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 arize-phoenix might be problematic. Click here for more details.
- {arize_phoenix-12.3.0.dist-info → arize_phoenix-12.4.0.dist-info}/METADATA +2 -1
- {arize_phoenix-12.3.0.dist-info → arize_phoenix-12.4.0.dist-info}/RECORD +37 -37
- phoenix/auth.py +19 -0
- phoenix/config.py +302 -53
- phoenix/db/README.md +546 -28
- phoenix/server/api/routers/auth.py +21 -30
- phoenix/server/api/routers/oauth2.py +213 -24
- phoenix/server/api/routers/v1/__init__.py +2 -3
- phoenix/server/api/routers/v1/annotation_configs.py +12 -29
- phoenix/server/api/routers/v1/annotations.py +21 -22
- phoenix/server/api/routers/v1/datasets.py +38 -56
- phoenix/server/api/routers/v1/documents.py +2 -3
- phoenix/server/api/routers/v1/evaluations.py +12 -24
- phoenix/server/api/routers/v1/experiment_evaluations.py +2 -3
- phoenix/server/api/routers/v1/experiment_runs.py +9 -10
- phoenix/server/api/routers/v1/experiments.py +16 -17
- phoenix/server/api/routers/v1/projects.py +15 -21
- phoenix/server/api/routers/v1/prompts.py +30 -31
- phoenix/server/api/routers/v1/sessions.py +2 -5
- phoenix/server/api/routers/v1/spans.py +35 -26
- phoenix/server/api/routers/v1/traces.py +11 -19
- phoenix/server/api/routers/v1/users.py +14 -23
- phoenix/server/api/routers/v1/utils.py +3 -7
- phoenix/server/app.py +1 -2
- phoenix/server/authorization.py +2 -3
- phoenix/server/bearer_auth.py +4 -5
- phoenix/server/oauth2.py +172 -5
- phoenix/server/static/.vite/manifest.json +9 -9
- phoenix/server/static/assets/{components-Bs8eJEpU.js → components-BvsExS75.js} +110 -120
- phoenix/server/static/assets/{index-C6WEu5UP.js → index-iq8WDxat.js} +1 -1
- phoenix/server/static/assets/{pages-D-n2pkoG.js → pages-Ckg4SLQ9.js} +4 -4
- phoenix/trace/attributes.py +80 -13
- phoenix/version.py +1 -1
- {arize_phoenix-12.3.0.dist-info → arize_phoenix-12.4.0.dist-info}/WHEEL +0 -0
- {arize_phoenix-12.3.0.dist-info → arize_phoenix-12.4.0.dist-info}/entry_points.txt +0 -0
- {arize_phoenix-12.3.0.dist-info → arize_phoenix-12.4.0.dist-info}/licenses/IP_NOTICE +0 -0
- {arize_phoenix-12.3.0.dist-info → arize_phoenix-12.4.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -15,12 +15,6 @@ from starlette.background import BackgroundTask
|
|
|
15
15
|
from starlette.datastructures import State
|
|
16
16
|
from starlette.requests import Request
|
|
17
17
|
from starlette.responses import Response, StreamingResponse
|
|
18
|
-
from starlette.status import (
|
|
19
|
-
HTTP_204_NO_CONTENT,
|
|
20
|
-
HTTP_404_NOT_FOUND,
|
|
21
|
-
HTTP_415_UNSUPPORTED_MEDIA_TYPE,
|
|
22
|
-
HTTP_422_UNPROCESSABLE_ENTITY,
|
|
23
|
-
)
|
|
24
18
|
from typing_extensions import TypeAlias
|
|
25
19
|
|
|
26
20
|
import phoenix.trace.v1 as pb
|
|
@@ -50,16 +44,16 @@ router = APIRouter(tags=["traces"], include_in_schema=True)
|
|
|
50
44
|
dependencies=[Depends(is_not_locked)],
|
|
51
45
|
operation_id="addEvaluations",
|
|
52
46
|
summary="Add span, trace, or document evaluations",
|
|
53
|
-
status_code=
|
|
47
|
+
status_code=204,
|
|
54
48
|
responses=add_errors_to_responses(
|
|
55
49
|
[
|
|
56
50
|
{
|
|
57
|
-
"status_code":
|
|
51
|
+
"status_code": 415,
|
|
58
52
|
"description": (
|
|
59
53
|
"Unsupported content type, only gzipped protobuf and pandas-arrow are supported"
|
|
60
54
|
),
|
|
61
55
|
},
|
|
62
|
-
|
|
56
|
+
422,
|
|
63
57
|
]
|
|
64
58
|
),
|
|
65
59
|
openapi_extra={
|
|
@@ -80,27 +74,21 @@ async def post_evaluations(
|
|
|
80
74
|
if content_type == "application/x-pandas-arrow":
|
|
81
75
|
return await _process_pyarrow(request)
|
|
82
76
|
if content_type != "application/x-protobuf":
|
|
83
|
-
raise HTTPException(
|
|
84
|
-
detail="Unsupported content type", status_code=HTTP_415_UNSUPPORTED_MEDIA_TYPE
|
|
85
|
-
)
|
|
77
|
+
raise HTTPException(detail="Unsupported content type", status_code=415)
|
|
86
78
|
body = await request.body()
|
|
87
79
|
if content_encoding == "gzip":
|
|
88
80
|
body = gzip.decompress(body)
|
|
89
81
|
elif content_encoding:
|
|
90
|
-
raise HTTPException(
|
|
91
|
-
detail="Unsupported content encoding", status_code=HTTP_415_UNSUPPORTED_MEDIA_TYPE
|
|
92
|
-
)
|
|
82
|
+
raise HTTPException(detail="Unsupported content encoding", status_code=415)
|
|
93
83
|
evaluation = pb.Evaluation()
|
|
94
84
|
try:
|
|
95
85
|
evaluation.ParseFromString(body)
|
|
96
86
|
except DecodeError:
|
|
97
|
-
raise HTTPException(
|
|
98
|
-
detail="Request body is invalid", status_code=HTTP_422_UNPROCESSABLE_ENTITY
|
|
99
|
-
)
|
|
87
|
+
raise HTTPException(detail="Request body is invalid", status_code=422)
|
|
100
88
|
if not evaluation.name.strip():
|
|
101
89
|
raise HTTPException(
|
|
102
90
|
detail="Evaluation name must not be blank/empty",
|
|
103
|
-
status_code=
|
|
91
|
+
status_code=422,
|
|
104
92
|
)
|
|
105
93
|
await request.state.enqueue_evaluation(evaluation)
|
|
106
94
|
return Response()
|
|
@@ -110,7 +98,7 @@ async def post_evaluations(
|
|
|
110
98
|
"/evaluations",
|
|
111
99
|
operation_id="getEvaluations",
|
|
112
100
|
summary="Get span, trace, or document evaluations from a project",
|
|
113
|
-
responses=add_errors_to_responses([
|
|
101
|
+
responses=add_errors_to_responses([404]),
|
|
114
102
|
)
|
|
115
103
|
async def get_evaluations(
|
|
116
104
|
request: Request,
|
|
@@ -149,7 +137,7 @@ async def get_evaluations(
|
|
|
149
137
|
and span_evals_dataframe.empty
|
|
150
138
|
and document_evals_dataframe.empty
|
|
151
139
|
):
|
|
152
|
-
return Response(status_code=
|
|
140
|
+
return Response(status_code=404)
|
|
153
141
|
|
|
154
142
|
evals = chain(
|
|
155
143
|
map(
|
|
@@ -179,7 +167,7 @@ async def _process_pyarrow(request: Request) -> Response:
|
|
|
179
167
|
except pa.ArrowInvalid:
|
|
180
168
|
raise HTTPException(
|
|
181
169
|
detail="Request body is not valid pyarrow",
|
|
182
|
-
status_code=
|
|
170
|
+
status_code=422,
|
|
183
171
|
)
|
|
184
172
|
try:
|
|
185
173
|
evaluations = Evaluations.from_pyarrow_reader(reader)
|
|
@@ -187,11 +175,11 @@ async def _process_pyarrow(request: Request) -> Response:
|
|
|
187
175
|
if isinstance(e, PhoenixEvaluationNameIsMissing):
|
|
188
176
|
raise HTTPException(
|
|
189
177
|
detail="Evaluation name must not be blank/empty",
|
|
190
|
-
status_code=
|
|
178
|
+
status_code=422,
|
|
191
179
|
)
|
|
192
180
|
raise HTTPException(
|
|
193
181
|
detail="Invalid data in request body",
|
|
194
|
-
status_code=
|
|
182
|
+
status_code=422,
|
|
195
183
|
)
|
|
196
184
|
return Response(background=BackgroundTask(_add_evaluations, request.state, evaluations))
|
|
197
185
|
|
|
@@ -5,7 +5,6 @@ from dateutil.parser import isoparse
|
|
|
5
5
|
from fastapi import APIRouter, HTTPException
|
|
6
6
|
from pydantic import Field, model_validator
|
|
7
7
|
from starlette.requests import Request
|
|
8
|
-
from starlette.status import HTTP_404_NOT_FOUND
|
|
9
8
|
from strawberry.relay import GlobalID
|
|
10
9
|
from typing_extensions import Self
|
|
11
10
|
|
|
@@ -72,7 +71,7 @@ class UpsertExperimentEvaluationResponseBody(
|
|
|
72
71
|
operation_id="upsertExperimentEvaluation",
|
|
73
72
|
summary="Create or update evaluation for an experiment run",
|
|
74
73
|
responses=add_errors_to_responses(
|
|
75
|
-
[{"status_code":
|
|
74
|
+
[{"status_code": 404, "description": "Experiment run not found"}]
|
|
76
75
|
),
|
|
77
76
|
)
|
|
78
77
|
async def upsert_experiment_evaluation(
|
|
@@ -85,7 +84,7 @@ async def upsert_experiment_evaluation(
|
|
|
85
84
|
except ValueError:
|
|
86
85
|
raise HTTPException(
|
|
87
86
|
detail=f"ExperimentRun with ID {experiment_run_gid} does not exist",
|
|
88
|
-
status_code=
|
|
87
|
+
status_code=404,
|
|
89
88
|
)
|
|
90
89
|
name = request_body.name
|
|
91
90
|
annotator_kind = request_body.annotator_kind
|
|
@@ -7,7 +7,6 @@ from sqlalchemy import select
|
|
|
7
7
|
from sqlalchemy.exc import IntegrityError as PostgreSQLIntegrityError
|
|
8
8
|
from sqlean.dbapi2 import IntegrityError as SQLiteIntegrityError # type: ignore[import-untyped]
|
|
9
9
|
from starlette.requests import Request
|
|
10
|
-
from starlette.status import HTTP_404_NOT_FOUND, HTTP_409_CONFLICT, HTTP_422_UNPROCESSABLE_ENTITY
|
|
11
10
|
from strawberry.relay import GlobalID
|
|
12
11
|
|
|
13
12
|
from phoenix.db import models
|
|
@@ -60,11 +59,11 @@ class CreateExperimentRunResponseBody(ResponseBody[CreateExperimentRunResponseBo
|
|
|
60
59
|
responses=add_errors_to_responses(
|
|
61
60
|
[
|
|
62
61
|
{
|
|
63
|
-
"status_code":
|
|
62
|
+
"status_code": 404,
|
|
64
63
|
"description": "Experiment or dataset example not found",
|
|
65
64
|
},
|
|
66
65
|
{
|
|
67
|
-
"status_code":
|
|
66
|
+
"status_code": 409,
|
|
68
67
|
"description": "This experiment run has already been submitted",
|
|
69
68
|
},
|
|
70
69
|
]
|
|
@@ -79,7 +78,7 @@ async def create_experiment_run(
|
|
|
79
78
|
except ValueError:
|
|
80
79
|
raise HTTPException(
|
|
81
80
|
detail=f"Experiment with ID {experiment_gid} does not exist",
|
|
82
|
-
status_code=
|
|
81
|
+
status_code=404,
|
|
83
82
|
)
|
|
84
83
|
|
|
85
84
|
example_gid = GlobalID.from_id(request_body.dataset_example_id)
|
|
@@ -88,7 +87,7 @@ async def create_experiment_run(
|
|
|
88
87
|
except ValueError:
|
|
89
88
|
raise HTTPException(
|
|
90
89
|
detail=f"DatasetExample with ID {example_gid} does not exist",
|
|
91
|
-
status_code=
|
|
90
|
+
status_code=404,
|
|
92
91
|
)
|
|
93
92
|
|
|
94
93
|
trace_id = request_body.trace_id
|
|
@@ -115,7 +114,7 @@ async def create_experiment_run(
|
|
|
115
114
|
except (PostgreSQLIntegrityError, SQLiteIntegrityError):
|
|
116
115
|
raise HTTPException(
|
|
117
116
|
detail="This experiment run has already been submitted",
|
|
118
|
-
status_code=
|
|
117
|
+
status_code=409,
|
|
119
118
|
)
|
|
120
119
|
request.state.event_queue.put(ExperimentRunInsertEvent((exp_run.id,)))
|
|
121
120
|
run_gid = GlobalID("ExperimentRun", str(exp_run.id))
|
|
@@ -141,8 +140,8 @@ class ListExperimentRunsResponseBody(PaginatedResponseBody[ExperimentRunResponse
|
|
|
141
140
|
response_description="Experiment runs retrieved successfully",
|
|
142
141
|
responses=add_errors_to_responses(
|
|
143
142
|
[
|
|
144
|
-
{"status_code":
|
|
145
|
-
{"status_code":
|
|
143
|
+
{"status_code": 404, "description": "Experiment not found"},
|
|
144
|
+
{"status_code": 422, "description": "Invalid cursor format"},
|
|
146
145
|
]
|
|
147
146
|
),
|
|
148
147
|
)
|
|
@@ -166,7 +165,7 @@ async def list_experiment_runs(
|
|
|
166
165
|
except ValueError:
|
|
167
166
|
raise HTTPException(
|
|
168
167
|
detail=f"Experiment with ID {experiment_gid} does not exist",
|
|
169
|
-
status_code=
|
|
168
|
+
status_code=404,
|
|
170
169
|
)
|
|
171
170
|
|
|
172
171
|
stmt = (
|
|
@@ -182,7 +181,7 @@ async def list_experiment_runs(
|
|
|
182
181
|
except ValueError:
|
|
183
182
|
raise HTTPException(
|
|
184
183
|
detail=f"Invalid cursor format: {cursor}",
|
|
185
|
-
status_code=
|
|
184
|
+
status_code=422,
|
|
186
185
|
)
|
|
187
186
|
|
|
188
187
|
# Apply limit only if specified for pagination
|
|
@@ -11,7 +11,6 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
11
11
|
from sqlalchemy.orm import joinedload
|
|
12
12
|
from starlette.requests import Request
|
|
13
13
|
from starlette.responses import PlainTextResponse
|
|
14
|
-
from starlette.status import HTTP_200_OK, HTTP_404_NOT_FOUND, HTTP_422_UNPROCESSABLE_ENTITY
|
|
15
14
|
from strawberry.relay import GlobalID
|
|
16
15
|
|
|
17
16
|
from phoenix.db import models
|
|
@@ -96,7 +95,7 @@ class CreateExperimentResponseBody(ResponseBody[Experiment]):
|
|
|
96
95
|
operation_id="createExperiment",
|
|
97
96
|
summary="Create experiment on a dataset",
|
|
98
97
|
responses=add_errors_to_responses(
|
|
99
|
-
[{"status_code":
|
|
98
|
+
[{"status_code": 404, "description": "Dataset or DatasetVersion not found"}]
|
|
100
99
|
),
|
|
101
100
|
response_description="Experiment retrieved successfully",
|
|
102
101
|
)
|
|
@@ -111,7 +110,7 @@ async def create_experiment(
|
|
|
111
110
|
except ValueError:
|
|
112
111
|
raise HTTPException(
|
|
113
112
|
detail="Dataset with ID {dataset_globalid} does not exist",
|
|
114
|
-
status_code=
|
|
113
|
+
status_code=404,
|
|
115
114
|
)
|
|
116
115
|
|
|
117
116
|
dataset_version_globalid_str = request_body.version_id
|
|
@@ -124,7 +123,7 @@ async def create_experiment(
|
|
|
124
123
|
except ValueError:
|
|
125
124
|
raise HTTPException(
|
|
126
125
|
detail=f"DatasetVersion with ID {dataset_version_globalid_str} does not exist",
|
|
127
|
-
status_code=
|
|
126
|
+
status_code=404,
|
|
128
127
|
)
|
|
129
128
|
|
|
130
129
|
async with request.app.state.db() as session:
|
|
@@ -134,7 +133,7 @@ async def create_experiment(
|
|
|
134
133
|
if result is None:
|
|
135
134
|
raise HTTPException(
|
|
136
135
|
detail=f"Dataset with ID {dataset_globalid} does not exist",
|
|
137
|
-
status_code=
|
|
136
|
+
status_code=404,
|
|
138
137
|
)
|
|
139
138
|
dataset_name = result.name
|
|
140
139
|
if dataset_version_globalid_str is None:
|
|
@@ -147,7 +146,7 @@ async def create_experiment(
|
|
|
147
146
|
if not dataset_version:
|
|
148
147
|
raise HTTPException(
|
|
149
148
|
detail=f"Dataset {dataset_globalid} does not have any versions",
|
|
150
|
-
status_code=
|
|
149
|
+
status_code=404,
|
|
151
150
|
)
|
|
152
151
|
dataset_version_id = dataset_version.id
|
|
153
152
|
dataset_version_globalid = GlobalID("DatasetVersion", str(dataset_version_id))
|
|
@@ -159,7 +158,7 @@ async def create_experiment(
|
|
|
159
158
|
if not dataset_version:
|
|
160
159
|
raise HTTPException(
|
|
161
160
|
detail=f"DatasetVersion with ID {dataset_version_globalid} does not exist",
|
|
162
|
-
status_code=
|
|
161
|
+
status_code=404,
|
|
163
162
|
)
|
|
164
163
|
user_id: Optional[int] = None
|
|
165
164
|
if request.app.state.authentication_enabled and isinstance(request.user, PhoenixUser):
|
|
@@ -228,7 +227,7 @@ class GetExperimentResponseBody(ResponseBody[Experiment]):
|
|
|
228
227
|
operation_id="getExperiment",
|
|
229
228
|
summary="Get experiment by ID",
|
|
230
229
|
responses=add_errors_to_responses(
|
|
231
|
-
[{"status_code":
|
|
230
|
+
[{"status_code": 404, "description": "Experiment not found"}]
|
|
232
231
|
),
|
|
233
232
|
response_description="Experiment retrieved successfully",
|
|
234
233
|
)
|
|
@@ -239,7 +238,7 @@ async def get_experiment(request: Request, experiment_id: str) -> GetExperimentR
|
|
|
239
238
|
except ValueError:
|
|
240
239
|
raise HTTPException(
|
|
241
240
|
detail="Experiment with ID {experiment_globalid} does not exist",
|
|
242
|
-
status_code=
|
|
241
|
+
status_code=404,
|
|
243
242
|
)
|
|
244
243
|
|
|
245
244
|
async with request.app.state.db() as session:
|
|
@@ -250,7 +249,7 @@ async def get_experiment(request: Request, experiment_id: str) -> GetExperimentR
|
|
|
250
249
|
if not experiment:
|
|
251
250
|
raise HTTPException(
|
|
252
251
|
detail=f"Experiment with ID {experiment_globalid} does not exist",
|
|
253
|
-
status_code=
|
|
252
|
+
status_code=404,
|
|
254
253
|
)
|
|
255
254
|
|
|
256
255
|
dataset_globalid = GlobalID("Dataset", str(experiment.dataset_id))
|
|
@@ -289,7 +288,7 @@ async def list_experiments(
|
|
|
289
288
|
except ValueError:
|
|
290
289
|
raise HTTPException(
|
|
291
290
|
detail=f"Dataset with ID {dataset_gid} does not exist",
|
|
292
|
-
status_code=
|
|
291
|
+
status_code=404,
|
|
293
292
|
)
|
|
294
293
|
async with request.app.state.db() as session:
|
|
295
294
|
query = (
|
|
@@ -328,7 +327,7 @@ async def _get_experiment_runs_and_revisions(
|
|
|
328
327
|
) -> tuple[models.Experiment, tuple[models.ExperimentRun], tuple[models.DatasetExampleRevision]]:
|
|
329
328
|
experiment = await session.get(models.Experiment, experiment_rowid)
|
|
330
329
|
if not experiment:
|
|
331
|
-
raise HTTPException(detail="Experiment not found", status_code=
|
|
330
|
+
raise HTTPException(detail="Experiment not found", status_code=404)
|
|
332
331
|
revision_ids = (
|
|
333
332
|
select(func.max(models.DatasetExampleRevision.id))
|
|
334
333
|
.join(
|
|
@@ -377,7 +376,7 @@ async def _get_experiment_runs_and_revisions(
|
|
|
377
376
|
if not runs_and_revisions:
|
|
378
377
|
raise HTTPException(
|
|
379
378
|
detail="Experiment has no runs",
|
|
380
|
-
status_code=
|
|
379
|
+
status_code=404,
|
|
381
380
|
)
|
|
382
381
|
runs, revisions = zip(*runs_and_revisions)
|
|
383
382
|
return experiment, runs, revisions
|
|
@@ -390,7 +389,7 @@ async def _get_experiment_runs_and_revisions(
|
|
|
390
389
|
response_class=PlainTextResponse,
|
|
391
390
|
responses=add_errors_to_responses(
|
|
392
391
|
[
|
|
393
|
-
{"status_code":
|
|
392
|
+
{"status_code": 404, "description": "Experiment not found"},
|
|
394
393
|
]
|
|
395
394
|
),
|
|
396
395
|
)
|
|
@@ -404,7 +403,7 @@ async def get_experiment_json(
|
|
|
404
403
|
except ValueError:
|
|
405
404
|
raise HTTPException(
|
|
406
405
|
detail=f"Invalid experiment ID: {experiment_globalid}",
|
|
407
|
-
status_code=
|
|
406
|
+
status_code=422,
|
|
408
407
|
)
|
|
409
408
|
|
|
410
409
|
async with request.app.state.db() as session:
|
|
@@ -459,7 +458,7 @@ async def get_experiment_json(
|
|
|
459
458
|
"/experiments/{experiment_id}/csv",
|
|
460
459
|
operation_id="getExperimentCSV",
|
|
461
460
|
summary="Download experiment runs as a CSV file",
|
|
462
|
-
responses={**add_text_csv_content_to_responses(
|
|
461
|
+
responses={**add_text_csv_content_to_responses(200)},
|
|
463
462
|
)
|
|
464
463
|
async def get_experiment_csv(
|
|
465
464
|
request: Request,
|
|
@@ -471,7 +470,7 @@ async def get_experiment_csv(
|
|
|
471
470
|
except ValueError:
|
|
472
471
|
raise HTTPException(
|
|
473
472
|
detail=f"Invalid experiment ID: {experiment_globalid}",
|
|
474
|
-
status_code=
|
|
473
|
+
status_code=422,
|
|
475
474
|
)
|
|
476
475
|
|
|
477
476
|
async with request.app.state.db() as session:
|
|
@@ -4,12 +4,6 @@ from fastapi import APIRouter, Depends, HTTPException, Path, Query
|
|
|
4
4
|
from pydantic import Field
|
|
5
5
|
from sqlalchemy import select
|
|
6
6
|
from starlette.requests import Request
|
|
7
|
-
from starlette.status import (
|
|
8
|
-
HTTP_204_NO_CONTENT,
|
|
9
|
-
HTTP_403_FORBIDDEN,
|
|
10
|
-
HTTP_404_NOT_FOUND,
|
|
11
|
-
HTTP_422_UNPROCESSABLE_ENTITY,
|
|
12
|
-
)
|
|
13
7
|
from strawberry.relay import GlobalID
|
|
14
8
|
|
|
15
9
|
from phoenix.config import DEFAULT_PROJECT_NAME
|
|
@@ -70,7 +64,7 @@ class UpdateProjectResponseBody(ResponseBody[Project]):
|
|
|
70
64
|
response_description="A list of projects with pagination information", # noqa: E501
|
|
71
65
|
responses=add_errors_to_responses(
|
|
72
66
|
[
|
|
73
|
-
|
|
67
|
+
422,
|
|
74
68
|
]
|
|
75
69
|
),
|
|
76
70
|
)
|
|
@@ -115,7 +109,7 @@ async def get_projects(
|
|
|
115
109
|
except ValueError:
|
|
116
110
|
raise HTTPException(
|
|
117
111
|
detail=f"Invalid cursor format: {cursor}",
|
|
118
|
-
status_code=
|
|
112
|
+
status_code=422,
|
|
119
113
|
)
|
|
120
114
|
|
|
121
115
|
stmt = stmt.limit(limit + 1)
|
|
@@ -142,8 +136,8 @@ async def get_projects(
|
|
|
142
136
|
response_description="The requested project", # noqa: E501
|
|
143
137
|
responses=add_errors_to_responses(
|
|
144
138
|
[
|
|
145
|
-
|
|
146
|
-
|
|
139
|
+
404,
|
|
140
|
+
422,
|
|
147
141
|
]
|
|
148
142
|
),
|
|
149
143
|
)
|
|
@@ -182,7 +176,7 @@ async def get_project(
|
|
|
182
176
|
response_description="The newly created project", # noqa: E501
|
|
183
177
|
responses=add_errors_to_responses(
|
|
184
178
|
[
|
|
185
|
-
|
|
179
|
+
422,
|
|
186
180
|
]
|
|
187
181
|
),
|
|
188
182
|
)
|
|
@@ -223,9 +217,9 @@ async def create_project(
|
|
|
223
217
|
response_description="The updated project", # noqa: E501
|
|
224
218
|
responses=add_errors_to_responses(
|
|
225
219
|
[
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
220
|
+
403,
|
|
221
|
+
404,
|
|
222
|
+
422,
|
|
229
223
|
]
|
|
230
224
|
),
|
|
231
225
|
)
|
|
@@ -262,7 +256,7 @@ async def update_project(
|
|
|
262
256
|
role_name: UserRoleName = await session.scalar(stmt)
|
|
263
257
|
if role_name != "ADMIN" and role_name != "SYSTEM":
|
|
264
258
|
raise HTTPException(
|
|
265
|
-
status_code=
|
|
259
|
+
status_code=403,
|
|
266
260
|
detail="Only admins can update projects",
|
|
267
261
|
)
|
|
268
262
|
async with request.app.state.db() as session:
|
|
@@ -282,12 +276,12 @@ async def update_project(
|
|
|
282
276
|
summary="Delete a project by ID or name", # noqa: E501
|
|
283
277
|
description="Delete an existing project and all its associated data. The project identifier is either project ID or project name. The default project cannot be deleted. Note: When using a project name as the identifier, it cannot contain slash (/), question mark (?), or pound sign (#) characters.", # noqa: E501
|
|
284
278
|
response_description="No content returned on successful deletion", # noqa: E501
|
|
285
|
-
status_code=
|
|
279
|
+
status_code=204,
|
|
286
280
|
responses=add_errors_to_responses(
|
|
287
281
|
[
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
282
|
+
403,
|
|
283
|
+
404,
|
|
284
|
+
422,
|
|
291
285
|
]
|
|
292
286
|
),
|
|
293
287
|
)
|
|
@@ -322,7 +316,7 @@ async def delete_project(
|
|
|
322
316
|
role_name: UserRoleName = await session.scalar(stmt)
|
|
323
317
|
if role_name != "ADMIN" and role_name != "SYSTEM":
|
|
324
318
|
raise HTTPException(
|
|
325
|
-
status_code=
|
|
319
|
+
status_code=403,
|
|
326
320
|
detail="Only admins can delete projects",
|
|
327
321
|
)
|
|
328
322
|
async with request.app.state.db() as session:
|
|
@@ -331,7 +325,7 @@ async def delete_project(
|
|
|
331
325
|
# The default project must not be deleted - it's forbidden
|
|
332
326
|
if project.name == DEFAULT_PROJECT_NAME:
|
|
333
327
|
raise HTTPException(
|
|
334
|
-
status_code=
|
|
328
|
+
status_code=403,
|
|
335
329
|
detail="The default project cannot be deleted",
|
|
336
330
|
)
|
|
337
331
|
|