-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
index.ts
40 lines (34 loc) · 978 Bytes
/
index.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
import { defaultProvider } from "@aws-sdk/credential-provider-node";
import type { BaseChatModelParams } from "@langchain/core/language_models/chat_models";
import { BaseBedrockInput } from "../../utils/bedrock.js";
import { BedrockChat as BaseBedrockChat } from "./web.js";
/**
* @example
* ```typescript
* const model = new BedrockChat({
* model: "anthropic.claude-v2",
* region: "us-east-1",
* });
* const res = await model.invoke([{ content: "Tell me a joke" }]);
* console.log(res);
* ```
*/
export class BedrockChat extends BaseBedrockChat {
static lc_name() {
return "BedrockChat";
}
constructor(fields?: Partial<BaseBedrockInput> & BaseChatModelParams) {
super({
...fields,
credentials: fields?.credentials ?? defaultProvider(),
});
}
}
export {
convertMessagesToPromptAnthropic,
convertMessagesToPrompt,
} from "./web.js";
/**
* @deprecated Use `BedrockChat` instead.
*/
export const ChatBedrock = BedrockChat;