PHP code example of neuron-core / raptor-retrieval
1. Go to this page and download the library: Download neuron-core/raptor-retrieval library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
neuron-core / raptor-retrieval example snippets
use NeuronAI\RAG\Retrieval\RetrievalInterface;
use NeuronCore\RaptorRetrieval\RaptorRetrieval;
class WorkoutTipsAgent extends RAG
{
protected function retrieval(): RetrievalInterface
{
return new RaptorRetrieval(
$this->resolveVectorStore(),
$this->resolveEmbeddingsProvider(),
$this->resolveProvider(), // Used for summarization
);
}
protected function embeddings(): EmbeddingsProviderInterface
{
return new ...
}
protected function vectorStore(): VectorStoreInterface
{
return new ...
}
}
use NeuronAI\RAG\Retrieval\RetrievalInterface;
use NeuronCore\RaptorRetrieval\RaptorRetrieval;
use NeuronCore\RaptorRetrieval\Clustering\SimilarityClustering;
class WorkoutTipsAgent extends RAG
{
protected function retrieval(): RetrievalInterface
{
return new RaptorRetrieval(
$this->resolveVectorStore(),
$this->resolveEmbeddingsProvider(),
$this->resolveProvider(), // Used for summarization
new SimilarityClustering()
);
}
protected function embeddings(): EmbeddingsProviderInterface
{
return new ...
}
protected function vectorStore(): VectorStoreInterface
{
return new ...
}
}
use NeuronAI\RAG\Retrieval\RetrievalInterface;
use NeuronCore\RaptorRetrieval\RaptorRetrieval;
use NeuronCore\RaptorRetrieval\Clustering\GaussianMixtureClustering;
class WorkoutTipsAgent extends RAG
{
protected function retrieval(): RetrievalInterface
{
return new RaptorRetrieval(
$this->resolveVectorStore(),
$this->resolveEmbeddingsProvider(),
$this->resolveProvider(), // Used for summarization
new GaussianMixtureClustering()
);
}
protected function embeddings(): EmbeddingsProviderInterface
{
return new ...
}
protected function vectorStore(): VectorStoreInterface
{
return new ...
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.