mirror of
https://github.com/langchain-ai/docs.git
synced 2026-08-27 02:41:59 -04:00
13 lines
362 B
Plaintext
13 lines
362 B
Plaintext
```ts
|
|
import { HumanMessage } from "@langchain/core/messages";
|
|
import { load } from "@langchain/core/load";
|
|
|
|
const message = new HumanMessage("What is the capital of France?");
|
|
|
|
// Serialize to a plain object
|
|
const serialized = message.toJSON();
|
|
|
|
// Deserialize back to a message object
|
|
const restored = await load<HumanMessage>(JSON.stringify(serialized));
|
|
```
|