convez.ai
PluginDesenvolvimento WebIntermediário
extrawest

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 GitHub
InicialPluginScore · de 0 a 100

Plugin 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-bot

1 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

Estrelas
3
Forks
1
Acompanhando
0
Saúde
37%
Último commit
há 2 anos
Versão
—
Issues abertas
0
Contribuidores
3

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

  1. Chat Model: Uses Anthropic's Claude 3.5 Sonnet model for generating responses.
  2. Conversation Memory: Implements in-memory chat history to maintain context across interactions.
  3. Prompt Templates: Utilizes ChatPromptTemplate for structuring prompts with system messages and placeholders.
  4. Runnable Sequences: Implements a chain of operations using RunnableSequence for processing inputs and generating responses.
  5. Streaming Responses: Supports streaming of AI responses for real-time output.

Setup and Configuration

  1. Clone the repository.
  2. Install dependencies with npm install.
  3. Create a .env file 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:

  1. Initializing with a pre-defined conversation history.
  2. Asking a question that requires remembering previous information.
  3. 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.
Ver o original no GitHub

Bom para

Relacionados