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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file limin_talk-0.2.0.tar.gz.
File metadata
- Download URL: limin_talk-0.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbb30b7dc9898ba343e9ed2b9614b0cc65ff75f53105373c010fde4332247968
|
|
| MD5 |
7053cd978e714d54ec713eacb227fb66
|
|
| BLAKE2b-256 |
1d4eee713eff06145fd39f05e8c9c5dab7ff656ee0d1ef135a2c61fb4f4574da
|
File details
Details for the file limin_talk-0.2.0-py3-none-any.whl.
File metadata
- Download URL: limin_talk-0.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbacc2a451bc0ee259ac2bfacec405968e61db7ad57158d6ebbaaf307600d8a7
|
|
| MD5 |
5bc1fc322badf87307f56135306808d4
|
|
| BLAKE2b-256 |
15ceff5c76e9b119ef3008e30b056c5b36ab1bb6a3d9bbfa33068b7f54ecc434
|