Skip to content

feat: migrate embeddings from Gunicorn to the-shit/vector EmbeddingClient#147

Merged
github-actions[bot] merged 1 commit into
masterfrom
feat/146-ollama-byok-embeddings
Apr 6, 2026
Merged

feat: migrate embeddings from Gunicorn to the-shit/vector EmbeddingClient#147
github-actions[bot] merged 1 commit into
masterfrom
feat/146-ollama-byok-embeddings

Conversation

@jordanpartridge
Copy link
Copy Markdown
Contributor

@jordanpartridge jordanpartridge commented Apr 6, 2026

Summary

  • Bump the-shit/vector to ^0.2 which provides EmbeddingClient contract with Ollama and OpenAI providers
  • Replace EmbeddingServiceInterfaceEmbeddingClient and generate()embed() across all services
  • Delete app/Services/EmbeddingService.php, StubEmbeddingService.php, app/Contracts/EmbeddingServiceInterface.php
  • Delete docker/embedding-server/ (Python Gunicorn service) and remove from both docker-compose files
  • Extend loadUserConfig() to map embeddings.provider/model/url/api_key to vector.embeddings.*
  • Net -382 lines (179 added / 561 deleted)

Test plan

  • 1,131 tests pass (5 skipped)
  • Pint clean
  • Verify know search works with Ollama embeddings against live Qdrant
  • Stop knowledge-embeddings Docker container on Odin

Closes #146

Summary by CodeRabbit

  • Chores
    • Transitioned embedding functionality from self-hosted server to external provider library.
    • Removed embedded embedding server, Docker service configuration, and related infrastructure files.
    • Updated all service dependencies and configuration mapping for new embedding provider.
    • Consolidated and refactored internal service integrations.

Replace the custom Python/Gunicorn embedding service with
the-shit/vector v0.2.0's EmbeddingClient contract. Embeddings are
now provider-agnostic (Ollama, OpenAI, or none) via config.

- Bump the-shit/vector to ^0.2 (adds EmbeddingClient contract)
- Replace EmbeddingServiceInterface with EmbeddingClient throughout
- Rename generate() → embed() in all services and tests
- Delete app/Services/EmbeddingService.php, StubEmbeddingService.php,
  app/Contracts/EmbeddingServiceInterface.php
- Delete docker/embedding-server/ (Dockerfile + server.py)
- Remove embedding-server from both docker-compose files
- Extend loadUserConfig() to map embeddings.provider/model/url/api_key
  to vector.embeddings.* config

Closes #146
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 6, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f490988e-4547-4b39-84d1-913e44b27a76

📥 Commits

Reviewing files that changed from the base of the PR and between b3e30af and cfd3ef8.

⛔ Files ignored due to path filters (1)
  • composer.lock is excluded by !**/*.lock
📒 Files selected for processing (19)
  • app/Commands/KnowledgeSearchStatusCommand.php
  • app/Contracts/EmbeddingServiceInterface.php
  • app/Providers/AppServiceProvider.php
  • app/Services/CodeIndexerService.php
  • app/Services/EmbeddingService.php
  • app/Services/QdrantService.php
  • app/Services/StubEmbeddingService.php
  • composer.json
  • docker-compose.remote.yml
  • docker-compose.yml
  • docker/embedding-server/Dockerfile
  • docker/embedding-server/server.py
  • tests/Feature/AppServiceProviderTest.php
  • tests/Feature/KnowledgeSearchStatusCommandTest.php
  • tests/Support/MockEmbeddingService.php
  • tests/Unit/Services/CodeIndexerServiceTest.php
  • tests/Unit/Services/HybridSearchTest.php
  • tests/Unit/Services/QdrantServiceTest.php
  • tests/Unit/Services/StubEmbeddingServiceTest.php

📝 Walkthrough

Walkthrough

The pull request migrates the embedding service abstraction from a custom App\Contracts\EmbeddingServiceInterface backed by a standalone Gunicorn Python server to TheShit\Vector\Contracts\EmbeddingClient from an external package, updating method signatures (generate()embed()), removing the embedded Docker service, and rewiring dependency injection across services and tests.

Changes

Cohort / File(s) Summary
Embedding Contract & Service Removal
app/Contracts/EmbeddingServiceInterface.php, app/Services/EmbeddingService.php, app/Services/StubEmbeddingService.php
Removed custom embedding interface and implementations, including HTTP client wrapper for Gunicorn server, cosine similarity calculation, and stub stub service.
Dependency Injection Configuration
app/Providers/AppServiceProvider.php
Updated service binding from EmbeddingServiceInterface to EmbeddingClient, rewired QdrantService constructor DI, and remapped user config keys from search.qdrant.embedding_server to vector.embeddings.* (provider, model, url, api_key).
Service Layer Updates
app/Services/CodeIndexerService.php, app/Services/QdrantService.php
Updated constructor type hint to EmbeddingClient, replaced all generate() calls with embed() for file indexing, semantic search, and symbol indexing.
Command Updates
app/Commands/KnowledgeSearchStatusCommand.php
Updated dependency type to EmbeddingClient, renamed embedding test call from generate('test') to embed('test').
Docker Infrastructure Removal
docker-compose.yml, docker-compose.remote.yml, docker/embedding-server/Dockerfile, docker/embedding-server/server.py
Removed embedding-server service definition, related volume declarations, and Python Flask server implementation with SentenceTransformer model.
Package Version Constraint
composer.json
Updated the-shit/vector requirement from ^0.1.1 to ^0.2.
Test Embedding Mock & Provider Test Refactoring
tests/Support/MockEmbeddingService.php, tests/Feature/AppServiceProviderTest.php
Updated MockEmbeddingService to implement EmbeddingClient, renamed generate() to embed(), removed similarity(), added embedBatch(). Updated provider tests to expect NullEmbeddings for "none" provider and OllamaEmbeddings for "ollama" provider configuration.
Command & Service Unit Tests
tests/Feature/KnowledgeSearchStatusCommandTest.php, tests/Unit/Services/CodeIndexerServiceTest.php, tests/Unit/Services/QdrantServiceTest.php, tests/Unit/Services/HybridSearchTest.php
Updated mocks from EmbeddingServiceInterface to EmbeddingClient, changed all expectations from generate(...) to embed(...) across indexing, search, and status check tests.
Removed Test Suite
tests/Unit/Services/StubEmbeddingServiceTest.php
Deleted entire test file for removed StubEmbeddingService class.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 The embeddings hop anew,
From Gunicorn Docker's old crew,
To Ollama's swift embrace,
The server fades without a trace,
One library, one method true! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/146-ollama-byok-embeddings

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 PHPStan (2.1.46)

PHPStan was skipped because the config uses disallowed bootstrapFiles, bootstrapFile, or includes directives.


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.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 6, 2026

📊 Coverage Report

Metric Coverage Threshold Status
Lines 100% 95%

Files Below Threshold

File Coverage Uncovered Lines
app/Enums/ObservationType.php 0% None
app/Exceptions/Qdrant/QdrantException.php 0% None
app/Mcp/Servers/KnowledgeServer.php 0% None
app/Services/AgentHealthService.php 0% None

🏆 Synapse Sentinel Gate

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 6, 2026

🏆 Sentinel Certified

Tests & Coverage: 0 tests passed
Security Audit: No security vulnerabilities found
Pest Syntax: All test files use describe/it syntax


Add this badge to your README:

[![Sentinel Certified](https://img.shields.io/github/actions/workflow/status/conduit-ui/knowledge/gate.yml?label=Sentinel%20Certified&style=flat-square)](https://github.com/conduit-ui/knowledge/actions/workflows/gate.yml)

@github-actions github-actions Bot merged commit dfec5b0 into master Apr 6, 2026
1 of 2 checks passed
@github-actions github-actions Bot deleted the feat/146-ollama-byok-embeddings branch April 6, 2026 20:31
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.

feat: migrate embeddings from Gunicorn service to Ollama / BYOK providers

1 participant