From 7b67d43a28f3f1481fa0a1ee619dd7a1e06dd5da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Rish=C3=B8j?= Date: Sat, 1 Feb 2025 15:38:31 +0100 Subject: [PATCH] fix(docs): imports and call (#7636) Co-authored-by: Jacob Lee --- libs/langchain-anthropic/README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libs/langchain-anthropic/README.md b/libs/langchain-anthropic/README.md index 4abec6837993..3cfa9f9dc505 100644 --- a/libs/langchain-anthropic/README.md +++ b/libs/langchain-anthropic/README.md @@ -49,24 +49,30 @@ export ANTHROPIC_API_KEY=your-api-key Then initialize ```typescript -import { ChatAnthropicMessages } from "@langchain/anthropic"; +import { ChatAnthropic } from "@langchain/anthropic"; const model = new ChatAnthropic({ apiKey: process.env.ANTHROPIC_API_KEY, }); -const response = await model.invoke(new HumanMessage("Hello world!")); +const response = await model.invoke({ + role: "user", + content: "Hello world!", +}); ``` ### Streaming ```typescript -import { ChatAnthropicMessages } from "@langchain/anthropic"; +import { ChatAnthropic } from "@langchain/anthropic"; const model = new ChatAnthropic({ apiKey: process.env.ANTHROPIC_API_KEY, model: "claude-3-sonnet-20240229", }); -const response = await model.stream(new HumanMessage("Hello world!")); +const response = await model.stream({ + role: "user", + content: "Hello world!", +}); ``` ## Development @@ -119,4 +125,4 @@ After running `yarn build`, publish a new version with: ```bash $ npm publish -``` \ No newline at end of file +```