Skip to main content

A toolkit for quickly implementing llm powered functionalities.

Project description

llm-axe 🪓

PyPI - Version PyPI - Downloads Static Badge GitHub forks Hits

llm-axe is a handy little axe for developing llm powered applications.

It allows you to quickly implement complex interactions for local LLMs, such as function callers, online agents, pre-made generic agents, and more.

Installation

pip install llm-axe

Example Snippets

  A function calling LLM can be created with just 3 lines of code:
  No need for premade schemas, templates, special prompts, or specialized functions.

prompt = "I have 500 coins, I just got 200 more. How many do I have?"

llm = OllamaChat(model="llama3:instruct")
fc = FunctionCaller(llm, [get_time, get_date, get_location, add, multiply])
result = fc.get_function(prompt)
  • Online Agent
prompt = "Tell me a bit about this website:  https://toscrape.com/?"
llm = OllamaChat(model="llama3:instruct")
searcher = OnlineAgent(llm)
resp = searcher.search(prompt)

#output: Based on information from the internet, it appears that https://toscrape.com/ is a website dedicated to web scraping.
# It provides a sandbox environment for beginners and developers to learn and validate their web scraping technologies...
  • PDF Reader
llm = OllamaChat(model="llama3:instruct")
files = ["../FileOne.pdf", "../FileTwo.pdf"]
agent = PdfReader(llm)
resp = agent.ask("Summarize these documents for me", files)
  • Data Extractor
llm = OllamaChat(model="llama3:instruct")
info = read_pdf("../Example.pdf")
de = DataExtractor(llm, reply_as_json=True)
resp = de.ask(info, ["name", "email", "phone", "address"])

#output: {'Name': 'Frodo Baggins', 'Email': 'frodo@gmail.com', 'Phone': '555-555-5555', 'Address': 'Bag-End, Hobbiton, The Shire'}

See more complete examples

How to setup llm-axe with your own LLM

Features

  • Local LLM internet access with Online Agent
  • PDF Document Reader Agent
  • Premade utility Agents for common tasks
  • Compatible with any LLM, local or externally hosted
  • Built-in support for Ollama

Important Notes

The results you get from the agents are highly dependent on the capability of your LLM. An inadequate LLM will not be able to provide results that are usable with llm-axe

Testing in development was done using llama3 8b:instruct 4 bit quant

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_axe-1.1.2.tar.gz (14.4 kB view hashes)

Uploaded Source

Built Distribution

llm_axe-1.1.2-py3-none-any.whl (14.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page