-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
web.ts
43 lines (42 loc) · 1.26 KB
/
web.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { type BaseChatModelParams } from "@langchain/core/language_models/chat_models";
import { sign } from "../../utils/tencent_hunyuan/web.js";
import {
ChatTencentHunyuan as BaseChatTencentHunyuan,
TencentHunyuanChatInput,
} from "./base.js";
/**
* Wrapper around Tencent Hunyuan large language models that use the Chat endpoint.
*
* To use you should have the `TENCENT_SECRET_ID` and `TENCENT_SECRET_KEY`
* environment variable set.
*
* @augments BaseLLM
* @augments TencentHunyuanInput
* @example
* ```typescript
* const messages = [new HumanMessage("Hello")];
*
* const hunyuanLite = new ChatTencentHunyuan({
* model: "hunyuan-lite",
* tencentSecretId: "YOUR-SECRET-ID",
* tencentSecretKey: "YOUR-SECRET-KEY",
* });
*
* let res = await hunyuanLite.call(messages);
*
* const hunyuanPro = new ChatTencentHunyuan({
* model: "hunyuan-pro",
* temperature: 1,
* tencentSecretId: "YOUR-SECRET-ID",
* tencentSecretKey: "YOUR-SECRET-KEY",
* });
*
* res = await hunyuanPro.call(messages);
* ```
*/
export class ChatTencentHunyuan extends BaseChatTencentHunyuan {
constructor(fields?: Partial<TencentHunyuanChatInput> & BaseChatModelParams) {
super({ ...fields, sign } ?? { sign });
}
}
export { TencentHunyuanChatInput } from "./base.js";