diff --git a/examples/src/models/chat/integration_anthropic.ts b/examples/src/models/chat/integration_anthropic.ts index 1c51452dd8c8..f18fe00ecc1b 100644 --- a/examples/src/models/chat/integration_anthropic.ts +++ b/examples/src/models/chat/integration_anthropic.ts @@ -2,7 +2,7 @@ import { ChatAnthropic } from "@langchain/anthropic"; const model = new ChatAnthropic({ temperature: 0.9, - model: "claude-3-sonnet-20240229", + model: "claude-3-5-sonnet-20240620", // In Node.js defaults to process.env.ANTHROPIC_API_KEY, // apiKey: "YOUR-API-KEY", maxTokens: 1024, @@ -14,16 +14,30 @@ console.log(res); /* AIMessage { - content: "The sky appears blue because of how air in Earth's atmosphere interacts with sunlight. As sunlight passes through the atmosphere, light waves get scattered by gas molecules and airborne particles. Blue light waves scatter more easily than other color light waves. Since blue light gets scattered across the sky, we perceive the sky as having a blue color.", - name: undefined, - additional_kwargs: { - id: 'msg_01JuukTnjoXHuzQaPiSVvZQ1', - type: 'message', - role: 'assistant', - model: 'claude-3-sonnet-20240229', + content: "The sky appears blue due to a phenomenon called Rayleigh scattering. Here's a brief explanation:\n" + + '\n' + + '1. Sunlight contains all colors of the visible spectrum.\n' + + '\n' + + "2. As sunlight enters Earth's atmosphere, it collides with gas molecules and other particles.\n" + + '\n' + + '3. These collisions cause the light to scatter in all directions.\n' + + '\n' + + '4. Blue light has a shorter wavelength and higher frequency than other colors in the visible spectrum, so it scatters more easily than other colors.\n' + + '\n' + + '5. This scattered blue light reaches our eyes from all directions, making the sky appear blue.\n' + + '\n' + + '6. Other colors, like red and yellow, have longer wavelengths and pass through the atmosphere more directly, which is why we see them primarily during sunrise and sunset when sunlight travels through more of the atmosphere to reach our eyes.\n' + + '\n' + + 'This effect is more pronounced during the day when the sun is high in the sky. At sunrise and sunset, when sunlight travels through more of the atmosphere, we see more red and orange colors because the blue light has been scattered away by the time it reaches our eyes.', + response_metadata: { + id: 'msg_013zKN9RXhpyCeHNsgwHjHsi', + model: 'claude-3-5-sonnet-20240620', stop_reason: 'end_turn', stop_sequence: null, - usage: { input_tokens: 15, output_tokens: 70 } - } + usage: { input_tokens: 13, output_tokens: 233 } + }, + tool_calls: [], + invalid_tool_calls: [], + usage_metadata: { input_tokens: 13, output_tokens: 233, total_tokens: 246 } } */