Skip to content

Add stability package#75

Draft
wachterjohannes wants to merge 4 commits into
0.4from
stability
Draft

Add stability package#75
wachterjohannes wants to merge 4 commits into
0.4from
stability

Conversation

@wachterjohannes

@wachterjohannes wachterjohannes commented Jun 26, 2024

Copy link
Copy Markdown
Member

This PR adds the StabilityAI package and adapter for image generation.

Changes

packages/stability

  • StabilityAI REST API client
  • Support for Generate Ultra endpoint
  • Base64 and stream output formats
  • Updated to use api-client ^0.4

packages/stability-adapter

  • StabilityImageAdapter implementing AIImageAdapterInterface
  • StabilityImageAdapterFactory for adapter creation
  • Support for TextToImage action
  • Full unit test coverage (4 tests, 12 assertions)
  • Working example file for image generation
  • PHPStan clean (0 errors)

Testing

  • All tests passing
  • PHPStan analysis clean
  • Example file demonstrates usage

Issues

@coderabbitai

coderabbitai Bot commented Jun 26, 2024

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch stability

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

- Create stability-adapter package with image generation support
- Implement StabilityImageAdapter using Stability client
- Add StabilityImageAdapterFactory for adapter creation
- Support TextToImage action with BASE64 and STREAM output
- Add unit tests with 100% coverage (4 tests, 12 assertions)
- Add working example file for image generation
- Update stability package to use api-client ^0.4
- All tests passing, PHPStan clean (0 errors)

Addresses #64 (AI Image Request)
Addresses #97 (StabilityAI Adapter)
- Update composer.lock to use api-client ^0.4 (rebased to 0.4 branch)
- Fix GenerateUltra::generateAsBase64() to use requestObject() instead of
  requestRaw() since base64 responses return JSON, not raw streams
- Remove 'tests' path from phpstan.neon as tests directory doesn't exist yet
- Add type annotation for format parameter in example to satisfy PHPStan
- Add PHPDoc type hint for response data to match expected array shape

All tests passing (4 tests, 12 assertions) and PHPStan checks clean.
- Add PHPStan ignore comment for toStream() call (method exists in concrete
  implementations but not in ResponseInterface contract)
- Remove unnecessary PHPStan ignore comment from MockResponseMatcher
- Implement missing requestRaw() method in MockTransport class
- Add matchRawResponse() method to MockResponseMatcher to support raw responses

All tests passing (16 tests, 34 assertions) and PHPStan checks clean.
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.

1 participant