@hashgraphonline/conversational-agent
Version:
Hashgraph Online conversational AI agent implementing HCS-10 communication, HCS-2 registries, and content inscription on Hedera
23 lines (22 loc) • 570 B
JavaScript
class LangChainProvider {
constructor(model) {
this.model = model;
}
async generate(prompt, options) {
const result = await this.model.invoke(prompt, options);
return typeof result === "string" ? result : result.toString();
}
async *stream(prompt, options) {
const stream = await this.model.stream(prompt, options);
for await (const chunk of stream) {
yield typeof chunk === "string" ? chunk : chunk.toString();
}
}
getModel() {
return this.model;
}
}
export {
LangChainProvider
};
//# sourceMappingURL=index10.js.map