Skip to content

Commit 627132c

Browse files
authored
Merge pull request #2239 from asimurka/feature/fix-safety-identifier
LCORE-3192: Fix safety identifier
2 parents 288e18b + 19e182a commit 627132c

5 files changed

Lines changed: 13 additions & 8 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ extend-exclude = ["tests/profiles/syntax_error.py"]
248248

249249
[tool.ruff.lint]
250250
extend-select = ["TID251", "UP006", "UP007", "UP010", "UP017", "UP035", "RUF100", "B009", "B010", "DTZ005", "D202", "I001", "PLR1733"]
251-
251+
ignore = ["UP040", "UP047", "UP045", "BLE", "S", "C", "RUF", "SIM", "B017", "TRY004", "TRY201", "TRY203", "TRY401", "UP008", "UP012", "UP024", "UP041", "B008", "EXE001", "FURB129", "G201", "ISC004", "LOG014", "PERF402", "PIE790", "PLW1510", "PYI034", "PYI064", "RET501", "TC004"]
252252

253253
[tool.ruff.lint.flake8-tidy-imports.banned-api]
254254
unittest = { msg = "use pytest instead of unittest" }

scripts/gen_doc.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ def generate_documentation_on_path(path: Path) -> None:
6767
----------
6868
path (str or os.PathLike): Directory in which to generate the README.md file.
6969
"""
70-
directory = path
71-
7270
# directory can be skipped if it's part of DIRS_TO_SKIP global list.
7371
if path.as_posix() in DIRS_TO_SKIP:
7472
print(f"[gendoc] Skipping {path}")

scripts/vulnerability_report.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@
4040
from statistics import median
4141
from typing import Any
4242

43-
from dateutil import parser
44-
4543
import matplotlib.pyplot as plt
44+
from dateutil import parser
4645
from matplotlib.figure import Figure
4746

4847
type DependabotAlert = dict[str, Any]

src/app/endpoints/responses.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,9 @@ async def handle_streaming_response(
582582
inference_start_time = time.monotonic()
583583
try:
584584
response = await context.client.responses.create(
585-
**api_params.model_dump(exclude_none=True)
585+
**api_params.model_dump(
586+
exclude_none=True, exclude={"safety_identifier"}
587+
)
586588
)
587589
generator = response_generator(
588590
stream=cast(AsyncIterator[OpenAIResponseObjectStream], response),
@@ -903,6 +905,9 @@ async def response_generator(
903905
chunk_dict["response"]["conversation"] = normalize_conversation_id(
904906
api_params.conversation
905907
)
908+
chunk_dict["response"][
909+
"safety_identifier"
910+
] = api_params.safety_identifier
906911
_sanitize_response_dict(
907912
chunk_dict["response"],
908913
configured_mcp_labels,
@@ -1082,7 +1087,9 @@ async def handle_non_streaming_response(
10821087
api_response = cast(
10831088
OpenAIResponseObject,
10841089
await context.client.responses.create(
1085-
**api_params.model_dump(exclude_none=True)
1090+
**api_params.model_dump(
1091+
exclude_none=True, exclude={"safety_identifier"}
1092+
)
10861093
),
10871094
)
10881095
_record_response_inference_result(
@@ -1182,6 +1189,7 @@ async def handle_non_streaming_response(
11821189
response = ResponsesResponse.model_validate(
11831190
{
11841191
**response_dict,
1192+
"safety_identifier": api_params.safety_identifier,
11851193
"available_quotas": available_quotas,
11861194
"conversation": normalize_conversation_id(api_params.conversation),
11871195
"completed_at": int(completed_at.timestamp()),

tests/e2e/features/llama_stack_disrupted.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,4 +276,4 @@ Feature: Llama Stack connection disrupted
276276
{"question": "How do I list files?"}
277277
"""
278278
Then The status code of the response is 503
279-
And The body of the response contains Llama Stack
279+
And The body of the response contains OGX

0 commit comments

Comments
 (0)