cognee/cognee/tasks/chunks/query_chunks.py
Igor Ilic 15b7b8ef2b fix: Resolve issue with table names in SQL commands
Some SQL commands require lowercase characters in table names unless table name is wrapped in quotes. Renamed all new tables to use lowercase

Fix COG-677
2024-11-20 14:54:35 +01:00

17 lines
520 B
Python

from cognee.infrastructure.databases.vector import get_vector_engine
async def query_chunks(query: str) -> list[dict]:
"""
Parameters:
- query (str): The query string to filter nodes by.
Returns:
- list(dict): A list of objects providing information about the chunks related to query.
"""
vector_engine = get_vector_engine()
found_chunks = await vector_engine.search("document_chunk_text", query, limit = 5)
chunks = [result.payload for result in found_chunks]
return chunks