# Self‑Correcting Agent Demo This repository demonstrates a minimal Node.js project that uses the **langchain-openai** and **langchain-core** packages to create a simple LLM provider. The goal is to satisfy the requirement of adding these packages and configuring the LLM provider accordingly. ## Prerequisites - Node.js v18 or newer - An OpenAI API key ## Setup 1. **Clone the repository** (or download the files): ```bash git clone https://git.brojs.ru/kuzakhmetovartur/ekzamen-samokorrektiruyuschiysya-agent.git cd ekzamen-samokorrektiruyuschiysya-agent ``` 2. **Install dependencies**: ```bash npm install ``` 3. **Set the OpenAI API key**: ```bash export OPENAI_API_KEY=your_api_key_here ``` On Windows PowerShell: ```powershell $env:OPENAI_API_KEY="your_api_key_here" ``` ## Running the Demo ```bash npm start ``` You should see output similar to: ``` LLM response: The capital of France is Paris. ``` ## Project Structure - `package.json` – Project metadata and dependencies (`langchain-openai` & `langchain-core`). - `src/index.js` – Main entry point that imports the LLM provider, verifies its type, and sends a prompt. - `README.md` – Documentation. ## Notes - No additional external packages are used beyond the required `langchain-openai` and `langchain-core`. - The code uses ES modules (`"type": "module"` in `package.json`). - The LLM instance is verified to be an instance of `BaseLLM` from `langchain-core` to satisfy the configuration requirement. ---