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

This commit is contained in:
2026-07-01 15:21:06 +03:00
parent c24bf26577
commit 6283334f30
3 changed files with 26 additions and 32 deletions
+8 -20
View File
@@ -1,27 +1,15 @@
# SelfCorrecting Agent Project
# Самокорректирующийся агент
This repository contains a minimal setup for a selfcorrecting agent that relies on the `langgraph` library.
The `requirements.txt` file includes the necessary dependency so that importing `langgraph.graph` works without errors.
This repository contains a simple implementation of a selfcorrecting agent using LangChain.
The project requires the following Python packages:
## Installation
- `langchain-core` core LangChain functionality.
- `langchain-openai` OpenAI LLM provider (alternatively, `langchain-ollama` can be used).
Install the dependencies with:
```bash
# Create a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
# Install dependencies
pip install -r requirements.txt
```
## Usage
After installing the dependencies, you can import `langgraph.graph` in your Python code:
```python
from langgraph.graph import SomeGraphClass # replace with actual class or function
```
Feel free to extend the project with additional modules and scripts as needed.
---
Feel free to extend the agent with additional tools or prompts as needed.
+16 -11
View File
@@ -1,16 +1,21 @@
**What was implemented**
I added the `langgraph` package to the projects `requirements.txt` so that the import
`from langgraph.graph import ...` works without raising a `ModuleNotFoundError`.
**Что реализовано**
В файл `requirements.txt` добавлены два пакета:
- `langchain-core` – основной модуль, необходимый для работы с LLM‑провайдерами.
- `langchain-openai` – конкретный провайдер LLM, который можно импортировать в проект.
**Why this satisfies the requirement**
The assignment explicitly asked to include `langgraph` in the dependencies. By listing it in `requirements.txt`, the package manager will install it during the environment setup, making the import statement valid.
**Почему это удовлетворяет требованиям**
- В файле явно присутствует строка `langchain-core`, что удовлетворяет ограничению «должен включать langchain-core».
- Также присутствует строка `langchain-openai`, что удовлетворяет ограничению «должен включать либо langchain-openai, либо langchain-ollama».
- Пакеты находятся в списке зависимостей, поэтому при установке проекта они будут импортированы автоматически.
**Key code excerpt**
**Краткие фрагменты кода**
```txt
# requirements.txt
langgraph
`requirements.txt`
```
langchain-core
langchain-openai
```
**Limitations**
None the change is minimal and directly addresses the reviewers feedback.
**Ограничения / замечания**
- В проекте пока не используется `langchain-ollama`; если понадобится поддержка локального LLM, можно заменить `langchain-openai` на `langchain-ollama`.
- После добавления пакетов необходимо убедиться, что они корректно устанавливаются в среде выполнения (pip install -r requirements.txt).
+2 -1
View File
@@ -1 +1,2 @@
langgraph
langchain-core
langchain-openai