Querying Knowledge Networks with llama-index-networks
Key point
ContributorService and NetworkQueryEngine connect multiple RAGs together like a network.
Details
With the llama-index-networks extension, external data providers can build RAG on top of their own data and expose it as a ContributorService to join the network. Consumers connect to multiple services with a NetworkQueryEngine to query each RAG at once.
As an example, Bob and Beth each put a QueryEngine built from their own documents behind a ContributorService, and Alex uses ContributorClient.from_config_file to connect to both services, then attaches a Groq LLM to configure a NetworkQueryEngine.from_args. From there, calling query() just like a normal QueryEngine sends the request to all contributors, and the responses are stored as new Nodes and then merged by a ResponseSynthesizer. Async calls are also supported.
The key point is that instead of providers handing over raw data, they deploy an already well-built query layer as-is.
- Provider side:
ContributorServicewraps a QueryEngine as a REST service. - Consumer side:
NetworkQueryEnginegathers responses from multiple contributors to produce a unified answer. - Configuration: service/client information and API keys are placed in a dotenv file.
A suggested use case is a RAG marketplace. Newspapers or publishers could supply their content in the form of RAG, and users could assemble a query system with richer knowledge. Another possibility is an internal network for organizations with multiple operating units, like franchises, where instead of one centralized giant RAG, each branch's RAG is combined for more efficient lookup.
However, it's emphasized that since this presupposes data sharing, compliance with privacy and security is important. An actual demo can be found in the examples/demo folder of the llama-index-networks repository on GitHub.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.