feat(brain): configurable embedding model, default to EmbeddingGemma
Make embedding model swappable via BRAIN_EMBEDDING_MODEL env var. Switch default from nomic-embed-text to embeddinggemma (Gemma 3 based, 2x better cluster separation in benchmarks). Default Ollama URL now points to ollama.lan (Linux homelab GPU). Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
dfd3dde7b1
commit
43b470257b
3 changed files with 6 additions and 3 deletions
1
Boot.php
1
Boot.php
|
|
@ -78,6 +78,7 @@ class Boot extends ServiceProvider
|
|||
ollamaUrl: config('mcp.brain.ollama_url', 'http://localhost:11434'),
|
||||
qdrantUrl: config('mcp.brain.qdrant_url', 'http://localhost:6334'),
|
||||
collection: config('mcp.brain.collection', 'openbrain'),
|
||||
embeddingModel: config('mcp.brain.embedding_model', 'nomic-embed-text'),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use Illuminate\Support\Facades\Log;
|
|||
|
||||
class BrainService
|
||||
{
|
||||
private const EMBEDDING_MODEL = 'nomic-embed-text';
|
||||
private const DEFAULT_MODEL = 'embeddinggemma';
|
||||
|
||||
private const VECTOR_DIMENSION = 768;
|
||||
|
||||
|
|
@ -19,6 +19,7 @@ class BrainService
|
|||
private string $ollamaUrl = 'http://localhost:11434',
|
||||
private string $qdrantUrl = 'http://localhost:6334',
|
||||
private string $collection = 'openbrain',
|
||||
private string $embeddingModel = self::DEFAULT_MODEL,
|
||||
) {}
|
||||
|
||||
/**
|
||||
|
|
@ -32,7 +33,7 @@ class BrainService
|
|||
{
|
||||
$response = Http::timeout(30)
|
||||
->post("{$this->ollamaUrl}/api/embeddings", [
|
||||
'model' => self::EMBEDDING_MODEL,
|
||||
'model' => $this->embeddingModel,
|
||||
'prompt' => $text,
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -82,9 +82,10 @@ return [
|
|||
*/
|
||||
|
||||
'brain' => [
|
||||
'ollama_url' => env('BRAIN_OLLAMA_URL', 'http://localhost:11434'),
|
||||
'ollama_url' => env('BRAIN_OLLAMA_URL', 'http://ollama.lan:11434'),
|
||||
'qdrant_url' => env('BRAIN_QDRANT_URL', 'http://localhost:6334'),
|
||||
'collection' => env('BRAIN_COLLECTION', 'openbrain'),
|
||||
'embedding_model' => env('BRAIN_EMBEDDING_MODEL', 'embeddinggemma'),
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
|||
Reference in a new issue