
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
multillama
Advanced tools
A TypeScript library for interacting with multiple language models via orchestrated pipelines.
MultiLlama 🦙🦙🦙 is an innovative TypeScript framework that helps developers use multiple Large Language Models (LLMs) simultaneously. Designed to unify different AI models, MultiLlama enables the creation of dynamic decision flows and manages complex processes, leveraging the strengths of each AI model together.
MultiLlama currently supports the following services:
To install MultiLlama, use npm:
npm install multillama
First, import the necessary classes and initialize the MultiLlama instance with your configuration.
import { MultiLlama, OpenAIAdapter, OllamaAdapter, GeminiAdapter } from 'multillama';
// Define service configurations
const openaiService = {
adapter: new OpenAIAdapter(),
apiKey: 'your-openai-api-key',
};
const ollamaService = {
adapter: new OllamaAdapter(),
};
const geminiService = {
adapter: new GeminiAdapter(),
apiKey: 'your-gemini-api-key',
};
// Define model configurations
const models = {
gpt4: {
service: openaiService,
name: 'gpt-4',
response_format: 'json',
},
llama: {
service: ollamaService,
name: 'llama-2',
response_format: 'text',
},
gemini: {
service: geminiService,
name: 'gemini-1',
response_format: 'text',
},
};
// Initialize MultiLlama
MultiLlama.initialize({
services: {
openai: openaiService,
ollama: ollamaService,
gemini: geminiService,
},
models,
spinnerConfig: {
loadingMessage: 'Processing...',
successMessage: 'Done!',
errorMessage: 'An error occurred.',
},
});
Use a specific model to generate a response to a prompt.
const multillama = new MultiLlama();
async function generateResponse() {
const prompt = 'What is the capital of France?';
const response = await multillama.useModel('gpt4', [{role: 'user', content: prompt}]);
console.log(response);
}
generateResponse();
Output:
Paris
Create a processing pipeline with conditional steps and branching.
import { Pipeline } from 'multillama';
async function processInput(userInput: string) {
const multillama = new MultiLlama();
const pipeline = new Pipeline<string>();
pipeline.setEnableLogging(true);
// Initial Step: Analyze the input
const initialStep = pipeline.addStep(async (input, context) => {
// Determine the type of question
const analysisPrompt = `Analyze the following question and categorize it: "${input}"`;
const response = await multillama.useModel('gpt4', [{role: 'user', content: analysisPrompt}]);
if (response.includes('weather')) {
return 'weather_question';
} else {
return 'general_question';
}
});
// Branch for weather-related questions
const weatherStep = pipeline.addStep(async (input, context) => {
const weatherPrompt = `Provide a weather report for "${context.initialInput}"`;
return await multillama.useModel('gpt4', [{role: 'user', content: weatherPrompt}]);
});
// Branch for general questions
const generalStep = pipeline.addStep(async (input, context) => {
return await multillama.useModel('llama', [{role: 'user', content: context.initialInput}]);
});
// Set up branching
pipeline.addBranch(initialStep, 'weather_question', weatherStep);
pipeline.addBranch(initialStep, 'general_question', generalStep);
// Execute the pipeline
const result = await pipeline.execute(userInput);
console.log(result);
}
processInput('What is the weather like in New York?');
Output:
The current weather in New York is sunny with a temperature of 25°C.
Happy Coding! 🦙🎉
FAQs
A TypeScript library for interacting with multiple language models via orchestrated pipelines.
We found that multillama demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.