检索
实现自定义检索策略
介绍
namespace App\Neuron;
use NeuronAI\Providers\AIProviderInterface;
use NeuronAI\RAG\Embeddings\EmbeddingsProviderInterface;
use NeuronAI\RAG\RAG;
use NeuronAI\RAG\RAG\Retrieval\RetrievalInterface;
use NeuronAI\RAG\RAG\Retrieval\SimilarityRetrieval;
use NeuronAI\RAG\VectorStore\VectorStoreInterface;
class WorkoutTipsAgent extends RAG
{
protected function retrieval(): RetrievalInterface
{
return new SimilarityRetrieval(
$this->resolveVectorStore(),
$this->resolveEmbeddingsProvider()
);
}
protected function provider(): AIProviderInterface
{
// 返回一个 AI 提供者实例...
}
protected function embeddings(): EmbeddingsProviderInterface
{
// 返回一个嵌入提供者实例...
}
protected function vectorStore(): VectorStoreInterface
{
// 返回一个向量存储实例...
}
}作为工具的检索
RAPTOR 检索模块
最后更新于