Usage / Quickstart

This page shows how to quickly get started with LocalSearch.

Quickstart Example

First, import the LLM and engine:

from LocalSearch.backend.llms.GroqLLM import GroqLLM
from LocalSearch.backend.engine import SearchEngine

Initialize the LLM and the search engine:

llm = GroqLLM(api_key='gsk_********************************')
engine = SearchEngine(directory_path=r"C:\your\documents\folder", llm=llm)

Perform a search:

Use LocalSearch.backend.engine.SearchEngine.search() to query documents.

result = engine.search("what is the most important thing in life?", top_k=20)

Start the chat interface:

Use LocalSearch.backend.engine.SearchEngine.web() to launch a server with a specified address and port that hosts the engine for you to query in an interactive chat-like interface.

engine.web()

Notes

  • Replace directory_path with the path to your documents folder.

  • GroqLLM requires a valid api_key.

  • search() returns a list of top k results.

  • web() launches a local browser-based chat interface.