Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- uses: actions/checkout@v4
- run: pipx install poetry
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Mehdi Samsami
Copyright (c) 2025 Mehdi Samsami

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<h4 align="center">
<a href="https://pypi.org/project/clonellm/" target="_blank">
<img src="https://img.shields.io/badge/release-v0.2.4-green" alt="Latest Release">
<img src="https://img.shields.io/badge/release-v0.3.0-green" alt="Latest Release">
</a>
<a href="https://pypi.org/project/clonellm/" target="_blank">
<img src="https://img.shields.io/pypi/v/clonellm.svg" alt="PyPI Version">
Expand Down Expand Up @@ -41,16 +41,9 @@ pip install clonellm
poetry add clonellm
```

### GitHub
### uv
```bash
# Clone the repository
git clone https://github.com/msamsami/clonellm.git

# Navigate into the project directory
cd clonellm

# Install the package
pip install .
uv add clonellm
```

## Usage
Expand Down Expand Up @@ -179,13 +172,21 @@ clone = CloneLLM(model="gpt-4o", documents=documents, embedding=embedding, vecto
Create a personalized profile using CloneLLM's `UserProfile`, which allows you to feed detailed personal information into your clone for more customized interactions:
```python
from clonellm import UserProfile
from clonellm.models import PersonalityTraits

profile = UserProfile(
first_name="Mehdi",
last_name="Samsami",
city="Shiraz",
country="Iran",
expertise=["Data Science", "AI/ML", "Data Analytics"],
personality_traits=PersonalityTraits(
openness=0.8,
conscientiousness=0.7,
extraversion=0.6,
agreeableness=0.9,
neuroticism=0.5,
),
)
```

Expand All @@ -210,7 +211,7 @@ import os
os.environ["ANTHROPIC_API_KEY"] = "anthropic-api-key"

clone = CloneLLM(
model="claude-3-opus-20240229",
model="claude-3-5-sonnet-latest",
documents=documents,
embedding=embedding,
vector_store=RagVectorStore.Chroma,
Expand All @@ -227,7 +228,7 @@ import os
os.environ["HUGGINGFACE_API_KEY"] = "huggingface-api-key"

clone = CloneLLM(
model="meta-llama/Llama-2-70b-chat",
model="meta-llama/Llama-3.3-70B-Instruct",
documents=documents,
embedding=embedding,
memory=10, # Enable memory with maximum size of 10
Expand Down Expand Up @@ -256,8 +257,8 @@ os.environ["VERTEXAI_PROJECT"] = "hardy-device-28813"
os.environ["VERTEXAI_LOCATION"] = "us-central1"
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/your/credentials.json"

embedding = LiteLLMEmbeddings(model="textembedding-gecko@001")
clone = CloneLLM(model="gemini-1.0-pro", documents=documents, embedding=embedding)
embedding = LiteLLMEmbeddings(model="text-embedding-005")
clone = CloneLLM(model="gemini-1.5-flash", documents=documents, embedding=embedding)

for chunk in clone.stream("Describe yourself in 100 words"):
print(chunk, end="", flush=True)
Expand All @@ -277,7 +278,7 @@ os.environ["OPENAI_API_KEY"] = "openai-api-key"

async def main():
documents = [...]
embedding = LiteLLMEmbeddings(model="text-embedding-ada-002")
embedding = LiteLLMEmbeddings(model="text-embedding-3-large")
clone = CloneLLM(model="gpt-4o", documents=documents, embedding=embedding)
await clone.afit()
response = await clone.ainvoke("Tell me about your skills?")
Expand All @@ -299,7 +300,7 @@ os.environ["OPENAI_API_KEY"] = "openai-api-key"
async def main():
documents = [...]
embedding = LiteLLMEmbeddings(model="text-embedding-3-small")
clone = CloneLLM(model="gpt-4o", documents=documents, embedding=embedding)
clone = CloneLLM(model="gpt-4o-mini", documents=documents, embedding=embedding)
await clone.afit()
async for chunk in clone.astream("How comfortable are you with remote work?"):
print(chunk, end="", flush=True)
Expand Down
16 changes: 16 additions & 0 deletions examples/advanced_clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from langchain_community.document_loaders import DirectoryLoader, PyPDFLoader

from clonellm import CloneLLM, LiteLLMEmbeddings, RagVectorStore, UserProfile
from clonellm.models import CommunicationSample, PersonalityTraits
from examples.const import EXIT_COMMANDS, RESET_MEMORY_COMMANDS

# !pip install clonellm[chroma]
Expand Down Expand Up @@ -31,11 +32,26 @@ def main() -> None:
country="USA",
phone_number="+1234567890",
email="jane.doe@example.com",
personality_traits=PersonalityTraits(
openness=0.8,
conscientiousness=0.7,
extraversion=0.6,
agreeableness=0.7,
neuroticism=0.6,
),
education_experience=[
{"Degree": "Bachelor's", "Field": "Computer Science", "Institution": "State University", "Year": 2018},
{"Degree": "Master's", "Field": "Data Science", "Institution": "Tech College", "Year": 2021},
],
expertise=["Python", "Data Analysis", "Data Science", "Machine Learning"],
communication_samples=[
CommunicationSample(
context="Interview",
audience_type="Interviewer",
formality_level=0.5,
content="Hello, I am a Data Scientist and ML Engineer who is looking for a new job.",
)
],
home_page="http://www.jane-doe.com",
github_page="http://www.github.com/jane_doe",
linkedin_page="http://www.linkedin.com/in/jane_doe",
Expand Down
16 changes: 16 additions & 0 deletions examples/advanced_clone_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from langchain_community.document_loaders import DirectoryLoader, PyPDFLoader

from clonellm import CloneLLM, LiteLLMEmbeddings, RagVectorStore, UserProfile
from clonellm.models import CommunicationSample, PersonalityTraits
from examples.const import EXIT_COMMANDS, RESET_MEMORY_COMMANDS

# !pip install clonellm[chroma]
Expand Down Expand Up @@ -32,11 +33,26 @@ async def main() -> None:
country="USA",
phone_number="+1234567890",
email="jane.doe@example.com",
personality_traits=PersonalityTraits(
openness=0.8,
conscientiousness=0.7,
extraversion=0.6,
agreeableness=0.7,
neuroticism=0.6,
),
education_experience=[
{"Degree": "Bachelor's", "Field": "Computer Science", "Institution": "State University", "Year": 2018},
{"Degree": "Master's", "Field": "Data Science", "Institution": "Tech College", "Year": 2021},
],
expertise=["Python", "Data Analysis", "Data Science", "Machine Learning"],
communication_samples=[
CommunicationSample(
context="Interview",
audience_type="Interviewer",
formality_level=0.5,
content="Hello, I am a Data Scientist and ML Engineer who is looking for a new job.",
)
],
home_page="http://www.jane-doe.com",
github_page="http://www.github.com/jane_doe",
linkedin_page="http://www.linkedin.com/in/jane_doe",
Expand Down
Loading