{"id":23869140,"url":"https://github.com/extrawest/anthropic-claude-chat-bot","last_synced_at":"2026-06-08T16:30:13.647Z","repository":{"id":254974046,"uuid":"836816652","full_name":"extrawest/anthropic-claude-chat-bot","owner":"extrawest","description":"Chat bot with conversation memory using Anthropic's Claude AI model on LangChain JS","archived":false,"fork":false,"pushed_at":"2024-08-02T07:49:20.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-03T12:16:06.665Z","etag":null,"topics":["ai","anthropic-claude","claude","demo","javascript","langchain","langchain-js","prompt"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/extrawest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-01T16:06:45.000Z","updated_at":"2024-08-02T09:02:19.000Z","dependencies_parsed_at":"2024-08-27T09:16:41.001Z","dependency_job_id":null,"html_url":"https://github.com/extrawest/anthropic-claude-chat-bot","commit_stats":null,"previous_names":["extrawest/anthropic-claude-chat-bot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extrawest%2Fanthropic-claude-chat-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extrawest%2Fanthropic-claude-chat-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extrawest%2Fanthropic-claude-chat-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extrawest%2Fanthropic-claude-chat-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/extrawest","download_url":"https://codeload.github.com/extrawest/anthropic-claude-chat-bot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240214577,"owners_count":19766263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","anthropic-claude","claude","demo","javascript","langchain","langchain-js","prompt"],"created_at":"2025-01-03T12:16:11.344Z","updated_at":"2026-06-08T16:30:13.595Z","avatar_url":"https://github.com/extrawest.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Anthropic Claude Chat Bot\n\nThis 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.\n\n## Demo\n\nhttps://github.com/user-attachments/assets/c28c4685-f4bd-4a79-9145-e74d12cd7261\n\n## Technologies and Frameworks Used\n\n- **Node.js**: The runtime environment for executing the JavaScript code.\n- **LangChain**: A framework for developing applications powered by language models.\n\n### Libraries and Packages\n\n- **@langchain/anthropic**: For interacting with Anthropic's Claude AI model.\n- **@langchain/core**: Core LangChain functionalities for prompts, messages, and chat history.\n- **dotenv**: For loading environment variables.\n\n## Key Concepts and Features\n\n1. **Chat Model**: Uses Anthropic's Claude 3.5 Sonnet model for generating responses.\n2. **Conversation Memory**: Implements in-memory chat history to maintain context across interactions.\n4. **Prompt Templates**: Utilizes ChatPromptTemplate for structuring prompts with system messages and placeholders.\n5. **Runnable Sequences**: Implements a chain of operations using RunnableSequence for processing inputs and generating responses.\n6. **Streaming Responses**: Supports streaming of AI responses for real-time output.\n\n## Setup and Configuration\n\n1. Clone the repository.\n2. Install dependencies with `npm install`.\n3. Create a `.env` file with the following variable:\n   - `ANTHROPIC_API_KEY`: Your Anthropic API key\n\n## Usage\n\nRun the script with:\n\n```bash\nnode index.js\n```\n\nThe script demonstrates the chat bot's capabilities by:\n\n1. Initializing with a pre-defined conversation history.\n2. Asking a question that requires remembering previous information.\n3. Streaming the AI's response to the console.\n\n## Customization\n\n- Modify the messages array to change the initial conversation history.\n- Adjust the prompt template to alter the system message or structure of the prompts.\n- Change the model configuration in the ChatAnthropic constructor to use different Claude models or parameters.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextrawest%2Fanthropic-claude-chat-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fextrawest%2Fanthropic-claude-chat-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextrawest%2Fanthropic-claude-chat-bot/lists"}