-
Notifications
You must be signed in to change notification settings - Fork 7
Add suppress_invoke_agent_input option to core observability SDK #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+86
−0
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1b3b90b
Initial plan
Copilot ddb5dc6
Add suppress_invoke_agent_input option to OpenAI trace processor
Copilot a44a56d
Refactor: Address code review feedback - reduce duplication and impro…
Copilot cff467f
Refactor: Use parent span operation name check instead of tracking di…
Copilot c5b96b6
Fix: Pass both span and otel_span to _should_suppress_input as sugges…
Copilot a5a144b
Move suppress_invoke_agent_input to core SDK (exporter and span proce…
Copilot b791932
Fix suppression logic: check current span instead of parent, remove u…
Copilot ec1eb3f
Fix formatting: multi-line imports and remove trailing whitespace
Copilot 25f54fc
Fix test: add suppress_invoke_agent_input parameter to exporter asser…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
tests/observability/extensions/openai/test_prompt_suppression.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # Copyright (c) Microsoft. All rights reserved. | ||
|
|
||
| import unittest | ||
|
|
||
| from microsoft_agents_a365.observability.core.exporters.agent365_exporter import _Agent365Exporter | ||
|
|
||
|
|
||
| class TestPromptSuppressionConfiguration(unittest.TestCase): | ||
| """Unit tests for prompt suppression configuration in the core SDK.""" | ||
|
|
||
| def test_exporter_default_suppression_is_false(self): | ||
| """Test that the default value for suppress_invoke_agent_input is False in exporter.""" | ||
| exporter = _Agent365Exporter(token_resolver=lambda x, y: "test") | ||
|
|
||
| self.assertFalse( | ||
| exporter._suppress_invoke_agent_input, | ||
| "Default value for suppress_invoke_agent_input should be False", | ||
| ) | ||
|
|
||
| def test_exporter_can_enable_suppression(self): | ||
| """Test that suppression can be enabled via exporter constructor.""" | ||
| exporter = _Agent365Exporter( | ||
| token_resolver=lambda x, y: "test", suppress_invoke_agent_input=True | ||
| ) | ||
|
|
||
| self.assertTrue( | ||
| exporter._suppress_invoke_agent_input, | ||
| "suppress_invoke_agent_input should be True when explicitly set", | ||
| ) | ||
|
|
||
|
|
||
| def run_tests(): | ||
| """Run all prompt suppression configuration tests.""" | ||
| print("🧪 Running prompt suppression configuration tests...") | ||
| print("=" * 80) | ||
|
|
||
| loader = unittest.TestLoader() | ||
| suite = loader.loadTestsFromTestCase(TestPromptSuppressionConfiguration) | ||
|
|
||
| runner = unittest.TextTestRunner(verbosity=2) | ||
| result = runner.run(suite) | ||
|
|
||
| print("\n" + "=" * 80) | ||
| print("🏁 Test Summary:") | ||
| print(f"Tests run: {result.testsRun}") | ||
| print(f"Failures: {len(result.failures)}") | ||
| print(f"Errors: {len(result.errors)}") | ||
|
|
||
| if result.wasSuccessful(): | ||
| print("🎉 All tests passed!") | ||
| return True | ||
| else: | ||
| print("🔧 Some tests failed. Check output above.") | ||
| return False | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| success = run_tests() | ||
| exit(0 if success else 1) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.