Transform your text into vector representations! Embeddings let you add Retrieval-Augmented Generation () into your AI applications.
Available Embeddings Providers
The framework already includes the following embeddings provider.
Ollama
With Ollama you can run embedding models locally. Documentation -
namespace App\Neuron;
use NeuronAI\RAG\Embeddings\EmbeddingsProviderInterface;
use NeuronAI\RAG\Embeddings\OllamaEmbeddingsProvider;
use NeuronAI\RAG\RAG;
class MyRAG extends RAG
{
...
protected function embeddings(): EmbeddingsProviderInterface
{
return new OllamaEmbeddingsProvider(
model: 'OLLAMA_EMBEDDINGS_MODEL'
);
}
}
Voyage AI
namespace App\Neuron;
use NeuronAI\RAG\Embeddings\EmbeddingsProviderInterface;
use NeuronAI\RAG\Embeddings\VoyageEmbeddingsProvider;
use NeuronAI\RAG\RAG;
class MyRAG extends RAG
{
...
protected function embeddings(): EmbeddingsProviderInterface
{
return new VoyageEmbeddingsProvider(
key: 'VOYAGE_API_KEY',
model: 'VOYAGE_EMBEDDINGS_MODEL'
);
}
}
OpenAI
namespace App\Neuron;
use NeuronAI\RAG\Embeddings\EmbeddingsProviderInterface;
use NeuronAI\RAG\Embeddings\OpenAIEmbeddingsProvider;
use NeuronAI\RAG\RAG;
class MyRAG extends RAG
{
...
protected function embeddings(): EmbeddingsProviderInterface
{
return new OpenAIEmbeddingsProvider(
key: 'OPENAI_API_KEY',
model: 'OPENAI_EMBEDDINGS_MODEL'
);
}
}
Implement a new Provider
To create a custom provider you just have to extend the AbstractEmbeddingsProvider class. This class already implement the framework specific methods and let's you free to implement the only provider specific HTTP call into the embedText() method: