-
Notifications
You must be signed in to change notification settings - Fork 34
Feature/embeddings support #56
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
Merged
Conversation
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
Add provider availability checking functionality to complete architecture specification. - Add isConfigured(ProviderAvailabilityInterface $availability): bool method - Delegate to ProviderAvailabilityInterface::isConfigured() for consistency
Add base generation method that automatically detects model capabilities and delegates to appropriate generation interfaces. - Add generateResult(prompt, ModelInterface): GenerativeAiResult method - Smart delegation to generateTextResult() or generateImageResult() based on model interface - Comprehensive error handling for unsupported model types - 3 new tests covering text generation, image generation, and error cases
Add streaming text generation using PHP Generator pattern. - Add streamGenerateTextResult() method with Generator return type - Delegate to model's streaming method using yield from - Support model auto-discovery and comprehensive error handling
Add properly typed async operations with model interface validation. - Add generateTextOperation() with TextGenerationModelInterface validation - Add generateImageOperation() with ImageGenerationModelInterface validation - Prefixed operation IDs for better tracking (text_op_, image_op_) - 4 comprehensive tests covering validation and error cases
- Add convertTextToSpeechResult() method with model auto-discovery - Add convertTextToSpeechOperation() method for async processing - Enhance generateResult() to support TextToSpeechConversionModelInterface - Add findSuitableTextToSpeechModel() helper method - Update test expectations for extended generation interface support
- Add generateSpeechResult() method with model auto-discovery - Add generateSpeechOperation() method for async speech processing - Enhance generateResult() to support SpeechGenerationModelInterface - Add findSuitableSpeechModel() helper with speechGeneration capability - Update prompt() method with comprehensive PromptBuilder integration docs
- Add Embedding DTO with vector data representation and dimension tracking - Add EmbeddingResult class extending ResultInterface for embedding results - Add EmbeddingOperation class for async embedding operations - Add EmbeddingGenerationModelInterface for synchronous embedding generation - Add EmbeddingGenerationOperationModelInterface for async embedding operations - Implement generateEmbeddingsResult() method with model auto-discovery - Implement generateEmbeddingsOperation() method for async processing - Add findSuitableEmbeddingModel() helper with embeddingGeneration capability - Support both string[] and Message[] input formats for embeddings - Update PromptBuilder integration documentation to include embeddings
- Create EmbeddingTest.php with 9 test methods covering vector operations and transformations - Create EmbeddingResultTest.php with 12 test methods covering result validation and serialization - Create EmbeddingOperationTest.php with 14 test methods covering all operation states - Create MockEmbeddingGenerationModel.php and MockEmbeddingGenerationOperationModel.php for testing - Add 5 embedding test methods to AiClientTest.php with proper mock integration
- Fix type errors by ensuring proper list types for embedding interfaces - Convert Message arrays to proper lists using array_values() for interface compliance
- Add missing newlines at end of files - Remove trailing whitespace - Fix alphabetical import sorting in test files - All PHPCS violations resolved automatically
- Implement message() method with placeholder that throws RuntimeException - Add comprehensive test coverage for message() method
…ability - Extract PromptNormalizer utility class for prompt format standardization - Extract ModelDiscovery utility class for capability-based model discovery
- Fix list type annotations in PromptNormalizer and AiClient - Ensure all Message arrays are converted to proper lists using array_values() - Remove 4 redundant tests from AiClientTest that are now covered by utility tests - Maintain 100% test coverage while eliminating duplicate test logic - All PHPStan errors resolved, all tests passing
Extract interface validation, operation factory, embedding input normalization, and generation strategy resolution into dedicated utility classes.
…ation - Implement template method pattern in AiClient for generation methods - Add dynamic validation system to InterfaceValidator with configuration mapping - Consolidate EmbeddingInputNormalizer functionality into PromptNormalizer - Refactor operation methods with factory pattern approach - Update all tests to use consolidated normalizer methods
|
As a note, I'm not sure when we'll add embeddings. It's not a high priority at this time and requires considerable thought downstream as to how it's used, especially in a WordPress context. |
|
@JasonTheAdams I do agree with you. I think I can try to leave it to be a separate package dependent on |
2c8bfa2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a draft PR split from #55 to enable separate review of the embeddings functionality.