3.0.10
Retrieval as a tool
Built-in tool to build agents with on-demand RAG (Retrieval Augmented Generation)
capabilities instead of the authomatic context injection provided by the RAG component.
use NeuronAI\Tools\Toolkits\RetrievalTool;
use NeuronAI\RAG\Retrieval\SimilarityRetrieval;
class AgenticRAG extends Agent
{
protected function provider(): AIProviderInterface
{...}
protected function instructions(): string
{...}
protected function tools(): array
{
return [
RetrievalTool::make(
new SimilarityRetrieval(
$this->vectorStore(),
$this->embeddings()
)
),
];
}
protected function vectorStore(): VectorStoreInterface
{
return new FileVectorStore(__DIR__);
}
protected function embeddings(): EmbeddingsProviderInterface
{
return new OllamaEmbeddingsProvider(
model: 'OLLAMA_EMBEDDINGS_MODEL'
);
}
}Learn more on the documentation.