Socket
Book a DemoInstallSign in
Socket

@sumor/llm-connector

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sumor/llm-connector

This is a llm connector for multiple cloud providers.

Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
110
-44.16%
Maintainers
1
Weekly downloads
 
Created
Source

llm-connector

A Sumor Cloud Tool.
More Documentation

This is a llm connector for multiple cloud providers.

CI Test Coverage Audit

Installation

npm i @sumor/llm-connector --save

Prerequisites

Node.JS version

Require Node.JS version 16.x or above

require Node.JS ES module

As this package is written in ES module, please change the following code in your package.json file:

{
  "type": "module"
}

Usage

Chat

import Model from '@sumor/llm-connector'

const model = new Model({
  type: 'openai',
  key: '123'
})

const response = await model.chat('gpt-3.5-turbo', [
  {
    role: 'system',
    content: 'You are a helpful assistant.'
  },
  {
    role: 'user',
    content: 'Hello'
  }
])

console.log(response)
// Output: { role: 'assistant', content: 'Hello, how can I help you today?' }

Custom API Endpoint URL

import Model from '@sumor/llm-connector'

const model = new Model({
  type: 'openai',
  key: '123',
  endpoint: {
    chat: 'https://api.openai.com/v1/chat'
  }
})

Keywords

llm

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