Public
Script
October 23, 2023
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { getModelBuilder } from "https://esm.town/v/webup/getModelBuilder";
export const modelSampleChatCall = (async () => {
const builder = await getModelBuilder({
type: "chat",
provider: "openai",
});
const model = await builder();
const { SystemMessage, HumanMessage } = await import("npm:langchain/schema");
const data = await model.call([
new SystemMessage(
"You are a helpful assistant that translates English to Chinese.",
),
new HumanMessage("Translate: I love programming."),
]);
return data?.content;
})();
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023