0.2.6 • Published 1 year ago

@logicleai/llmosaic v0.2.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Installation

npm install @logicleai/llmosaic

Usage

import { Provider, ProviderType } from '@logicleai/llmosaic';

const openai = new Provider({
  apiKey: process.env['OPENAI_API_KEY'],
  providerType: ProviderType.Anthropic,
});

async function main() {
  const chatCompletion = await openai.completion({
    messages: [{ role: 'user', content: 'Say this is a test' }],
    model: 'claude-3-opus-20240229',
  });
}

main();

Streaming responses

import { Provider, ProviderType } from '@logicleai/llmosaic';

const openai = new Provider({
  providerType: ProviderType.TogetherAI,
});

async function main() {
  const stream = await openai.completion({
    messages: [{ role: 'user', content: 'Say this is a test' }],
    model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
    stream: true,
  });
  for await (const chunk of stream) {
    process.stdout.write(chunk.choices[0]?.delta?.content || '');
  }
}

main();

Supported Providers

ProviderCompletionStreamingModels
openai
anthropic
togetherai
groq
localai

Contributing

Clone the repo

git clone https://github.com/logicleai/llmosaic.git

Install dependencies

npm install

Build the project

npm run build
0.2.6

1 year ago

0.2.5

1 year ago

0.2.4

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.8

1 year ago

0.1.9

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago