0.0.1-alpha.1 • Published 10 months ago

@renaiss-ai/renforce-js v0.0.1-alpha.1

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

Renforce JS

Installation

npm install @renaiss-ai/renforce-js

Example

Orchestator

import { AIOrchestrator, Model } from '@renaiss-ai/renforce-js'

async function run (): Promise<void> {
  const aiOrchestrator = new AIOrchestrator({
    credentials: {
      apiToken: process.env.RENFORCE_API_KEY!
    }
    model: Model.GEMINI, // gemini-1.5-flash-002
    system_prompt: 'You are a helpful assistant.',
    output_prompt: 'Provide a concise response.',
    temperature: 0.3,
    max_output_tokens: 550,
    min_output_tokens: 1
  })

  const { status, result } = await aiOrchestrator.run({
    query: 'Hi, how are you?',
    /**
     * You can override the default parameters here
    model: Model.GEMINI, // gemini-1.5-flash-002
    system_prompt: 'You are a helpful assistant.',
    output_prompt: 'Provide a concise response.',
    temperature: 0.3,
    max_output_tokens: 550,
    min_output_tokens: 1
     */
  })

  console.log(`Status: ${status}, Model Answer: ${result.model_answer}`)
}

void run()

Pods

import { AIOrchestrator, Model } from '@renaiss-ai/renforce-js'

async function run (): Promise<void> {
  const pod = new Pod({ podId: process.env.POD_ID! })

  const { result, logEntry } = await pod.run({
    query: 'Hi, how are you?'
  })

  console.log(`Model Answer: ${result} Log Entry: ${JSON.stringify(logEntry)}`)
}

void run()

If the environment variable RENFORCE_API_KEY is not set, you must specify the API key in the apiToken field.