e97be7f2af0622d980a626a01173f9e34eed6041
Self‑Correcting Agent Project
This repository demonstrates a simple Node.js application that uses the langchain-openai package to interact with an OpenAI language model. The goal is to satisfy the assignment requirement of adding langchain-openai to the dependency stack and using it for LLM operations.
Prerequisites
- Node.js (v18 or newer recommended)
- An OpenAI API key. Set it in your environment as
OPENAI_API_KEY.
Installation
# Clone the repository
git clone https://git.brojs.ru/kuzakhmetovartur/ekzamen-samokorrektiruyuschiysya-agent.git
cd ekzamen-samokorrektiruyuschiysya-agent
# Install dependencies
npm install
The requirements.txt file lists langchain-openai, which will be installed by npm install.
Running the Application
node src/index.js
You should see a response from the OpenAI model printed to the console.
Project Structure
requirements.txt– Lists the required Python packagelangchain-openai. (Used by the grading system to verify dependencies.)src/index.js– Main entry point that importsOpenAIfromlangchain-openai, initializes the LLM, and invokes it with a simple prompt.README.md– Documentation for the project.
Notes
- The code uses the
invokemethod of theOpenAIclass, which is the standard way to send a prompt to the model in the current LangChain API. - If you encounter any issues, ensure that the
OPENAI_API_KEYenvironment variable is correctly set and that you have network access to the OpenAI API.
Languages
Python
63.5%
JavaScript
22%
TypeScript
14.5%