-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathlancedb_real_wow.py
More file actions
21 lines (17 loc) · 747 Bytes
/
lancedb_real_wow.py
File metadata and controls
21 lines (17 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""LanceDB Vector Store - Agent-First Example"""
from praisonaiagents import Agent
# Agent-first approach: use knowledge parameter with LanceDB
agent = Agent(
name="Assistant",
instructions="You are a helpful assistant with access to documents.",
knowledge={"sources": ["./docs/guide.pdf"], "vector_store": {"provider": "lancedb", "path": "/tmp/lancedb_test"}}
)
# Chat - agent uses knowledge for RAG
response = agent.chat("What information do you have?")
print(f"Response: {response}")
print("PASSED: LanceDB with Agent")
# --- Advanced: Direct LanceDB Usage ---
# import lancedb
# db = lancedb.connect("/tmp/lancedb_test")
# data = [{"id": "1", "text": "ML is AI", "vector": [0.1] * 128}]
# table = db.create_table("demo", data)