In this section, you’ll learn (to):

  • build an assistant
  • embed a tool (Google search)

Install leicht

First things first, install the leicht package. You can install it using pip or from source.

$ pip install leicht

Build an Assistant

We’ll be building an assistant using the Assistant class. The LLM of choice in this example is G4F 1.

Here, we’ll add the “search” tool to allow the LLM to look up resources online.

app.py
from leicht import Assistant
from leicht.tools import Google

# Build an assistant
assistant = Assistant(
  "You're a helpful assistant.", # System prompt
  llm="g4f", # Specify the g4f LLM *trial only*
  tools=[Google()]
)

# Run the assistant
assistant.run("Is The Matrix 5 out yet?")

1G4F – Although G4F is free, it should ONLY be used for trial and NOT for production.

Read More

Learn more about Leicht.