mirror of
https://github.com/lancedb/lancedb.git
synced 2025-12-22 21:09:58 +00:00
fix
This commit is contained in:
@@ -67,6 +67,25 @@ async def ingest_data(content: str) -> str:
|
||||
```
|
||||
### Retreive data tool
|
||||
|
||||
```python
|
||||
@mcp.tool()
|
||||
async def retrieve_data(query: str, limit: int = 5) -> str:
|
||||
"""
|
||||
Search db using vector search
|
||||
Args:
|
||||
query: The search query
|
||||
limit: Maximum number of results to return
|
||||
"""
|
||||
tbl = db[TABLE_NAME]
|
||||
rs = tbl.search(query).limit(limit).to_list()
|
||||
data = [
|
||||
r["text"] for r in rs
|
||||
]
|
||||
if not data:
|
||||
return "No relevant data found."
|
||||
|
||||
return "\n\n".join(data)
|
||||
```
|
||||
This function takes a string and limit as input and searches the LanceDB table for the most relevant memories.
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user