Skip to content

neuron-core/php-vector

PHPVector adapter for Neuron AI framework

This is the PHPVector adapter for the Neuron AI framework.

Install

composer require neuron-core/php-vector

Use in RAG

use NeuronAI\PHPVector\PHPVector;

class MyRAG extends RAG
{
    ...

    protected function vectorStore(): VectorStoreInterface
    {
        return new PHPVector(
            database: new VectorDatabase(path: '/var/data/mydb'),
            topK: 5
        );
    }
}

Use in Retrieval components

use NeuronAI\PHPVector\PHPVector;

class MyAgent extends Agent
{
    ...

    protected function tools(): array
    {
        return [
            RetrievalTool::make(
                new SimilarityRetrieval(
                    $this->vectorStore(),
                    $this->embeddings()
                )
            ),
        ];
    }

    protected function vectorStore(): VectorStoreInterface
    {
        return new PHPVector(
            database: new VectorDatabase(path: '/var/data/mydb'),
            topK: 5
        );
    }

    protected function embeddings(): EmbeddingsProviderInterface
    {
        return new OllamaEmbeddingsProvider(
            model: 'OLLAMA_EMBEDDINGS_MODEL'
        );
    }
}

Official documentation

Go to the official documentation

About

Adapter for PHPVector database for Neuron AI framework

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages