0.0.8 • Published 4 months ago
pantheons v0.0.8
简体中文 | English
Pantheons
Pantheons
is a unified dialogue library built with TypeScript based on the OpenAI Node.js SDK. It provides a seamless interface for interacting with multiple large language models (LLMs) such as OpenAI, DeepSeek, DashScope, Gemini, and more.
The library is inspired by the pantheon of gods in mythology, with each deity representing unique powers and attributes. Pantheons unifies various large models under one library.
Supported large models
- OpenAI
- Azure OpenAI
- Aliyun DashScope
- Tencent HunYuan
- Moonshot
- SiliconFlow
- DeepSeek
- Wenxin Qianfan
- Gemini
- Ollama
- ZhiPu
- XAI
- YiLarge
- MiniMax
- Spark
- Anthropic(Claude)
Installation
npm install pantheons
bunx jsr add @greywen/pantheons
Usages
Nodejs
import { DeepSeek } from 'pantheons';
(async () => {
const client = new DeepSeek('Your key');
const stream = await client.stream({
model: 'deepseek-chat',
stream: true,
messages: [{ role: 'user', content: 'Hi!' }],
});
let result = '';
for await (const chunk of stream) {
result += chunk.choices[0].delta?.content;
}
console.log(result);
})();
Bun
import { DeepSeek } from '@greywen/pantheons';
const client = new DeepSeek('Your key');
const stream = await client.stream({
model: 'deepseek-chat',
stream: true,
messages: [{ role: 'user', content: 'Hi!' }],
});
let result = '';
for await (const chunk of stream) {
result += chunk.choices[0].delta?.content;
}
console.log(result);
Multi-model
import { DashScope, Moonshot } from 'pantheons';
const dashScopeClient = new DashScope('Your key');
const moonshotClient = new Moonshot('Your key');
const dashScopeStream = await dashScopeClient.stream({
model: 'qwen-max',
stream: true,
messages: [{ role: 'user', content: 'Hi!' }],
});
const moonshotStream = await moonshotClient.stream({
model: 'kimi-latest',
stream: true,
messages: [{ role: 'user', content: 'Hi!' }],
});
async function readStream(stream: AsyncIterable<any>, output: string[]) {
for await (const chunk of stream) {
const content = chunk.choices[0].delta?.content || '';
output.push(content);
}
}
const dashScopeOutput: string[] = [];
const moonshotOutput: string[] = [];
await Promise.all([
readStream(dashScopeStream, dashScopeOutput),
readStream(moonshotStream, moonshotOutput),
]);
console.log(dashScopeOutput, moonshotOutput);
License
Pantheons is licensed under the MIT License. Please refer to the LICENSE.txt file for more information.
0.0.8
4 months ago
0.0.7
5 months ago
0.0.6
5 months ago
0.0.4
5 months ago
0.0.3
5 months ago
0.0.2
5 months ago
0.0.1-beta.2
5 months ago
0.0.1-beta.1
5 months ago
0.0.1-beta
5 months ago
0.0.1
5 months ago