Skip to content

Commit 7caddbb

Browse files
Copilotslister1001
andcommitted
Remove redteam_context_with_product method as requested
Co-authored-by: slister1001 <[email protected]>
1 parent 6eedf8f commit 7caddbb

File tree

2 files changed

+0
-44
lines changed

2 files changed

+0
-44
lines changed

sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_user_agent.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,3 @@ def redteam_context(cls, *, subtype: str = "RedTeam", **kwargs) -> Iterator[None
5050
"""
5151
with cls.add_useragent_product(f"(type=redteam; subtype={subtype})"):
5252
yield
53-
54-
@classmethod
55-
@contextmanager
56-
def redteam_context_with_product(cls, *products: str) -> Iterator[None]:
57-
"""Context manager to use custom red team user agent for RAI service calls
58-
59-
This context manager temporarily sets the user agent to include custom red team
60-
products for all calls within the context.
61-
62-
:param products: User Agent products to append for red team context
63-
:type products: str
64-
65-
..see-also::
66-
67-
`User-Agent section of RFC 9110, <https://www.rfc-editor.org/rfc/rfc9110#name-user-agent>`
68-
"""
69-
default_redteam_product = "(type=redteam; subtype=RedTeam)"
70-
all_products = [default_redteam_product] + list(products)
71-
with cls.add_useragent_product(*all_products):
72-
yield

sdk/evaluation/azure-ai-evaluation/tests/unittests/test_redteam_user_agent.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,6 @@ def test_custom_subtype_redteam_context(self):
3232
# Should restore to original after context
3333
assert UserAgentSingleton().value == base_user_agent
3434

35-
def test_redteam_context_with_products(self):
36-
"""Test red team context with additional products."""
37-
base_user_agent = UserAgentSingleton().value
38-
39-
with UserAgentSingleton.redteam_context_with_product("custom/1.0", "test/feature"):
40-
redteam_user_agent = UserAgentSingleton().value
41-
expected = f"{base_user_agent} (type=redteam; subtype=RedTeam) custom/1.0 test/feature"
42-
assert redteam_user_agent == expected
43-
44-
# Should restore to original after context
45-
assert UserAgentSingleton().value == base_user_agent
46-
4735
def test_nested_contexts(self):
4836
"""Test nested user agent contexts."""
4937
base_user_agent = UserAgentSingleton().value
@@ -86,18 +74,6 @@ def test_multiple_redteam_contexts(self):
8674
# Should restore to original
8775
assert UserAgentSingleton().value == base_user_agent
8876

89-
def test_empty_products(self):
90-
"""Test red team context with empty products list."""
91-
base_user_agent = UserAgentSingleton().value
92-
93-
with UserAgentSingleton.redteam_context_with_product():
94-
redteam_user_agent = UserAgentSingleton().value
95-
expected = f"{base_user_agent} (type=redteam; subtype=RedTeam)"
96-
assert redteam_user_agent == expected
97-
98-
# Should restore to original after context
99-
assert UserAgentSingleton().value == base_user_agent
100-
10177
def test_redteam_context_kwargs_ignored(self):
10278
"""Test that additional kwargs are ignored gracefully."""
10379
base_user_agent = UserAgentSingleton().value

0 commit comments

Comments
 (0)