feat: solution for 'Экзамен: Самокорректирующийся агент'

This commit is contained in:
2026-07-01 14:54:52 +03:00
parent 5912e0f5cc
commit 581d783243
4 changed files with 129 additions and 50 deletions
+53 -11
View File
@@ -1,19 +1,61 @@
# Project
# SelfCorrecting Agent Demo
This project requires the `langgraph` package. Install dependencies with:
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
pip install -r requirements.txt
npm start
```
To test the import, you can run a simple Python script:
You should see output similar to:
```python
from langgraph.graph import Graph
# Example usage
g = Graph()
print("LangGraph imported successfully:", g)
```
LLM response: The capital of France is Paris.
```
Make sure you have a compatible Python environment (Python 3.8+).
## 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.
---