Skip to content

Conversation

@vapi-tasker
Copy link

@vapi-tasker vapi-tasker bot commented Jan 31, 2026

Summary

  • Add developer role to message types for GPT-5.x and o-series models (HIGH priority)
  • Create comprehensive type definitions in src/types/openai.ts
  • Update ConversationMessageProps and ChatMessage interfaces to include developer role
  • Add validation utilities: isValidRole, supportsDeveloperRole, validateRole
  • Add deprecation notice for function role (recommend using tool instead)
  • Export new types from main index for public API access
  • Add Playwright tests for new functionality

Technical Details

New Types Added (src/types/openai.ts)

  • MessageRole const object with all valid roles including developer
  • OpenAIModel const object with GPT-5.x, o-series, and legacy models
  • DEVELOPER_ROLE_MODELS array identifying models requiring developer role
  • Utility functions: supportsDeveloperRole(), isValidRole(), isDeprecatedRole(), getReplacementRole(), validateRole(), createMessage()

Updated Interfaces

  • ConversationMessageProps.role: Added 'developer' to union type
  • MarkdownMessageProps.role: Updated to use ConversationMessageRole
  • ChatMessage.role: Added 'developer' to union type

Testing

  • Added tests/openai-types.spec.ts with Playwright tests covering:
    • MessageRole definitions
    • OpenAIModel definitions
    • Developer role detection for GPT-5.x and o-series models
    • Role validation utilities
    • Deprecation handling for function role

Backward Compatibility

  • All existing roles (user, assistant, tool) continue to work unchanged
  • The function role is still supported but will log a deprecation warning
  • No breaking changes to existing APIs

Related

  • Part of VAP-11729: Audit and update client SDKs against latest OpenAI spec
  • Related PRs: server-sdk-typescript#35, client-sdk-web#151, client-sdk-python#22

Test plan

  • Run npm run type-check - TypeScript compilation passes
  • Run npm run lint - ESLint passes with no warnings
  • Run npm run build - Production build succeeds
  • Verify developer role can be used in ChatMessage
  • Verify deprecation warning appears when using function role

Generated with Claude Code

- Add `developer` role to message types for GPT-5.x and o-series models
- Create src/types/openai.ts with MessageRole, OpenAIModel, and utilities
- Update ConversationMessageProps and ChatMessage interfaces
- Add validation utilities: isValidRole, supportsDeveloperRole, validateRole
- Add deprecation notice for 'function' role (recommend 'tool')
- Export new types from main index
- Add comprehensive Playwright tests for new functionality
- Bump version to 0.2.0

This change enables the SDK to work with OpenAI's GPT-5.x and o-series
models which require the `developer` role for system-level instructions.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants