WordPress / WordPress/php-ai-client
Add support for embedding generation
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 308
- Forks
- 84
- Avg merge
- 7d 21h
- Merged PRs (30d)
- 2
Description
Summary
Implement embedding generation capabilities as outlined in docs/ARCHITECTURE.md and the development roadmap (#8, milestone 0.4.0).
Embeddings enable vector representations of text/content for use with vector databases, semantic search, and similarity comparisons.
Scope
Domain Layer
-
EmbeddingDTO (src/Embeddings/DTO/Embedding.php) — vector validation, dimension helpers -
EmbeddingResultimplementingResultInterface— carries embeddings, token usage, provider metadata -
EmbeddingOperationfor async/long-running embedding jobs
Builder & Client APIs
-
PromptBuilder::withEmbeddingInput(string|Message $input)— collect inputs for embedding -
PromptBuilder::generateEmbeddingsResult()/generateEmbeddingsOperation()/generateEmbeddings() - Matching methods on
AiClientfor traditional API surface - Capability inference routes through
CapabilityEnum::embeddingGeneration
Provider Contracts & Registry
-
EmbeddingGenerationModelInterface -
EmbeddingGenerationOperationModelInterface -
WithEmbeddingOperationsInterface -
ProviderRegistrydiscovery for embedding-capable models
Provider Implementations
- OpenAI embedding model metadata & adapter
- Google / Anthropic stubs or implementations as available
Testing & CLI
- Unit tests for DTOs, builder flows, client methods, provider adapters
- Mock embedding model in test fixtures
- CLI support (
--capability=embeddings, output formats)
Documentation
- README quick-start examples (fluent + traditional)
- Architecture/requirements doc updates
Related
- Roadmap: #8 (0.4.0 milestone)
- Architecture spec:
docs/ARCHITECTURE.md
Open Questions
- Input shape for multiple documents — new
withEmbeddingInputs()vs. reusing message stack? - Helper transformers on
EmbeddingResult(e.g.,toVectors(),toAssociativeArray())? - Provider-specific options (dimensions) — surface through
ModelConfig/SupportedOption?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with docs/ARCHITECTURE.md and the roadmap reference, then review the listed DTO, builder, client, provider-contract, registry, and provider paths. Resolve the open questions about input shape, result helpers, and provider-specific options before implementing the embedding capability. Done includes the scoped APIs, provider support, unit tests, and README and architecture updates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- ai, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100