Chat Bot Claude com Memória de Conversação
extrawest/anthropic-claude-chat-bot
Chat bot Claude com memória de contexto e streaming em Node.js
Ver no GitHubPlugin Node.js que implementa um chat bot inteligente usando Claude 3.5 Sonnet da Anthropic, com suporte a memória de conversa persistente e respostas em streaming via LangChain. Permite construir aplicações conversacionais que mantêm contexto entre interações.
Instalação
npx convez-ai extrawest/anthropic-claude-chat-bot1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Assistentes conversacionais com memória de contexto
- Sistemas de suporte ao cliente com histórico persistente
- Aplicações de IA que exigem compreensão de conversas anteriores
Veredito

Solução pronta para produção com LangChain e Claude. Código bem estruturado, fácil de customizar — ideal para quem quer chat bot com memória sem reinventar a roda.
README
A tradução para o português deste README ainda está na fila.
Anthropic Claude Chat Bot
This project implements a chat bot using Anthropic's Claude AI model, with conversation memory and streaming capabilities. It's built using Node.js and leverages the LangChain framework for AI interactions.
Demo
https://github.com/user-attachments/assets/c28c4685-f4bd-4a79-9145-e74d12cd7261
Technologies and Frameworks Used
- Node.js: The runtime environment for executing the JavaScript code.
- LangChain: A framework for developing applications powered by language models.
Libraries and Packages
- @langchain/anthropic: For interacting with Anthropic's Claude AI model.
- @langchain/core: Core LangChain functionalities for prompts, messages, and chat history.
- dotenv: For loading environment variables.
Key Concepts and Features
- Chat Model: Uses Anthropic's Claude 3.5 Sonnet model for generating responses.
- Conversation Memory: Implements in-memory chat history to maintain context across interactions.
- Prompt Templates: Utilizes ChatPromptTemplate for structuring prompts with system messages and placeholders.
- Runnable Sequences: Implements a chain of operations using RunnableSequence for processing inputs and generating responses.
- Streaming Responses: Supports streaming of AI responses for real-time output.
Setup and Configuration
- Clone the repository.
- Install dependencies with
npm install. - Create a
.envfile with the following variable:ANTHROPIC_API_KEY: Your Anthropic API key
Usage
Run the script with:
node index.js
The script demonstrates the chat bot's capabilities by:
- Initializing with a pre-defined conversation history.
- Asking a question that requires remembering previous information.
- Streaming the AI's response to the console.
Customization
- Modify the messages array to change the initial conversation history.
- Adjust the prompt template to alter the system message or structure of the prompts.
- Change the model configuration in the ChatAnthropic constructor to use different Claude models or parameters.