cognee/cognee/tasks/chunking/query_chunks.py
Boris dc187a81d7
feat: migrate search to tasks (#144)
* fix: don't return anything on health endpoint

* feat: add alembic migrations

* feat: align search types with the data we store and migrate search to tasks
2024-10-07 14:41:35 +02:00

17 lines
507 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("chunks", query, limit = 5)
chunks = [result.payload for result in found_chunks]
return chunks