Skip to main content

A Python library for letting two LLMs talk to each other.

Project description

limin-talk

A Python library for letting two LLMs talk to each other.

Installation

Install the library using pip:

python -m pip install limin-talk

Usage

After you've installed the library, you can use it by importing the limin_talk module and calling the functions you need. You will also need to provide an API key for your API either by running export OPENAI_API_KEY=$YOUR_API_KEY or by creating an .env file in the root directory of your project and adding the following line:

OPENAI_API_KEY=$YOUR_API_KEY

Here's an example of how to use the library:

from limin import ModelConfiguration
from limin_talk import Character, talk

user_character = Character(
    system_prompt="You are a helpful assistant who only speaks English.",
    model_configuration=ModelConfiguration(model="gpt-4o"),
)

assistant_character = Character(
    system_prompt="You are a helpful assistant who only speaks German.",
    model_configuration=ModelConfiguration(model="gpt-4o"),
)


async def main():
    conversation = await talk(user_character, assistant_character, 3)
    print(conversation.to_pretty_string())


if __name__ == "__main__":
    import asyncio
    import dotenv

    dotenv.load_dotenv()

    asyncio.run(main())

Basically, the library contains the following two components:

The Character class, which is used to create a character that can be used to talk to another character. To instantiate a character, you need to provide a system prompt and a model configuration for the character.

The talk function, which is used to let two characters talk to each other. To use the talk function, you need to provide two characters and the number of turns you want the conversation to have.

The talk function will return a Conversation object, which contains the conversation history.

You can find the example in examples/demo.py.

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

limin_talk-0.1.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

limin_talk-0.1.0-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file limin_talk-0.1.0.tar.gz.

File metadata

  • Download URL: limin_talk-0.1.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for limin_talk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0cee5364516e0aed52c6fa430e190dd5d18100f8fe0529431dad6cbb06e9bf50
MD5 a3311ef02f52f31007d1f9f6469b003c
BLAKE2b-256 07b0bd171499d310f7e475a179fd6b7e74bfd0e19fb33a9539d7aa8ac4150298

See more details on using hashes here.

File details

Details for the file limin_talk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: limin_talk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for limin_talk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a3d34bbbbb8225f4f48a43c54575ac186fa3e030653b9467ec5fd216ac69ee24
MD5 36d3cf643dcf8a8b95068d800bb726f1
BLAKE2b-256 4cc2e8c24ffde33d3c9be1d94dfe7d5f4a08b0c86113ca61b5a67760c3b60fbc

See more details on using hashes here.

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