Replies: 1 comment
-
Hey @soutot, great to see you back with another interesting question! Hope you've been doing well. Based on the context provided, it seems like the model you're trying to use ( If you want to switch to using Haiku instead of Sonnet, you'll need to ensure that a Haiku version of the Claude 3 model exists and is supported by the API. The model name typically follows a pattern that includes the model version, the configuration (e.g., Sonnet, Haiku), and possibly a date or version number. For example, if a Haiku version of Claude 3 is available, it might be named following a similar pattern, such as Here's how you might adjust your code if such a model exists: import { ChatAnthropic } from "@langchain/anthropic";
// Assuming 'claude-3-haiku-20240229' is a valid model name
const model = new ChatAnthropic({
modelName: "claude-3-haiku-20240229", // Adjusted to use a hypothetical Haiku model
maxTokens: 1024,
clientOptions: {
defaultHeaders: {
"X-Api-Key": process.env.ANTHROPIC_API_KEY,
},
},
});
const res = await model.invoke("Why is the sky blue?");
console.log(res); In this adjustment, As for the supported models for the I hope this helps! If you have any other questions or need further clarification, feel free to ask. Sources
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
Hi, I'm trying to use "ChatAnthropic" with claude-3 models, but I'm getting the following error message:
'"claude-3-sonnet-20240229" is not supported on this API. Please use the Messages API instead.'
I tried the same example provided in the docs here: https://js.langchain.com/docs/integrations/chat/anthropic/#usage
But no success
I found this issue mentioning a similar error message but using
BedrockChat
instead. I'm wondering if I should be using it instead ofChatAnthropic
?I found this issue in the Python repo mentioning the langchain/community does not support claude 3 anymore (see this). I don't know if there's something similar with the JS repo (however, I'm not importing it from @langchain/community, so it should not be related)
I'm able to use it by installing the Anthropic SDK and using it directly. But I'd like to use it with LangChain
Does anyone know how to work with this?
package.json
Also, not kinda related, but how can I use Haiku instead of Sonnet? Tried this
claude-3-haiku-20240229
and I got a not found error.Thanks in advance
System Info
[email protected] | MIT | deps: 18 | versions: 256
Typescript bindings for langchain
https://github.com/langchain-ai/langchainjs/tree/main/langchain/
keywords: llm, ai, gpt3, chain, prompt, prompt engineering, chatgpt, machine learning, ml, openai, embeddings, vectorstores
dist
.tarball: https://registry.npmjs.org/langchain/-/langchain-0.1.26.tgz
.shasum: 1901db427565498b3b2316037deedcfdda5bb3c0
.integrity: sha512-2hCXDev/KkBKNHCrxqq7XQxAp/kpjMtwlIuKBzaSW8gM+BOrh8q6B9PM3ItbvG4s29JCW7xlJtIEO3LaWChwkQ==
.unpackedSize: 4.0 MB
dependencies:
@anthropic-ai/sdk: ^0.9.1 langchainhub: ~0.0.8
@langchain/community: ~0.0.36 langsmith: ~0.1.7
@langchain/core: ~0.1.44 ml-distance: ^4.0.0
@langchain/openai: ~0.0.19 openapi-types: ^12.1.3
binary-extensions: ^2.2.0 p-retry: 4
expr-eval: ^2.0.2 uuid: ^9.0.0
js-tiktoken: ^1.0.7 yaml: ^2.2.1
js-yaml: ^4.1.0 zod-to-json-schema: ^3.22.3
jsonpointer: ^5.0.1 zod: ^3.22.4
maintainers:
dist-tags:
latest: 0.1.26 next: 0.1.19-rc.2
published 13 hours ago by jacoblee93 [email protected]
Beta Was this translation helpful? Give feedback.
All reactions