Quickstart
This quickstart shows you instructions on how to integrate your model of choice and then generate your first response.
Installation
sh
npm install intelligent@latestA deeper guide into the installation can be found here
Make your first request
Use the response method to send an API request and generate a text response.
ts
const { GeminiService } = require("intelligent");
const ai = new GeminiService("API-KEY");
// Default model is `gemini-1.5-flash`.
ai.response("Why is the sky blue?").then((res) => {
console.log(res);
});ts
const { OpenAIService } = require("intelligent");
const ai = new OpenAIService("API-KEY");
// Default model is `gpt-4o-mini`.
ai.response("Why is the sky blue?").then((res) => {
console.log(res);
});ts
const { ClaudeService } = require("intelligent");
const ai = new ClaudeService("API-KEY");
// Default model is `claude-3-5-sonnet-20241022`.
ai.response("Why is the sky blue?").then((res) => {
console.log(res);
});ts
const { OllamaService } = require("intelligent");
const ai = new OllamaService();
// Make sure you have an Ollama model installed locally.
// Default model is `llava`.
// https://github.com/ollama/ollama/blob/main/docs/README.md
ai.response("Why is the sky blue?").then((res) => {
console.log(res);
});ts
const { HuggingFaceService } = require("intelligent");
const ai = new HuggingFaceService("API-KEY");
// Default model is `gpt2`.
ai.response("Why is the sky blue?").then((res) => {
console.log(res);
});ts
const { GrokService } = require("intelligent");
const ai = new GrokService("API-KEY");
// Default model is `grok-2-1212`.
ai.response("Why is the sky blue?").then((res) => {
console.log(res);
});