Skip to content

Conversation

@everettVT
Copy link
Contributor

Summary

This PR introduces an enhanced transformers prompter as a proposal for evolving AI function patterns across the codebase. The refactor demonstrates improved architectural patterns that could be applied more broadly to AI functions.

Key Pattern Improvements

  • Cleaner separation of concerns: Dedicated message processing via TransformersPrompterMessageProcessor
  • More granular configuration: Modular options types (AutoTokenizerOptions, AutoProcessorOptions, ChatTemplateOptions, GenerationConfigOptions, ModelLoadingOptions)
  • Simplified model loading: Cleaner interface via TransformersPrompterModelLoader
  • Better type safety: Enhanced typing throughout the module
  • Improved developer experience: More intuitive configuration and usage patterns

Why This Matters

This refactor proposes a pattern evolution that addresses:

  1. Configuration complexity - breaking down monolithic options into focused, composable types
  2. Code organization - better module boundaries and responsibilities
  3. Extensibility - easier to add new capabilities without bloating existing interfaces
  4. Type safety - stronger typing for better IDE support and fewer runtime errors

Feedback Needed

This is a draft PR to gather team feedback on:

  • Is this pattern evolution worth adopting more broadly?
  • What trade-offs or concerns do you see?
  • Should we apply similar patterns to other AI function implementations?
  • Are there additional improvements we should consider?

Test plan

  • Existing tests pass
  • Pattern demonstrates clear improvements over current approach
  • Configuration types are intuitive and well-structured

- logprobs output mode
- image+ text + file inputs
- quantization via bits and bytes
- structured outputs.
- docs
…eatures

- Introduced `TransformersPromptOptions` for structured configuration.
- Added `ChatTemplateFormatter` for improved message handling.
- Updated `TransformersProvider` to support new dependencies and error handling.
- Removed deprecated `prompter` protocol and refactored related tests.
- Enhanced integration tests for multimodal capabilities and quantization support.
- Added comprehensive unit tests for new functionalities.
Introduces enhanced transformers prompter with improved typing system and
modular configuration options as a proposal for evolving AI function patterns.
This refactor demonstrates:

- Cleaner separation of concerns with dedicated message processing
- More granular configuration options (AutoTokenizerOptions, ChatTemplateOptions, etc.)
- Simplified model loading interface
- Better type safety and developer experience

This is a proposal for team feedback on pattern evolution across AI functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants