npmai

0.1.8 · active · verified Wed Apr 15

npmai is a lightweight Python package (current version 0.1.8) designed to bridge the gap between users and open-source LLMs. It allows connection with Ollama and over 10 other powerful models instantly, without requiring local installation, user logins, or API keys. It also facilitates the development of RAG Agents without local or cloud installations, offering free and unlimited usage. The project shows a consistent release cadence with minor version updates addressing features and bug fixes.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use `npmai` to interact with an open-source LLM (like llama3.2) without any local setup. It initializes the `Ollama` class, sends a prompt, and prints the generated response.

from npmai import Ollama

# Initialize the Ollama model (llama3.2 is an example)
llm = Ollama(model="llama3.2", temperature=0.5)

# Define your prompt
prompts = "Hello, tell me a short summary of NPMAI"

# Invoke the LLM to get a response
result = llm.invoke(prompts)

# Print the result
print(result)

view raw JSON →