fix readme

This commit is contained in:
yichuan520030910320
2025-07-22 22:03:19 -07:00
parent 0544f96b79
commit 2760e99e18

View File

@@ -112,14 +112,12 @@ builder.add_text("Neural networks process complex data")
builder.add_text("Leann is a great storage saving engine for RAG on your macbook") builder.add_text("Leann is a great storage saving engine for RAG on your macbook")
builder.build_index("knowledge.leann") builder.build_index("knowledge.leann")
# 2. Search with real-time embeddings # 2. Search with real-time embeddings
searcher = LeannSearcher("knowledge.leann") results = LeannSearcher("knowledge.leann").search("programming languages", top_k=2)
results = searcher.search("programming languages", top_k=2, recompute_beighbor_embeddings=True)
# 3. Chat with LEANN # 3. Chat with LEANN
chat = LeannChat(index_path="knowledge.leann", llm_config={"type": "ollama", "model": "llama3.2:1b"}) llm_config={"type": "ollama", "model": "llama3.2:1b"}
response = chat.ask( response = LeannChat(index_path="knowledge.leann",llm_config=llm_config ).ask(
"Compare the two retrieved programming languages and say which one is more popular today.", "Compare the two retrieved programming languages and say which one is more popular today.",
top_k=2, top_k=2,
recompute_beighbor_embeddings=True,
) )
``` ```