Socket
Socket
Sign inDemoInstall

@memberjunction/ai

Package Overview
Dependencies
Maintainers
4
Versions
193
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@memberjunction/ai

MemberJunction: AI Module - LLMs and other AI services wrapped and abstracted for use in MemberJunction


Version published
Maintainers
4
Created
Source

@memberjunction/ai

The @memberjunction/ai library provides a generic layer for using any number of different AI models and classes of AI models with an abstract approach so that code is not closely coupled to a particular vendor's LLM. By using this library you can easily switch your code from one AI model to another.

The way it works you would install this package and then install the preferred AI model package - for example @memberjunction/ai-openai or @memberjunction/ai-mistral. When you do that you can then do one of two approaches for getting your LLM classes to use:

  1. Directly instantiate the sub-class from the selected package(s). In the case of Mistral, you could const mistralLLM = new MistralLLM(apiKey);
  2. Alternatively, if you want to further abstract your code base so that you have run time optionality, you could instead use the MemberJunction Class Factory which is part of the @memberjunction/global package with code along these lines: const genericLLM = MJGlobal.Instance.ClassFactory.CreateInstance<BaseLLM>(BaseLLM, 'MistralLLM', apiKey);

When you use the ClassFactory, you get the highest registered class for a given base class, so you automatically get whatever package is installed for the implementation of the generic layer.

FAQs

Package last updated on 23 May 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