Socket
Socket
Sign inDemoInstall

llm-interface

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

llm-interface

A simple, unified interface for integrating and interacting with multiple Large Language Model (LLM) APIs, including OpenAI, Anthropic, Google Gemini, Groq, and LlamaCP.


Version published
Weekly downloads
79
decreased by-1.25%
Maintainers
1
Weekly downloads
 
Created
Source

llm-interface

Star on GitHub Fork on GitHub Watch on GitHub

Version 0.0.1 License: MIT Built with Node.js

Introduction

The LLM Interface project is a versatile and comprehensive wrapper designed to interact with multiple Large Language Model (LLM) APIs. It simplifies integrating various LLM providers, including OpenAI, Anthropic, Google Gemini, Groq, and LlamaCP, into your applications. This project aims to provide a simplified and unified interface for sending messages and receiving responses from different LLM services, making it easier for developers to work with multiple LLMs without worrying about the specific intricacies of each API.

Features

  • Unified Interface: A single, consistent interface to interact with multiple LLM APIs.
  • Dynamic Module Loading: Automatically loads and manages different LLM handlers.
  • Error Handling: Robust error handling mechanisms to ensure reliable API interactions.
  • Extensible: Easily extendable to support additional LLM providers as needed.

Dependencies

The project relies on several npm packages and APIs. Here are the primary dependencies:

  • dotenv: For managing environment variables.
  • axios: For making HTTP requests (used in LlamaCP).
  • @anthropic-ai/sdk: SDK for interacting with the Anthropic API.
  • @google/generative-ai: SDK for interacting with the Google Gemini API.
  • groq-sdk: SDK for interacting with the Groq API.
  • openai: SDK for interacting with the OpenAI API.

Installation

To install the llm-interface package, you can use npm:

npm install llm-interface

Usage

Example

const handlers = require("llm-interface");

const openai = new handlers.openai(process.env.OPENAI_API_KEY);
const message = {
  model: "gpt-3.5-turbo",
  messages: [
    { role: "system", content: "You are a helpful assistant." },
    { role: "user", content: "Explain the importance of low latency LLMs." },
  ],
};
openai
  .sendMessage(message, { max_tokens: 150 })
  .then((response) => {
    console.log(response);
  })
  .catch((error) => {
    console.error(error);
  });

Additional usage examples and API reference are available.

Running Tests

The project includes tests for each LLM handler. To run the tests, use the following command:

npm test

Contribute

Contributions to this project are welcome. Please fork the repository and submit a pull request with your changes or improvements.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Share

Twitter Facebook LinkedIn

Keywords

FAQs

Package last updated on 12 Jun 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc