Self‑Correcting Agent

This repository demonstrates a minimal self‑correcting agent that uses the LangChain OpenAI provider to generate responses from an LLM.

Prerequisites

  • Node.js v18 or newer (ESM support required)
  • An OpenAI API key set in the environment variable OPENAI_API_KEY

Installation

npm install

Usage

npm start

The script will send a prompt to the LLM and print the response.

Project Structure

  • src/agent.js – Contains the logic to interact with the LLM.
  • src/index.js – Entry point that demonstrates usage.
  • package.json – Project metadata and dependencies.

Adding a Different LLM Provider

If you prefer to use another provider (e.g., Ollama), replace the dependency and imports:

npm install langchain-ollama
import { Ollama } from 'langchain-ollama';

Adjust the model initialization accordingly.


S
Description
BroJS: Повторный экзамен: Граф с рефлексией и доработкой
Readme MIT
673 KiB
0 Stars 1 Watchers 0 Forks
Languages
Python 51.9%
JavaScript 39.3%
TypeScript 8.8%