-
Notifications
You must be signed in to change notification settings - Fork 114
feat: add support for agent tags #559
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
Conversation
|
""" WalkthroughA new optional Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Agent
participant Serializer
User->>Agent: Create Agent(tags=[...])
Agent->>Serializer: Serialize Agent
alt tags is not None
Serializer-->>User: Output includes tags
else tags is None
Serializer-->>User: Output excludes tags
end
Estimated code review effort3 (~30–60 minutes) Possibly related PRs
Suggested reviewers
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Pylint (3.3.7)tests/daily_test/test_daily_agent_websocket.py📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (7)
🧠 Learnings (1)tests/daily_test/test_daily_agent_websocket.py (11)Learnt from: dvonthenen Learnt from: dvonthenen Learnt from: dvonthenen Learnt from: dvonthenen Learnt from: dvonthenen Learnt from: dvonthenen Learnt from: dvonthenen Learnt from: dvonthenen Learnt from: dvonthenen Learnt from: dvonthenen Learnt from: dvonthenen 🧬 Code Graph Analysis (1)tests/daily_test/test_daily_agent_websocket.py (2)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (4)
🧰 Additional context used🧠 Learnings (1)tests/daily_test/test_daily_agent_websocket.py (11)Learnt from: dvonthenen Learnt from: dvonthenen Learnt from: dvonthenen Learnt from: dvonthenen Learnt from: dvonthenen Learnt from: dvonthenen Learnt from: dvonthenen Learnt from: dvonthenen Learnt from: dvonthenen Learnt from: dvonthenen Learnt from: dvonthenen 🧬 Code Graph Analysis (1)tests/daily_test/test_daily_agent_websocket.py (2)
🔇 Additional comments (8)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
tests/response_data/agent/websocket/basic_conversation-a40b2785-events.json (1)
3-15: Inconsistent opening sequence across fixturesHere the ordering remains
Welcome→Open, opposite of the newly-updatedfallback_providersfixture. Consider normalising or documenting why both orders are expected to avoid brittle tests.tests/unit_test/test_unit_agent_tags.py (1)
181-195: Consider expanding type validation testing.The test name suggests type validation but only tests valid inputs. Consider either:
- Renaming to
test_tags_valid_typesto match current behavior, or- Adding tests for invalid types to truly validate type checking
# Example of actual type validation testing: def test_tags_invalid_types(self): """Test that tags rejects invalid types""" options = SettingsOptions() # These should raise TypeError or be handled gracefully with pytest.raises((TypeError, ValueError)): options.agent.tags = "not_a_list" # string instead of list with pytest.raises((TypeError, ValueError)): options.agent.tags = [1, 2, 3] # list of non-strings
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
tests/response_data/speak/rest/1fe0ad339338a9d6cffbab2c7ace41ba5387b5fe7906854795702dce91034fd3-f8c3bf62a9aa3e6fc1619c250e48abe7519373d3edf41be62eb5dc45199af2ef.wavis excluded by!**/*.wav
📒 Files selected for processing (12)
deepgram/clients/agent/v1/websocket/options.py(1 hunks)tests/response_data/agent/websocket/basic_conversation-a40b2785-events.json(5 hunks)tests/response_data/agent/websocket/fallback_providers-e16542b1-events.json(5 hunks)tests/response_data/listen/rest/a231370d439312b1a404bb6ad8de955e900ec8eae9a906329af8cc672e6ec7ba-29e7c8100617f70da4ae9da1921cb5071a01219f4780ca70930b0a370ed2163a-response.json(1 hunks)tests/response_data/listen/rest/a231370d439312b1a404bb6ad8de955e900ec8eae9a906329af8cc672e6ec7ba-a17f4880c5b4cf124ac54d06d77c9f0ab7f3fe1052ff1c7b090f7eaf8ede5b76-response.json(1 hunks)tests/response_data/listen/rest/c4e1c0031174878d8f0e3dbd87916ee16d56f1c610ac525af5712ea37226a455-29e7c8100617f70da4ae9da1921cb5071a01219f4780ca70930b0a370ed2163a-response.json(1 hunks)tests/response_data/listen/rest/c4e1c0031174878d8f0e3dbd87916ee16d56f1c610ac525af5712ea37226a455-a17f4880c5b4cf124ac54d06d77c9f0ab7f3fe1052ff1c7b090f7eaf8ede5b76-response.json(1 hunks)tests/response_data/listen/websocket/ed5bfd217988aa8cad492f63f79dc59f5f02fb9b85befe6f6ce404b8f19aaa0d-42fc5ed98cabc1fa1a2f276301c27c46dd15f6f5187cd93d944cc94fa81c8469-response.json(1 hunks)tests/response_data/listen/websocket/ed5bfd217988aa8cad492f63f79dc59f5f02fb9b85befe6f6ce404b8f19aaa0d-d7334c26cf6468c191e05ff5e8151da9b67985c66ab177e9446fd14bbafd70df-response.json(1 hunks)tests/response_data/read/rest/3917a1c81c08e360c0d4bba0ff9ebd645e610e4149483e5f2888a2c5df388b37-23e873efdfd4d680286fda14ff8f10864218311e79efc92ecc82bce3e574c366-response.json(1 hunks)tests/response_data/speak/rest/1fe0ad339338a9d6cffbab2c7ace41ba5387b5fe7906854795702dce91034fd3-f8c3bf62a9aa3e6fc1619c250e48abe7519373d3edf41be62eb5dc45199af2ef-response.json(1 hunks)tests/unit_test/test_unit_agent_tags.py(1 hunks)
🧠 Learnings (3)
📓 Common learnings
Learnt from: jpvajda
PR: deepgram/deepgram-python-sdk#558
File: deepgram/clients/agent/v1/websocket/options.py:274-276
Timestamp: 2025-07-21T15:36:29.068Z
Learning: In the Deepgram Python SDK, the pattern of using `Optional[bool]` with `default=False` (without exclude conditions) is intentionally used for API flexibility. This allows the API to accept various input types while maintaining consistent default behavior. The `experimental` field in `SettingsOptions` and `mip_opt_out` field in `Agent` both follow this pattern, where they always serialize to JSON and provide a consistent default value while allowing flexible input handling.
tests/response_data/speak/rest/1fe0ad339338a9d6cffbab2c7ace41ba5387b5fe7906854795702dce91034fd3-f8c3bf62a9aa3e6fc1619c250e48abe7519373d3edf41be62eb5dc45199af2ef-response.json (3)
Learnt from: dvonthenen
PR: #472
File: examples/text-to-speech/websocket/output_to_wav/main.py:16-17
Timestamp: 2024-10-18T00:30:20.224Z
Learning: In examples/text-to-speech/websocket/output_to_wav/main.py, the hardcoded values for AUDIO_FILE and TTS_TEXT are intentional and should remain as is.
Learnt from: dvonthenen
PR: #472
File: examples/text-to-speech/websocket/output_to_wav/main.py:38-41
Timestamp: 2024-10-18T00:30:01.884Z
Learning: In the examples/text-to-speech/websocket/output_to_wav/main.py file, the code is intended as a simple example, and additional error handling for file operations is not required.
Learnt from: dvonthenen
PR: #472
File: examples/text-to-speech/websocket/output_to_wav/main.py:52-56
Timestamp: 2024-10-18T00:30:04.220Z
Learning: In examples/text-to-speech/websocket/output_to_wav/main.py, the code is intended as an example demonstrating functionality, and refactoring suggestions may not be necessary.
deepgram/clients/agent/v1/websocket/options.py (10)
Learnt from: dvonthenen
PR: #431
File: deepgram/clients/listen/v1/websocket/client.py:30-30
Timestamp: 2024-07-11T14:10:17.231Z
Learning: The LiveOptions import in deepgram/clients/listen/v1/websocket/client.py is intentionally present for future use and should not be flagged for removal in reviews.
Learnt from: dvonthenen
PR: #431
File: deepgram/clients/listen/v1/websocket/client.py:30-30
Timestamp: 2024-10-09T02:19:46.087Z
Learning: The LiveOptions import in deepgram/clients/listen/v1/websocket/client.py is intentionally present for future use and should not be flagged for removal in reviews.
Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/websocket/init.py:8-8
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in deepgram/clients/listen/v1/websocket/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.
Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/websocket/init.py:8-8
Timestamp: 2024-07-01T19:21:39.778Z
Learning: Unused imports in deepgram/clients/listen/v1/websocket/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.
Learnt from: jpvajda
PR: #558
File: deepgram/clients/agent/v1/websocket/options.py:274-276
Timestamp: 2025-07-21T15:36:29.068Z
Learning: In the Deepgram Python SDK, the pattern of using Optional[bool] with default=False (without exclude conditions) is intentionally used for API flexibility. This allows the API to accept various input types while maintaining consistent default behavior. The experimental field in SettingsOptions and mip_opt_out field in Agent both follow this pattern, where they always serialize to JSON and provide a consistent default value while allowing flexible input handling.
Learnt from: dvonthenen
PR: #431
File: deepgram/clients/listen/v1/websocket/async_client.py:30-30
Timestamp: 2024-10-09T02:19:46.087Z
Learning: The unused import LiveOptions in deepgram/clients/listen/v1/websocket/async_client.py is intentional and will be used in PR #432.
Learnt from: dvonthenen
PR: #431
File: deepgram/clients/listen/v1/websocket/async_client.py:30-30
Timestamp: 2024-07-11T14:10:24.647Z
Learning: The unused import LiveOptions in deepgram/clients/listen/v1/websocket/async_client.py is intentional and will be used in PR #432.
Learnt from: dvonthenen
PR: #426
File: deepgram/clients/speak/v1/websocket/response.py:23-30
Timestamp: 2024-07-01T19:12:00.190Z
Learning: When using the dataclasses.field with default values in the deepgram/clients/speak/v1/websocket/response.py, avoid using mutable default arguments. Instead, use field(default_factory=...).
Learnt from: dvonthenen
PR: #426
File: deepgram/clients/speak/v1/websocket/response.py:23-30
Timestamp: 2024-10-09T02:19:48.728Z
Learning: When using the dataclasses.field with default values in the deepgram/clients/speak/v1/websocket/response.py, avoid using mutable default arguments. Instead, use field(default_factory=...).
Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/rest/options.py:12-12
Timestamp: 2024-10-09T02:19:46.087Z
Learning: Unused imports in deepgram/clients/listen/v1/rest/options.py are retained to maintain backwards compatibility.
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: jpvajda
PR: deepgram/deepgram-python-sdk#558
File: deepgram/clients/agent/v1/websocket/options.py:274-276
Timestamp: 2025-07-21T15:36:29.068Z
Learning: In the Deepgram Python SDK, the pattern of using `Optional[bool]` with `default=False` (without exclude conditions) is intentionally used for API flexibility. This allows the API to accept various input types while maintaining consistent default behavior. The `experimental` field in `SettingsOptions` and `mip_opt_out` field in `Agent` both follow this pattern, where they always serialize to JSON and provide a consistent default value while allowing flexible input handling.
tests/response_data/speak/rest/1fe0ad339338a9d6cffbab2c7ace41ba5387b5fe7906854795702dce91034fd3-f8c3bf62a9aa3e6fc1619c250e48abe7519373d3edf41be62eb5dc45199af2ef-response.json (3)
Learnt from: dvonthenen
PR: #472
File: examples/text-to-speech/websocket/output_to_wav/main.py:16-17
Timestamp: 2024-10-18T00:30:20.224Z
Learning: In examples/text-to-speech/websocket/output_to_wav/main.py, the hardcoded values for AUDIO_FILE and TTS_TEXT are intentional and should remain as is.
Learnt from: dvonthenen
PR: #472
File: examples/text-to-speech/websocket/output_to_wav/main.py:38-41
Timestamp: 2024-10-18T00:30:01.884Z
Learning: In the examples/text-to-speech/websocket/output_to_wav/main.py file, the code is intended as a simple example, and additional error handling for file operations is not required.
Learnt from: dvonthenen
PR: #472
File: examples/text-to-speech/websocket/output_to_wav/main.py:52-56
Timestamp: 2024-10-18T00:30:04.220Z
Learning: In examples/text-to-speech/websocket/output_to_wav/main.py, the code is intended as an example demonstrating functionality, and refactoring suggestions may not be necessary.
deepgram/clients/agent/v1/websocket/options.py (10)
Learnt from: dvonthenen
PR: #431
File: deepgram/clients/listen/v1/websocket/client.py:30-30
Timestamp: 2024-07-11T14:10:17.231Z
Learning: The LiveOptions import in deepgram/clients/listen/v1/websocket/client.py is intentionally present for future use and should not be flagged for removal in reviews.
Learnt from: dvonthenen
PR: #431
File: deepgram/clients/listen/v1/websocket/client.py:30-30
Timestamp: 2024-10-09T02:19:46.087Z
Learning: The LiveOptions import in deepgram/clients/listen/v1/websocket/client.py is intentionally present for future use and should not be flagged for removal in reviews.
Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/websocket/init.py:8-8
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in deepgram/clients/listen/v1/websocket/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.
Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/websocket/init.py:8-8
Timestamp: 2024-07-01T19:21:39.778Z
Learning: Unused imports in deepgram/clients/listen/v1/websocket/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.
Learnt from: jpvajda
PR: #558
File: deepgram/clients/agent/v1/websocket/options.py:274-276
Timestamp: 2025-07-21T15:36:29.068Z
Learning: In the Deepgram Python SDK, the pattern of using Optional[bool] with default=False (without exclude conditions) is intentionally used for API flexibility. This allows the API to accept various input types while maintaining consistent default behavior. The experimental field in SettingsOptions and mip_opt_out field in Agent both follow this pattern, where they always serialize to JSON and provide a consistent default value while allowing flexible input handling.
Learnt from: dvonthenen
PR: #431
File: deepgram/clients/listen/v1/websocket/async_client.py:30-30
Timestamp: 2024-10-09T02:19:46.087Z
Learning: The unused import LiveOptions in deepgram/clients/listen/v1/websocket/async_client.py is intentional and will be used in PR #432.
Learnt from: dvonthenen
PR: #431
File: deepgram/clients/listen/v1/websocket/async_client.py:30-30
Timestamp: 2024-07-11T14:10:24.647Z
Learning: The unused import LiveOptions in deepgram/clients/listen/v1/websocket/async_client.py is intentional and will be used in PR #432.
Learnt from: dvonthenen
PR: #426
File: deepgram/clients/speak/v1/websocket/response.py:23-30
Timestamp: 2024-07-01T19:12:00.190Z
Learning: When using the dataclasses.field with default values in the deepgram/clients/speak/v1/websocket/response.py, avoid using mutable default arguments. Instead, use field(default_factory=...).
Learnt from: dvonthenen
PR: #426
File: deepgram/clients/speak/v1/websocket/response.py:23-30
Timestamp: 2024-10-09T02:19:48.728Z
Learning: When using the dataclasses.field with default values in the deepgram/clients/speak/v1/websocket/response.py, avoid using mutable default arguments. Instead, use field(default_factory=...).
Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/rest/options.py:12-12
Timestamp: 2024-10-09T02:19:46.087Z
Learning: Unused imports in deepgram/clients/listen/v1/rest/options.py are retained to maintain backwards compatibility.
🔇 Additional comments (21)
tests/response_data/listen/websocket/ed5bfd217988aa8cad492f63f79dc59f5f02fb9b85befe6f6ce404b8f19aaa0d-d7334c26cf6468c191e05ff5e8151da9b67985c66ab177e9446fd14bbafd70df-response.json (1)
1-1: Metadata refresh looks fineThe new
request_idupdate appears to be merely a test-data refresh and doesn’t affect logic. No concerns.tests/response_data/speak/rest/1fe0ad339338a9d6cffbab2c7ace41ba5387b5fe7906854795702dce91034fd3-f8c3bf62a9aa3e6fc1619c250e48abe7519373d3edf41be62eb5dc45199af2ef-response.json (1)
1-1: LGTM! Routine test data refresh.This is a standard metadata update to the test response JSON, refreshing the request ID and timestamp while preserving all other response data structure and content.
tests/response_data/read/rest/3917a1c81c08e360c0d4bba0ff9ebd645e610e4149483e5f2888a2c5df388b37-23e873efdfd4d680286fda14ff8f10864218311e79efc92ecc82bce3e574c366-response.json (1)
1-1: LGTM! Standard test data update.The metadata refresh (request_id and timestamp) maintains test data currency while preserving the original response structure and content.
tests/response_data/listen/websocket/ed5bfd217988aa8cad492f63f79dc59f5f02fb9b85befe6f6ce404b8f19aaa0d-42fc5ed98cabc1fa1a2f276301c27c46dd15f6f5187cd93d944cc94fa81c8469-response.json (1)
1-1: LGTM! Test data update with minor confidence adjustment.The request ID refresh and slight confidence score adjustment for "tranquility" (0.92578125 → 0.9248047) represent normal test data maintenance without affecting the core transcription functionality.
tests/response_data/listen/rest/a231370d439312b1a404bb6ad8de955e900ec8eae9a906329af8cc672e6ec7ba-a17f4880c5b4cf124ac54d06d77c9f0ab7f3fe1052ff1c7b090f7eaf8ede5b76-response.json (1)
1-1: LGTM! Routine metadata refresh.Standard test data update refreshing the request ID and timestamp while maintaining all transcription content and structure integrity.
deepgram/clients/agent/v1/websocket/options.py (1)
277-279: LGTM! Excellent implementation following SDK patterns.The new
tagsfield implementation is well-designed:
- Correct type signature
Optional[List[str]]for optional string list- Appropriate
Nonedefault for unset optional field- Proper exclusion from serialization when
None- Follows established SDK patterns consistently
The implementation enables filtered searching capabilities as specified in the PR objectives while maintaining full backward compatibility.
tests/response_data/listen/rest/c4e1c0031174878d8f0e3dbd87916ee16d56f1c610ac525af5712ea37226a455-29e7c8100617f70da4ae9da1921cb5071a01219f4780ca70930b0a370ed2163a-response.json (1)
1-1: Fixture metadata refresh acknowledgedOnly metadata/timestamps were updated; the structure and transcript content remain intact. No action required.
tests/response_data/listen/rest/c4e1c0031174878d8f0e3dbd87916ee16d56f1c610ac525af5712ea37226a455-a17f4880c5b4cf124ac54d06d77c9f0ab7f3fe1052ff1c7b090f7eaf8ede5b76-response.json (1)
1-1: Fixture metadata refresh acknowledgedChanges are limited to request-level metadata and confidence rounding; nothing to review further.
tests/response_data/listen/rest/a231370d439312b1a404bb6ad8de955e900ec8eae9a906329af8cc672e6ec7ba-29e7c8100617f70da4ae9da1921cb5071a01219f4780ca70930b0a370ed2163a-response.json (1)
1-1: Fixture metadata refresh acknowledgedPurely a timestamp / request-id rollover; transcript payload unchanged.
tests/response_data/agent/websocket/fallback_providers-e16542b1-events.json (1)
3-15: Verify event ordering (“Open” vs “Welcome”)This fixture now emits an
Openevent before theWelcomeevent, whereas other fixtures (e.g.basic_conversation-a40b2785) still do the reverse.
If your consumer logic relies on event order, please double-check that both variants are intentionally supported.tests/unit_test/test_unit_agent_tags.py (11)
1-15: LGTM! Clean imports and class structure.The imports are appropriate and the class follows standard pytest conventions with a clear docstring.
16-26: Comprehensive default value testing.Good coverage testing the default
Nonevalue through bothSettingsOptionsand directAgentinstantiation.
27-38: Thorough list assignment testing.Good validation of setting tags to a list with appropriate assertions for length and membership.
39-46: Good edge case coverage.Properly tests the empty list scenario, which is an important edge case for the tags field.
47-54: Complete single-item list testing.Good coverage of the single-item list scenario with proper length and value assertions.
69-82: Comprehensive serialization testing with values.Excellent coverage testing both
to_dict()andto_json()methods to ensure tags are properly serialized when set.
83-96: Important distinction between None and empty list.Good test ensuring that an empty list is serialized (unlike
Nonewhich is excluded), maintaining the important semantic difference.
97-128: Comprehensive deserialization coverage.Excellent testing of deserialization scenarios including multiple tags, single tag, and empty array cases.
129-139: Essential backward compatibility testing.Important test ensuring that missing
tagsfield defaults toNoneduring deserialization, maintaining backward compatibility.
140-160: Critical round-trip data integrity testing.Excellent round-trip testing ensuring data integrity through serialization and deserialization cycles for both multiple tags and empty list scenarios.
161-180: Valuable integration testing with other settings.Good integration test ensuring
tagsworks correctly alongside other agent settings without interference in both assignment and serialization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/daily_test/test_daily_agent_websocket.py (1)
514-516: Consider making the wait time configurableThe hardcoded 20-second wait might be excessive for some tests. Consider making this configurable per test case to optimize test execution time.
Add a configurable wait time to the test case definition:
- # Allow final processing - wait longer for AgentAudioDone event - print(f"⏳ Waiting {20} seconds for agent to complete speaking...") - time.sleep(20) + # Allow final processing - wait for agent to complete speaking + final_wait_time = test_case.get("final_wait_time", 20) + print(f"⏳ Waiting {final_wait_time} seconds for agent to complete speaking...") + time.sleep(final_wait_time)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (22)
tests/daily_test/test_daily_agent_websocket.py(10 hunks)tests/response_data/agent/websocket/agent_tags-d9fabdd0-config.json(1 hunks)tests/response_data/agent/websocket/agent_tags-d9fabdd0-error.json(1 hunks)tests/response_data/agent/websocket/agent_tags-d9fabdd0-events.json(1 hunks)tests/response_data/agent/websocket/agent_tags-e55ef69c-config.json(1 hunks)tests/response_data/agent/websocket/agent_tags-e55ef69c-events.json(1 hunks)tests/response_data/agent/websocket/basic_conversation-a40b2785-events.json(7 hunks)tests/response_data/agent/websocket/fallback_providers-e16542b1-events.json(5 hunks)tests/response_data/agent/websocket/function_call_conversation-86d9ef37-config.json(1 hunks)tests/response_data/agent/websocket/function_call_conversation-86d9ef37-error.json(1 hunks)tests/response_data/agent/websocket/function_call_conversation-86d9ef37-events.json(1 hunks)tests/response_data/agent/websocket/function_call_conversation-a741f061-config.json(1 hunks)tests/response_data/agent/websocket/function_call_conversation-a741f061-error.json(1 hunks)tests/response_data/agent/websocket/function_call_conversation-a741f061-events.json(1 hunks)tests/response_data/agent/websocket/function_call_conversation-ac8ed698-config.json(1 hunks)tests/response_data/agent/websocket/function_call_conversation-ac8ed698-events.json(1 hunks)tests/response_data/agent/websocket/function_call_conversation-ac8ed698-function_calls.json(1 hunks)tests/response_data/agent/websocket/function_call_conversation-fbf9240d-config.json(1 hunks)tests/response_data/agent/websocket/function_call_conversation-fbf9240d-error.json(1 hunks)tests/response_data/agent/websocket/function_call_conversation-fbf9240d-events.json(1 hunks)tests/response_data/agent/websocket/inject_agent_message-3c5004a4-config.json(1 hunks)tests/response_data/agent/websocket/inject_agent_message-3c5004a4-events.json(1 hunks)
🧠 Learnings (1)
tests/daily_test/test_daily_agent_websocket.py (6)
Learnt from: dvonthenen
PR: #468
File: examples/text-to-speech/websocket/complete/main.py:26-30
Timestamp: 2024-09-27T15:21:34.197Z
Learning: In examples/text-to-speech/websocket/complete/main.py, commented-out options like auto_flush_speak_delta and verbose are intentional in examples and should not be flagged in reviews.
Learnt from: dvonthenen
PR: #417
File: deepgram/clients/live/v1/client.py:14-14
Timestamp: 2024-06-12T18:02:10.651Z
Learning: Ignore suggestions to change import paths to local versions in test cases and examples as per user preference to use the actual deepgram-sdk package for testing.
Learnt from: dvonthenen
PR: #417
File: deepgram/clients/live/v1/client.py:14-14
Timestamp: 2024-10-09T02:19:48.728Z
Learning: Ignore suggestions to change import paths to local versions in test cases and examples as per user preference to use the actual deepgram-sdk package for testing.
Learnt from: dvonthenen
PR: #472
File: examples/speech-to-text/websocket/replay/main.py:78-80
Timestamp: 2024-10-18T16:20:17.742Z
Learning: In the examples directory of the Deepgram Python SDK, code is intended as illustrative examples and doesn't require production-level error handling.
Learnt from: dvonthenen
PR: #424
File: examples/speak-stream/interactive/main.py:8-8
Timestamp: 2024-06-27T00:02:56.197Z
Learning: In the deepgram-python-sdk project, unused imports in example files are intentionally retained for educational or demonstrative purposes and should not be flagged as issues.
Learnt from: dvonthenen
PR: #424
File: examples/speak-stream/interactive/main.py:8-8
Timestamp: 2024-10-09T02:19:46.086Z
Learning: In the deepgram-python-sdk project, unused imports in example files are intentionally retained for educational or demonstrative purposes and should not be flagged as issues.
🧬 Code Graph Analysis (1)
tests/daily_test/test_daily_agent_websocket.py (2)
deepgram/clients/agent/v1/websocket/options.py (1)
FunctionCallResponse(451-459)deepgram/client.py (1)
agent(593-597)
✅ Files skipped from review due to trivial changes (17)
- tests/response_data/agent/websocket/function_call_conversation-86d9ef37-events.json
- tests/response_data/agent/websocket/function_call_conversation-ac8ed698-function_calls.json
- tests/response_data/agent/websocket/agent_tags-d9fabdd0-events.json
- tests/response_data/agent/websocket/agent_tags-d9fabdd0-error.json
- tests/response_data/agent/websocket/agent_tags-e55ef69c-events.json
- tests/response_data/agent/websocket/function_call_conversation-fbf9240d-events.json
- tests/response_data/agent/websocket/function_call_conversation-ac8ed698-events.json
- tests/response_data/agent/websocket/function_call_conversation-fbf9240d-error.json
- tests/response_data/agent/websocket/function_call_conversation-a741f061-events.json
- tests/response_data/agent/websocket/agent_tags-d9fabdd0-config.json
- tests/response_data/agent/websocket/inject_agent_message-3c5004a4-config.json
- tests/response_data/agent/websocket/function_call_conversation-ac8ed698-config.json
- tests/response_data/agent/websocket/agent_tags-e55ef69c-config.json
- tests/response_data/agent/websocket/function_call_conversation-86d9ef37-error.json
- tests/response_data/agent/websocket/function_call_conversation-fbf9240d-config.json
- tests/response_data/agent/websocket/inject_agent_message-3c5004a4-events.json
- tests/response_data/agent/websocket/function_call_conversation-86d9ef37-config.json
🚧 Files skipped from review as they are similar to previous changes (2)
- tests/response_data/agent/websocket/fallback_providers-e16542b1-events.json
- tests/response_data/agent/websocket/basic_conversation-a40b2785-events.json
🧰 Additional context used
🧠 Learnings (1)
tests/daily_test/test_daily_agent_websocket.py (6)
Learnt from: dvonthenen
PR: #468
File: examples/text-to-speech/websocket/complete/main.py:26-30
Timestamp: 2024-09-27T15:21:34.197Z
Learning: In examples/text-to-speech/websocket/complete/main.py, commented-out options like auto_flush_speak_delta and verbose are intentional in examples and should not be flagged in reviews.
Learnt from: dvonthenen
PR: #417
File: deepgram/clients/live/v1/client.py:14-14
Timestamp: 2024-06-12T18:02:10.651Z
Learning: Ignore suggestions to change import paths to local versions in test cases and examples as per user preference to use the actual deepgram-sdk package for testing.
Learnt from: dvonthenen
PR: #417
File: deepgram/clients/live/v1/client.py:14-14
Timestamp: 2024-10-09T02:19:48.728Z
Learning: Ignore suggestions to change import paths to local versions in test cases and examples as per user preference to use the actual deepgram-sdk package for testing.
Learnt from: dvonthenen
PR: #472
File: examples/speech-to-text/websocket/replay/main.py:78-80
Timestamp: 2024-10-18T16:20:17.742Z
Learning: In the examples directory of the Deepgram Python SDK, code is intended as illustrative examples and doesn't require production-level error handling.
Learnt from: dvonthenen
PR: #424
File: examples/speak-stream/interactive/main.py:8-8
Timestamp: 2024-06-27T00:02:56.197Z
Learning: In the deepgram-python-sdk project, unused imports in example files are intentionally retained for educational or demonstrative purposes and should not be flagged as issues.
Learnt from: dvonthenen
PR: #424
File: examples/speak-stream/interactive/main.py:8-8
Timestamp: 2024-10-09T02:19:46.086Z
Learning: In the deepgram-python-sdk project, unused imports in example files are intentionally retained for educational or demonstrative purposes and should not be flagged as issues.
🧬 Code Graph Analysis (1)
tests/daily_test/test_daily_agent_websocket.py (2)
deepgram/clients/agent/v1/websocket/options.py (1)
FunctionCallResponse(451-459)deepgram/client.py (1)
agent(593-597)
🔇 Additional comments (10)
tests/response_data/agent/websocket/function_call_conversation-a741f061-config.json (1)
1-64: LGTM!The test configuration is well-structured and comprehensive for testing function calling functionality. The weather function definition includes all necessary parameters and the expected events properly cover the conversation flow.
tests/response_data/agent/websocket/function_call_conversation-a741f061-error.json (1)
1-33: Error scenario correctly captures API spec validation failureThis error response file documents a parsing failure for the
agent.think.functions[0].methodfield. The error suggests that the API specification might have different requirements for the method field than what's provided in the corresponding config file ("method": "GET").tests/daily_test/test_daily_agent_websocket.py (8)
86-86: Description update reflects resolved functionalityThe updated description correctly indicates that the inject_agent_message functionality is now expected to work.
115-115: Test expectation updated to reflect fixed function callingGood to see that function calling is now expected to work properly. This aligns with the SDK improvements mentioned in the PR.
168-194: Agent tags test case is well-structured but currently disabledThe new test case for agent tags functionality is comprehensive with proper message injection and event validation. The test is appropriately disabled (
test_agent_tags: False) until server-side support is ready.
349-367: Function call response handling correctly uses new API structureThe updated logic properly handles the new API structure with the
functionsarray and gracefully handles cases where no functions are present in the request.
432-438: Agent configuration properly handles tags when enabledThe conditional addition of tags to the agent configuration is implemented correctly, only adding tags when the test case explicitly enables tag testing.
542-554: Enhanced debug output improves test failure diagnosisThe additional debug information for missing conditional events will help developers quickly identify issues when tests fail. The output includes recent events and specific event presence checks.
563-580: Comprehensive agent tags validationThe validation thoroughly checks that:
- Tags match expected values
- Tags are properly formatted as a list of strings
- Appropriate messaging when tags are not specified
This ensures the agent tags feature works as intended.
672-676: Test summary properly includes agent tags informationThe addition of agent tags information to the test summary provides clear visibility into what was tested.
lukeocodes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is good thanks
PR Summary
TL;DR
Added support for the
tagsfield in agent settings, enabling filtered searching capabilities as specified in the API specification. The implementation includes comprehensive unit tests and maintains full backward compatibility.What Changed
tagsfield to Agent class: New optional fieldtags: Optional[List[str]]indeepgram/clients/agent/v1/websocket/options.pyNone, field is excluded from serialization when not setgreetingandmip_opt_outFixed Daily Tests:
test_case0: basic_conversation ✅
test_case1: fallback_providers ✅
test_case2: inject_agent_message ✅
test_case3: function_call_conversation ✅
test_case4: agent_tags (injection test) ✅
Key Fixes We Applied:
Testing
tests/unit_test/test_unit_agent_tags.pywith 12 focused unit tests covering:API Specification Compliance
✅ Fully compliant with provided specification:
Optional[List[str]](array of strings)Noneand is excluded when not setUsage Example
Files Modified
deepgram/clients/agent/v1/websocket/options.pytags: Optional[List[str]]field to Agent classtests/unit_test/test_unit_agent_tags.py(new file)Quality Assurance
Future Steps: This implementation is production-ready and enables filtered searching capabilities through the tags field as specified in the agent API.
Ran tool
🎉 All tasks completed successfully!
The
tagsfield has been fully implemented in the Deepgram Python SDK with:The feature is now ready for filtered searching capabilities as specified in the agent API documentation.
Types of changes
What types of changes does your code introduce to the community Python SDK?
Put an
xin the boxes that applyChecklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Summary by CodeRabbit
New Features
Bug Fixes
Tests