0.6.0 • Published 5 months ago

@cityssm/sectorflow v0.6.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

SectorFlow API for Node

DeepSource

An unofficial wrapper around the SectorFlow API, allowing you to easily connect to over a dozen AI models.

What is SectorFlow?

From the SectorFlow documentation:

SectorFlow is an AI integration platform that simplifies and enhances the way businesses use Large Language Models (LLMs) to gain actionable insights from their data. It's designed for ease of use, offering powerful AI capabilities without requiring in-depth technical knowledge.

More about SectorFlow

Installation

npm install @cityssm/sectorflow

Usage

TypeScript ready and JSDocs included for easy use!

import { SectorFlow } from '@cityssm/sectorflow'

const sectorFlow = new SectorFlow(API_KEY)

/*
 * Get the model id for ChatGPT
 */

const chatGPT = await sectorFlow.getModelIdByKeywords('ChatGPT')

/*
 * Create a workspace
 */

const workspace = await sectorFlow.createWorkspace({
  name: `My SectorFlow Workspace`,
  modelIds: [chatGPT],
  chatHistoryType: 'TEAM',
  contextType: 'SHARED',
  sharingType: 'TEAM'
})

/*
 * Chat
 */

const firstChatResponse = await sectorFlow.sendChatMessage(
  workspace.id,
  'Tell me a joke.'
)

console.log(firstChatResponse.choices[0].choices[0].message.content)
// => "Why don't scientists trust atoms? Because they make up everything!"

const secondChatResponse = await sectorFlow.sendChatMessage(
  workspace.id,
  'Tell me another joke.',
  {
    threadId: firstChatResponse.threadId
  }
)

console.log(secondChatResponse.choices[0].choices[0].message.content)
// => "What do dentists call their x-rays? Tooth pics!"

šŸ§™ā€ā™‚ļø This package also offers "wizards" to handle some of the heavy lifting associated with raw API calls.

import { SectorFlow, wizards } from '@cityssm/sectorflow'

const sectorFlow = new SectorFlow(API_KEY)

const wizardPersonResponse = await wizards.isPersonName(
  sectorFlow,
  'JAKE RAJNOVICH'
)

console.log(wizardPersonResponse)
// => true

const wizardOtherResponse = await wizards.isPersonName(
  sectorFlow,
  'BILL JONES AND SONS TRUCKING'
)

console.log(wizardOtherResponse)
// => false
0.5.0

5 months ago

0.6.0

5 months ago

0.4.2

11 months ago

0.4.1

1 year ago

0.4.0

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago