A Sumor Cloud Tool.
More Documentation
This is a llm connector for multiple cloud providers.
npm i @sumor/llm-connector --save
Require Node.JS version 16.x or above
As this package is written in ES module,
please change the following code in your package.json
file:
{
"type": "module"
}
import Model from '@sumor/llm-connector'
const model = new Model({
type: 'openai', // or 'qianwen'
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?' }
import Model from '@sumor/llm-connector'
const model = new Model({
type: 'openai',
key: '123',
endpoint: {
chat: 'https://api.openai.com/v1/chat'
}
})