Giter VIP home page Giter VIP logo

llm-abm-chat's Introduction

LLM-ABM-Chat

This repository implements LLM (Language Learning Model) agents and chat objects to enable communication between agents. The agents are designed to be modular and the implemented LLM engine expects an OpenAI-like API at http://127.0.0.1:1200.

Installation

To use this library, you need to have the following prerequisites installed:

  • Python 3.x
  • oobabooga/text-generation-webui with any instruct model loaded (or any OpenAI-like API) set up at http://127.0.0.1:1200
  • in alternative, a gpt-3.5 model is provided as ChatgptLLM in llm_engines.py. It will try to load a OPENAI_API_KEY from a .env file in the root directory of the project.

Once you have the prerequisites set up, you can install the library by following these steps:

  1. Clone the repository: git clone https://github.com/your-username/your-repo.git
  2. That's it, there are no requirements as of now.

Usage

A jupyter notebook (chat_interactive.ipynb) is provided to demonstrate the usage of the library. The main functionality is provided by the ChatThread class, which can be used as follows:

from chat_llm import ChatThread, Agent
from llm_engines import LLMApi

# defining two agents
John = Agent(name="Mario", llm=LLMApi(), interests=["hydraulics", "hats"], behavior="inspirational")
Mary = Agent(name="Luigi", llm=LLMApi(), interests=["ghosts", "pizza"], behavior="funny")

chat_test=ChatThread(agent_list=[John, Mary], neutral_llm=LLMApi())

After the chat thread is created, you can start the chat by calling the run_chat method:

chat_test.run_chat()

The chat will run and print the messages to the console. At the end of the chat, the chat will be saved to a file in the chat_logs directory.

By default, the chat will run until the user stops it. You can also specify a maximum number of messages by passing the max_messages parameter to the run_chat method. Furthermore, evaluation of the chat will be run by default, and the results will be saved to a file in the chat_logs directory. You can disable this by setting the n_eval parameter to -1.

Types of agents

The library currently supports two types of agents:

  • Agent - a simple agent that can be used to test the chat functionality
  • MemoryAgent - an agent that generates observations and saves them to a vector store that serves as memory. Observations relevant to the last message in the chat are then used to generate responses.

Planned features

  • memory system for agents
  • dynamic summarization of the chat to fit model context length
  • better logging
  • better selection of the next agent to speak
  • an automated way to end the chat based on the agents' behavior

llm-abm-chat's People

Contributors

ruggsea avatar

Stargazers

Pu ZHANG avatar Vladislav Sorokin avatar

Watchers

Joao Pinheiro Neto avatar  avatar

Forkers

sorokinvld cauzp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.