feat:Add speakers and mapping fields to speaker identification schema#158
feat:Add speakers and mapping fields to speaker identification schema#158
Conversation
WalkthroughModified OpenAPI schema definitions for speaker identification, adding a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/libs/AssemblyAI/openapi.yaml`:
- Around line 6136-6151: The speakers item schema allows empty objects; make the
item require either role or name by replacing the current properties block with
a oneOf that enforces required fields: one schema object requiring ["role"] and
another requiring ["name"] (both keep description/additionalProperties as
needed), so each speaker item must include at least role or name; this change
will tighten the OpenAPI schema for "speakers" and cause the generated model
AssemblyAI.Models.SpeakerIdentificationRequestBodySpeakerIdentificationSpeaker
to reflect the required constraint rather than allowing both fields to be
nullable.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: deffca6a-7a3d-4765-ad29-2352f7727038
⛔ Files ignored due to path filters (7)
src/libs/AssemblyAI/Generated/AssemblyAI.JsonSerializerContextTypes.g.csis excluded by!**/generated/**src/libs/AssemblyAI/Generated/AssemblyAI.Models.SpeakerIdentificationRequestBodySpeakerIdentification.g.csis excluded by!**/generated/**src/libs/AssemblyAI/Generated/AssemblyAI.Models.SpeakerIdentificationRequestBodySpeakerIdentificationSpeaker.Json.g.csis excluded by!**/generated/**src/libs/AssemblyAI/Generated/AssemblyAI.Models.SpeakerIdentificationRequestBodySpeakerIdentificationSpeaker.g.csis excluded by!**/generated/**src/libs/AssemblyAI/Generated/AssemblyAI.Models.SpeakerIdentificationResponseSpeakerIdentification.g.csis excluded by!**/generated/**src/libs/AssemblyAI/Generated/AssemblyAI.Models.SpeakerIdentificationResponseSpeakerIdentificationMapping.Json.g.csis excluded by!**/generated/**src/libs/AssemblyAI/Generated/AssemblyAI.Models.SpeakerIdentificationResponseSpeakerIdentificationMapping.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/AssemblyAI/openapi.yaml
| speakers: | ||
| type: array | ||
| description: An array of speaker objects with metadata to improve identification accuracy. Each object should include a `role` or `name` (depending on `speaker_type`) and an optional `description` to help the model identify the speaker. You can also include any additional custom properties (e.g., `company`, `title`) to provide more context. Use this as an alternative to `known_values` when you want to provide additional context about each speaker. | ||
| items: | ||
| type: object | ||
| properties: | ||
| role: | ||
| type: string | ||
| description: The role of the speaker. Required when `speaker_type` is "role". | ||
| name: | ||
| type: string | ||
| description: The name of the speaker. Required when `speaker_type` is "name". | ||
| description: | ||
| type: string | ||
| description: A description of the speaker to help the model identify them based on conversational context. | ||
| additionalProperties: true |
There was a problem hiding this comment.
Model the speaker-item requirement in the schema.
Each speakers item is currently valid even when it is just {}, because neither role nor name is required. That mismatch already flows into the generated SDK model (src/libs/AssemblyAI/Generated/AssemblyAI.Models.SpeakerIdentificationRequestBodySpeakerIdentificationSpeaker.g.cs:9-32), where both fields are nullable, so invalid payloads won’t be caught until the API rejects them.
Suggested schema tightening
speakers:
type: array
description: An array of speaker objects with metadata to improve identification accuracy. Each object should include a `role` or `name` (depending on `speaker_type`) and an optional `description` to help the model identify the speaker. You can also include any additional custom properties (e.g., `company`, `title`) to provide more context. Use this as an alternative to `known_values` when you want to provide additional context about each speaker.
items:
type: object
properties:
role:
type: string
description: The role of the speaker. Required when `speaker_type` is "role".
name:
type: string
description: The name of the speaker. Required when `speaker_type` is "name".
description:
type: string
description: A description of the speaker to help the model identify them based on conversational context.
+ oneOf:
+ - required: [role]
+ - required: [name]
additionalProperties: true📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| speakers: | |
| type: array | |
| description: An array of speaker objects with metadata to improve identification accuracy. Each object should include a `role` or `name` (depending on `speaker_type`) and an optional `description` to help the model identify the speaker. You can also include any additional custom properties (e.g., `company`, `title`) to provide more context. Use this as an alternative to `known_values` when you want to provide additional context about each speaker. | |
| items: | |
| type: object | |
| properties: | |
| role: | |
| type: string | |
| description: The role of the speaker. Required when `speaker_type` is "role". | |
| name: | |
| type: string | |
| description: The name of the speaker. Required when `speaker_type` is "name". | |
| description: | |
| type: string | |
| description: A description of the speaker to help the model identify them based on conversational context. | |
| additionalProperties: true | |
| speakers: | |
| type: array | |
| description: An array of speaker objects with metadata to improve identification accuracy. Each object should include a `role` or `name` (depending on `speaker_type`) and an optional `description` to help the model identify the speaker. You can also include any additional custom properties (e.g., `company`, `title`) to provide more context. Use this as an alternative to `known_values` when you want to provide additional context about each speaker. | |
| items: | |
| type: object | |
| properties: | |
| role: | |
| type: string | |
| description: The role of the speaker. Required when `speaker_type` is "role". | |
| name: | |
| type: string | |
| description: The name of the speaker. Required when `speaker_type` is "name". | |
| description: | |
| type: string | |
| description: A description of the speaker to help the model identify them based on conversational context. | |
| oneOf: | |
| - required: [role] | |
| - required: [name] | |
| additionalProperties: true |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/libs/AssemblyAI/openapi.yaml` around lines 6136 - 6151, The speakers item
schema allows empty objects; make the item require either role or name by
replacing the current properties block with a oneOf that enforces required
fields: one schema object requiring ["role"] and another requiring ["name"]
(both keep description/additionalProperties as needed), so each speaker item
must include at least role or name; this change will tighten the OpenAPI schema
for "speakers" and cause the generated model
AssemblyAI.Models.SpeakerIdentificationRequestBodySpeakerIdentificationSpeaker
to reflect the required constraint rather than allowing both fields to be
nullable.
Summary by CodeRabbit