AutoRetriever
with ChatAgent
, and further combine AutoRetriever
with RolePlaying
by using Function Calling
.
4 main parts included:
VectorRetriever
as an example.
Set embedding model, we will use OpenAIEmbedding
as the embedding model, so we need to set the OPENAI_API_KEY
in below.
Unstructured Module
to splite the content into small chunks, the content will be splited automacitlly with its chunk_by_title
function, the max character for each chunk is 500 characters, which is a suitable length for OpenAIEmbedding
. All the text in the chunks will be embed and stored to the vector storage instance, it will take some time, please wait..
top_k
value and similarity_threshold
value with your needs.
The returned dictionary list includes:
AutoRetriever
with default settings. It uses OpenAIEmbedding
as default embedding model and Qdrant
as default vector storage.
What you need to do is:
AutoRetriever
with one ChatAgent
.
Let’s set an agent function, in this function we can get the response by providing a query to this agent.
RETRIEVAL_FUNCS
with RolePlaying
by applying Function Calling
.