Introduction
Joinly is a library that is mean to help assist in the joining of two different lists of items using a LLM. Like a human data annotator you can provide context through a prompt on how you want the task achieved. The library supports inner, left, right, and full joins.
By default the library uses OpenAI's gpt-4o model. You will need to set your OpenAI credentials prior to using the library with:
OPENAI_API_KEY=XXXX
Installation
pip install llm-joinly
Quickstart
Let's say you have two lists of fruits. One is a bit more specific with types of each fruit while the second one is more general. Joinly allows you to describe the task you want and join in a fuzzy way using LLMs.
from joinly import join
context = '''
You are joining fruits so make sure to be aware of that fruits
have different types but make sure the catagory is correct
'''
left = [
("apple", 1),
("banana", 2),
("orange", 3),
]
right = [
("honeycrisp", 4),
("florida orange", 5),
("gala", 6),
("grannysmith", 7)
]
results = join.inner_join(left, right, context=context)
> [
(('apple', 1), ('honeycrisp', 4)),
(('apple', 1), ('gala', 6)),
(('apple', 1), ('grannysmith', 7)),
(('orange', 3), ('florida orange', 5))
]
Other Models
You can bring in any custom model as BaseAI with an embedding method and a prompt.
from joinly.ai import BaseAI
class MyAI(BaseAI):
def __init__(self) -> None:
self.client = ...
def __call__(self, system_message: str, user_message: str) -> Optional[str]
pass
def embed(self, text: str) -> Optional[ArrayLike]:
pass
results = join.inner_join(left, right, context=context, llm=MyAI())
Release files for joinly 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| joinly-0.1.1.tar.gz | 5.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| joinly-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.5 kB
Release files / joinly-0.1.1.tar.gz
| Download URL | joinly-0.1.1.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1945c7c5afd019cf276ec94e63836c06b1c8aff9ff7c49f187a5b3e2dd93f790
|
|
BLAKE2b-256 checksum How to use checksums |
eb7c998c76df648dc0d1436fbdbd5a2d3f373a2ce9c69d6e7ad3ab1a51df7746
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.11
|
Release files / joinly-0.1.1-py3-none-any.whl
| Download URL | joinly-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9cdf8d1a1cac38c7e4c208ea8b78246da0a1431989ecfb3462a6164ae341f62d
|
|
BLAKE2b-256 checksum How to use checksums |
89595f3c1b91678cd880a01feb18f168339d2cc5fa65c1999aab6aced4d32ce9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.11
|