SQLAutoVectorQueryEngine for multiple vector indexes #16984
Replies: 2 comments 3 replies
-
To combine or merge multiple collections, indexes, retrievers, or query engines in Chroma for use with a single from llama_index.core.query_engine.sql_vector_query_engine import SQLAutoVectorQueryEngine
from llama_index.core.indices.struct_store.sql_query import BaseSQLTableQueryEngine
from llama_index.core.query_engine.retriever_query_engine import RetrieverQueryEngine
# Assume sql_query_engine and vector_auto_retriever are already created instances
sql_query_engine = BaseSQLTableQueryEngine(...) # Your SQL query engine instance
vector_auto_retriever = RetrieverQueryEngine(...) # Your vector retriever instance
sql_tool_name = "SQL Tool"
sql_tool_description = "Description for SQL Tool"
vector_tool_name = "Vector Tool"
vector_tool_description = "Description for Vector Tool"
# Create the SQLAutoVectorQueryEngine instance
sql_auto_vector_query_engine = SQLAutoVectorQueryEngine.from_sql_and_vector_query_engines(
sql_query_engine=sql_query_engine,
sql_tool_name=sql_tool_name,
sql_tool_description=sql_tool_description,
vector_auto_retriever=vector_auto_retriever,
vector_tool_name=vector_tool_name,
vector_tool_description=vector_tool_description
) This approach combines the SQL and vector query engines into a single query engine that can handle queries for both types of data sources, allowing for seamless integration of structured and unstructured data insights [1][2]. |
Beta Was this translation helpful? Give feedback.
-
I need a single vector retriever for multiple vector indexes in the previous snippet. |
Beta Was this translation helpful? Give feedback.
-
Ultimately I want to use
SQLAutoVectorQueryEngine
. It needs as a parameter a vector query tool but I have multiple collections in Chroma and, as far as I know, each one makes for a different vector index, retriever and query engine and tool. How can I combine or merge the collections, indexes, retriever or query engines to get a single tool?Beta Was this translation helpful? Give feedback.
All reactions