1.5 KiB
1.5 KiB
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
-
Clone the repository (or download the files):
git clone https://git.brojs.ru/kuzakhmetovartur/ekzamen-samokorrektiruyuschiysya-agent.git cd ekzamen-samokorrektiruyuschiysya-agent -
Install dependencies:
npm install -
Set the OpenAI API key:
export OPENAI_API_KEY=your_api_key_hereOn Windows PowerShell:
$env:OPENAI_API_KEY="your_api_key_here"
Running the Demo
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-openaiandlangchain-core. - The code uses ES modules (
"type": "module"inpackage.json). - The LLM instance is verified to be an instance of
BaseLLMfromlangchain-coreto satisfy the configuration requirement.