개선관리 요구사항과 Google 로그인을 완료
This commit is contained in:
parent
cc0a15b7c6
commit
2a39636163
112 changed files with 10166 additions and 527 deletions
|
|
@ -4,12 +4,26 @@ from __future__ import annotations
|
|||
|
||||
from collections.abc import Iterable, Mapping
|
||||
|
||||
from .services import guardrail
|
||||
|
||||
def enriched_masked_turns(masked_turns: Iterable[Mapping[str, object]]) -> list[dict[str, object]]:
|
||||
"""Attach the same 1-based turn sequence to every session evaluation path."""
|
||||
|
||||
def enriched_masked_turns(
|
||||
masked_turns: Iterable[Mapping[str, object]],
|
||||
*,
|
||||
counselor_identity: str | None = None,
|
||||
client_identity: str | None = None,
|
||||
) -> list[dict[str, object]]:
|
||||
"""Attach turn sequence and role-safe identity tokens to evaluation input."""
|
||||
enriched: list[dict[str, object]] = []
|
||||
for index, turn in enumerate(masked_turns, start=1):
|
||||
item = dict(turn)
|
||||
speaker = str(item.get("speaker") or "")
|
||||
item["text"] = guardrail.mask_role_identities(
|
||||
str(item.get("text") or ""),
|
||||
counselor_identity=counselor_identity,
|
||||
client_identity=client_identity,
|
||||
synthetic_generated=speaker == "client",
|
||||
).text_masked
|
||||
item["seq"] = index
|
||||
enriched.append(item)
|
||||
return enriched
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue