One click and upload posts on all Major Social Media Platforms in free of cost where you will just upload video nothing else of automatically npmai will generate meta data including Captions.
NPM Rag A.I is a beautiful, easy-to-use web application that lets you instantly create and talk to your own private or public knowledge bases using RAG (Retrieval-Augmented Generation).
Develop RAG Agents with all media type including YT Videos in just 5 lines of code and without installing more than one library npmai and without using local resource in FREE and unlimited small scale production services.
# Install if not already
pip install npmai
# Basic usage
from npmai import Ollama
llm = Ollama(
model="llama3.2",
temperature=0.5
)
prompts = "Hello, tell me a short summary of NPMAI"
result = llm.invoke(prompts)
print(result)
### Java ###
import java.net.URI;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
String json = "{\"prompt\": \"Hello world\", \"model\": \"llama3.2\", \"temperature\": 0.3}";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://npmai-api.onrender.com/llm"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
#Memory(Memory is only in npmai library which is on python)
from npmai import Ollama,Memory
llm = Ollama(
model="internlm:7b",
temperature=0.5
)
memory=Memory(
"unique_file_name"
)
memory_prompt=load_memory_variables()
prompts=f"{memory_prompt} Hello my name is sonu kumar how are you"
result= llm.invoke(prompts)
save_context(prompts,result)
print(result)
# If you want to delete memory:-
"Then just call this method"
memory.clear_memory()
"It will remove the file in which conversation was stored"
#Rag
from npmai import Rag
rag=Rag(
files="file_name",
query="Any question you want to ask if you will ask here you must provide DB_PATH,Model_name",
DB_PATH="Any random name this name will save you file",
temperature=0.5 or any other,
model="qwen2.5-coder:7b"
)
response=rag.send()
print(response)
#If you want to upload your documents for long term:-
from npmai import Rag
rag=Rag(
files=["files_name"],
DB_PATH="Enter name which is very unique and relevent to your document.",
link="If you want to upload youtube videos as document otherwise do not add this parameter",
output_path="Only if you are adding link parameter",
secret_key="If you want to make your document very public so add unique password here",
public=True("If you do not want to add password then and do not enter anything in secret_key parameter."),
Upload=True(If you selected any of these two param:-1.secret_key or 2.public)
)
response=rag.send()
print(response)
#Whatever file are there just send.
# If you just want conversion of your file content in text:-
from npmai import rag
rag = Rag(
files=["files_name"]
)
response= rag.send()
print(response)
async function send() {
const HF_API = "https://sonuramashish22028704-npmeduai.hf.space";
// 1. Prepare Multipart Data
const formData = new FormData();
formData.append("query", this.query);
formData.append("DB_PATH", this.db_path);
formData.append("temperature", this.temperature);
formData.append("model", this.model);
// For Node.js, use: formData.append("file", await fs.openAsBlob(this.files));
formData.append("file", this.files);
// 2. Setup Timeout (600 seconds)
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 600000);
try {
const res = await fetch(HF_API, {
method: "POST",
body: formData,
signal: controller.signal
// Note: DO NOT manually set 'Content-Type'; fetch does this automatically for FormData
});
clearTimeout(timeoutId); // Clean up timer
if (!res.ok) throw new Error(`HTTP error! status: ${res.status}`);
const data = await res.json();
return { response: data.response };
} catch (error) {
if (error.name === 'AbortError') {
return { error: "Request timed out after 600 seconds" };
}
return { error: error.message };
}
}
### Python ###
# Using temperature
from npmai import Ollama
llm = Ollama(
model="llama3.2",
temperature=0.5 # here passs your temperature parameter
)
prompts = "Hello, tell me a short summary of NPMAI"
result = llm.invoke(prompts)
print(result)
### Java ###
import java.net.URI;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
String json = "{\"prompt\": \"Hello world\", \"model\": \"internlm:7b\", \"temperature\": 0.3}";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://npmai-api.onrender.com/llm"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
# Validated Schemas
from npmai import Ollama
llm = Ollama(
model="llama3.2",
temperature=0.7,
validate_schema=#Here pass yor schema
)
prompts = "Hello, tell me a short summary of NPMAI"
result = llm.invoke(prompts)
print(result)
### Python ###
# Gemma3:12b (Latest model with 2026 year knowledge cutoff)
from npmai import Ollama
llm = Ollama(
model="gemma3:12b",
temperature=0.7
)
prompts = "Hello, tell me about recent UGC changes and also tell me is Khamenei is assasinated"
result = llm.invoke(prompts)
print(result)
### Java ###
import java.net.URI;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
String json = "{\"prompt\": \"Hello world\", \"model\": \"gemma3:12b\", \"temperature\": 0.3}";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://npmai-api.onrender.com/llm"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}}
# CodeLLaMA-Instruct 7B
from npmai import Ollama
llm = Ollama(
model="codellama:7b-instruct",
temperature=0.7
)
prompts = "Hello, tell me a short summary of NPMAI"
result = llm.invoke(prompts)
print(result)
### Java ###
import java.net.URI;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
String json = "{\"prompt\": \"Hello world\", \"model\": \"codellama:7b-instruct\", \"temperature\": 0.3}";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://npmai-api.onrender.com/llm"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
# Qwen3.5:9b
from npmai import Ollama
llm = Ollama(
model="qwen3.5:9b",
temperature=0.7
)
prompts = "Hello, tell me a short summary of NPMAI"
result = llm.invoke(prompts)
print(result)
### Java ###
import java.net.URI;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
String json = "{\"prompt\": \"Hello world\", \"model\": \"qwen3.5:9b\", \"temperature\": 0.3}";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://npmai-api.onrender.com/llm"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
# Mistral 7B Instruct
from npmai import Ollama
llm = Ollama(
model="mistral:7b",
temperature=0.7
)
prompts = "Hello, tell me a short summary of NPMAI"
result = llm.invoke(prompts)
print(result)
### Java ###
import java.net.URI;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
String json = "{\"prompt\": \"Hello world\", \"model\": \"mistral:7b\", \"temperature\": 0.3}";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://npmai-api.onrender.com/llm"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
# Qwen-2.5-Coder 7B
from npmai import Ollama
llm = Ollama(
model="qwen2.5-coder:7b",
temperature=0.7
)
prompts = "Hello, tell me a short summary of NPMAI"
result = llm.invoke(prompts)
print(result)
### Java ###
import java.net.URI;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
String json = "{\"prompt\": \"Hello world\", \"model\": \"qwen2.5-coder:7b\", \"temperature\": 0.3}";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://npmai-api.onrender.com/llm"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
# Phi-3 Medium (8B)
from npmai import Ollama
llm = Ollama(
model="phi3:medium",
temperature=0.7
)
prompts = "Hello, tell me a short summary of NPMAI"
result = llm.invoke(prompts)
print(result)
### Java ###
import java.net.URI;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
String json = "{\"prompt\": \"Hello world\", \"model\": \"phi3:medium\", \"temperature\": 0.3}";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://npmai-api.onrender.com/llm"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
# Falcon 7B Instruct
from npmai import Ollama
llm = Ollama(
model="falcon:7b-instruct",
temperature=0.7
)
prompts = "Hello, tell me a short summary of NPMAI"
result = llm.invoke(prompts)
print(result)
### Java ###
import java.net.URI;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
String json = "{\"prompt\": \"Hello world\", \"model\": \"falcon:7b-instruct\", \"temperature\": 0.3}";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://npmai-api.onrender.com/llm"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
# Baichuan-2 (example)
from npmai import Ollama
llm = Ollama(
model="maxkb/baichuan2:13b-chat",
temperature=0.7
)
prompts = "Hello, tell me a short summary of NPMAI"
result = llm.invoke(prompts)
print(result)
### Java ###
import java.net.URI;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
String json = "{\"prompt\": \"Hello world\", \"model\": \"maxkb/baichuan2:13b-chat\", \"temperature\": 0.3}";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://npmai-api.onrender.com/llm"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
# InternLM-Chat-7B
from npmai import Ollama
llm = Ollama(
model="internlm2:7b",
temperature=0.7
)
prompts = "Hello, tell me a short summary of NPMAI"
result = llm.invoke(prompts)
print(result)
### Java ###
import java.net.URI;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
String json = "{\"prompt\": \"Hello world\", \"model\": \"internlm2:7b\", \"temperature\": 0.3}";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://npmai-api.onrender.com/llm"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
# Vicuna 7B
from npmai import Ollama
llm = Ollama(
model="vicuna:7b",
temperature=0.7
)
prompts = "Hello, tell me a short summary of NPMAI"
result = llm.invoke(prompts)
print(result)
### Java ###
import java.net.URI;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
String json = "{\"prompt\": \"Hello world\", \"model\": \"vicuna:7b\", \"temperature\": 0.3}";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://npmai-api.onrender.com/llm"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
“Bihar Viral Boy” — Challenged Chief Minister & inspired millions at age 11.
TEDx Speaker (13) — Shared "Zid aur Junoon" journey on the global stage.
Open Source Innovator — Creating tools for education and democracy.
Self-taught Engineer — No formal CS background, just pure grit and internet.
✨ Tech Toolbox
🌟 Major Projects & Repos
NPM-AutoCode-AI: A self healing PC Automation Agent
NPM-Debate-AI: 4 AI Models Infinite Debate Arena
npmai: Use Ollama without installation and setup,Develop RAG Agent without having load on PC and without writing bunhc of codes 400 lines of code in 5 lines.
NPM-Edu-AI Helper: Free large-file study tool for students.
NPM-Youtube-Automation: Fully automated video upload workflow.
NPM-Journalist: Help in achieving Ideal Democracy and solving people and your own problems with govt with ANNONYMITY
Allen Career Institute & DDPS School Kota 100% Scholarship.
Supported by Lok Sabha Speaker & MIT/Oxford circles. &By Senior Software,AI Engineer:-Lokesh Chaudhary sir (also a DDPS CS& Robotics Teacher,Mentor and Reasercher)
💬 Social Impact
Building a 100m+ youth movement. Blending rural activism with world-class tech to create ethical, free AI tools for "broke students."
🏗️ Mission & Goals
Democratize education, AI, & civic tech for everyone. Give rural students a global stage and affordable tools. Transform adversity into action.
🧠 "Rural-Zero to Revolution"
“No matter where you start, you can be the change. I choose code, courage, and kindness. Let's build... together.”