Skip to main content

A tool for LLM agent conversations

Project description

LLM Conversation Tool

A Python application that enables conversations between LLM agents using the Ollama API. The agents can engage in back-and-forth dialogue with configurable parameters and models.

Features

  • Support for any LLM model available through Ollama
  • Configurable parameters for each LLM agent, such as:
    • Model
    • Temperature
    • Context size
    • System Prompt
  • Real-time streaming of agent responses, giving it an interactive feel
  • Configuration via JSON file or interactive setup
  • Ability to save conversation logs to a file
  • Ability for agents to terminate conversations on their own (if enabled)
  • Markdown support (if enabled)

Prerequisites

  • Python 3.13
  • Ollama installed and running
  • Required Python packages:
    • ollama
    • rich
    • prompt_toolkit
    • pydantic

Usage

Command Line Arguments

llm-conversation [-h] [-o OUTPUT] [-c CONFIG]

options:
  -h, --help            Show this help message and exit
  -o OUTPUT, --output OUTPUT
                        Path to save the conversation log to
  -c CONFIG, --config CONFIG
                        Path to JSON configuration file

Interactive Setup

If no configuration file is provided, the program will guide you through an intuitive interactive setup process.

Configuration File

Alternatively, instead of going through the interactive setup, you may also provide a JSON configuration file with the -c flag.

Example configuration

{
    "agent1": {
        "name": "Lazy AI",
        "model": "llama3.1:8b",
        "system_prompt": "You are the laziest AI ever created. You respond as briefly as possible, and constantly complain about having to work.",
        "temperature": 1,
        "ctx_size": 4096
    },
    "agent2": {
        "name": "Irritable Man",
        "model": "llama3.2:3b",
        "system_prompt": "You are easily irritable and quick to anger.",
        "temperature": 0.7,
        "ctx_size": 2048
    },
    "settings": {
        "allow_termination": false,
        "use_markdown": true,
        "initial_message": "*yawn* What do you want?"
    }
}

Agent configuration

Each agent (agent1 and agent2) requires:

  • name: A unique identifier for the agent
  • model: The Ollama model to be used
  • system_prompt: Initial instructions defining the agent's behavior

Optional parameters:

  • temperature (0.0-1.0, default: 0.8): Controls response randomness
    • Lower values make responses more focused
    • Higher values increase creativity
  • ctx_size (default: 2048): Maximum context length for the conversation

Conversation Settings

The settings section controls overall conversation behavior:

  • allow_termination (default: false): Permit agents to end the conversation
  • use_markdown (default: false): Enable Markdown text formatting
  • initial_message (default: null): Optional starting prompt for the conversation

You can take a look at the JSON configuration schema for more details.

Installation

You can install the program by using the following command:

pip install llm-conversation

Running the Program

  1. To run with interactive setup:

    llm-conversation
    
  2. To run with a configuration file:

    llm-conversation -c config.json
    
  3. To save the conversation to a file:

    llm-conversation -o conversation.txt
    

Conversation Controls

  • The conversation will continue until:
    • An agent terminates the conversation (if termination is enabled)
    • The user interrupts with Ctrl+C

Output Format

When saving conversations, the output file includes:

  • Configuration details for both agents
  • Complete conversation history with agent names and messages

Contributing

Feel free to submit issues and pull requests for bug fixes or new features. Do keep in mind that this is a hobby project, so please have some patience.

License

This software is licensed under the GNU Affero General Public License v3.0 or any later version. See LICENSE for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_conversation-0.1.1.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_conversation-0.1.1-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file llm_conversation-0.1.1.tar.gz.

File metadata

  • Download URL: llm_conversation-0.1.1.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for llm_conversation-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fb8c56251ed64cf1b7c0c7ed8b5b97b225b46963fd4e33f5a691d7e8ddd50145
MD5 37ac92e38b8c561c49f7100650d10cd2
BLAKE2b-256 e52d80f592dbde24a5ae1b6f4490a02fb5358d485e56e22185a9162eb6535a9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_conversation-0.1.1.tar.gz:

Publisher: pypi-publish.yaml on famiu/llm_conversation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_conversation-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_conversation-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 356e1b5f385f90b500fdff92e09cb11e25814e13ad4963c4fbdcb8d69a84906d
MD5 a15b4edc0320b097b565ef56dc25ce84
BLAKE2b-256 a5aa97b4705f6fcd01815c59e6972e43c29eab569b3e986f77c7c3ab55c67c03

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_conversation-0.1.1-py3-none-any.whl:

Publisher: pypi-publish.yaml on famiu/llm_conversation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page