[](https://badge.fury.io/py/beatrica-embedding)
[](https://opensource.org/licenses/MIT)
[](https://pepy.tech/project/beatrica-embedding)
# Beatrica Embedding
`beatrica-embedding` is a Python package designed to embed and analyze code changes in git repositories, utilizing Language Learning Models (LLMs) for enhanced insights. It allows seamless switching between different LLMs, making it highly adaptable for various code analysis needs.
## Installation
To install `beatrica-embedding`, use pip:
```bash
pip install beatrica-embedding
```
## Usage
`beatrica-embedding` offers a flexible way to analyze commit changes and generate insights using different LLMs. Below is an example demonstrating how to extract commit changes from a repository and process them with a chosen LLM.
### Extracting and Embedding Code Changes with LLM
```python
from beatrica_git.recent_change_inspector import BeatricaDiffTracker
from beatrica_embedding.embedding_generator import BeatricaCodeChangeProcessor
from langchain_openai import ChatOpenAI
from langchain_mistralai.chat_models import ChatMistralAI
# Extract commit changes from a git repository
beatrica_diff_tracker = BeatricaDiffTracker(base_branch="main")
# Analyze the commits
beatrica_diff_tracker.analyze_commits()
# Get the commit changes
commit_changes = beatrica_diff_tracker.commit_changes.items()
# Choose the LLM for processing
# language_model = ChatOpenAI(model_name="gpt-4-0125-preview", api_key=os.getenv("OPENAI_API_KEY"), max_tokens=1000)
language_model = ChatMistralAI(model="mistral-medium-latest", mistral_api_key=os.getenv("MISTRAL_API_KEY"), max_tokens=500)
code_change_processor = BeatricaCodeChangeProcessor(commit_changes, language_model=language_model)
# Process the commit changes
retrieval_chain = code_change_processor.process()
# Example query to analyze the changes
question = "What are the changes in the following code?"
print(question)
result = retrieval_chain(question)
answer = result['answer']
print(answer)
```
## Features
- Flexible integration with multiple LLMs for code change analysis.
- Easy to switch between models like OpenAI's GPT or MistralAI for different levels of analysis.
- Embedding and analyzing commit changes in git repositories for enhanced insights.
- Supports detailed analysis of code changes, leveraging the power of conversational models.
## Contributing
Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/chigwell/beatrica-embedding/issues).
## License
This project is licensed under the [MIT License](https://choosealicense.com/licenses/mit/).
Raw data
{
"_id": null,
"home_page": "https://github.com/chigwell/beatrica-embedding",
"name": "beatrica-embedding",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Eugene Evstafev",
"author_email": "chigwel@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/5e/ea/440218b666d52d41c899ac2bf0241a9b615c495329a12672cf107416b9d9/beatrica-embedding-0.1.1.tar.gz",
"platform": null,
"description": "[](https://badge.fury.io/py/beatrica-embedding)\n[](https://opensource.org/licenses/MIT)\n[](https://pepy.tech/project/beatrica-embedding)\n\n# Beatrica Embedding\n\n`beatrica-embedding` is a Python package designed to embed and analyze code changes in git repositories, utilizing Language Learning Models (LLMs) for enhanced insights. It allows seamless switching between different LLMs, making it highly adaptable for various code analysis needs.\n\n## Installation\n\nTo install `beatrica-embedding`, use pip:\n\n```bash\npip install beatrica-embedding\n```\n\n## Usage\n\n`beatrica-embedding` offers a flexible way to analyze commit changes and generate insights using different LLMs. Below is an example demonstrating how to extract commit changes from a repository and process them with a chosen LLM.\n\n### Extracting and Embedding Code Changes with LLM\n\n```python\nfrom beatrica_git.recent_change_inspector import BeatricaDiffTracker\nfrom beatrica_embedding.embedding_generator import BeatricaCodeChangeProcessor\nfrom langchain_openai import ChatOpenAI\nfrom langchain_mistralai.chat_models import ChatMistralAI\n\n\n# Extract commit changes from a git repository\nbeatrica_diff_tracker = BeatricaDiffTracker(base_branch=\"main\")\n\n# Analyze the commits\nbeatrica_diff_tracker.analyze_commits()\n\n# Get the commit changes\ncommit_changes = beatrica_diff_tracker.commit_changes.items()\n\n# Choose the LLM for processing\n# language_model = ChatOpenAI(model_name=\"gpt-4-0125-preview\", api_key=os.getenv(\"OPENAI_API_KEY\"), max_tokens=1000)\nlanguage_model = ChatMistralAI(model=\"mistral-medium-latest\", mistral_api_key=os.getenv(\"MISTRAL_API_KEY\"), max_tokens=500)\n\ncode_change_processor = BeatricaCodeChangeProcessor(commit_changes, language_model=language_model)\n\n# Process the commit changes\nretrieval_chain = code_change_processor.process()\n\n# Example query to analyze the changes\nquestion = \"What are the changes in the following code?\"\nprint(question)\nresult = retrieval_chain(question)\n\nanswer = result['answer']\nprint(answer)\n```\n\n## Features\n\n- Flexible integration with multiple LLMs for code change analysis.\n- Easy to switch between models like OpenAI's GPT or MistralAI for different levels of analysis.\n- Embedding and analyzing commit changes in git repositories for enhanced insights.\n- Supports detailed analysis of code changes, leveraging the power of conversational models.\n\n## Contributing\n\nContributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/chigwell/beatrica-embedding/issues).\n\n## License\n\nThis project is licensed under the [MIT License](https://choosealicense.com/licenses/mit/).\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python package for embedding and analyzing code changes in git repositories.",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/chigwell/beatrica-embedding"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2f707d79ce1987fa4931a1f78fffdd9a83fe1c0dfe962f58346d792b2ef30991",
"md5": "12ddac96c6e58afdc89db44c928f28fd",
"sha256": "7af69838096434223913ccc71449d355f7f7436376d99841bb59caba34b357f7"
},
"downloads": -1,
"filename": "beatrica_embedding-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "12ddac96c6e58afdc89db44c928f28fd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 6615,
"upload_time": "2024-04-11T10:19:40",
"upload_time_iso_8601": "2024-04-11T10:19:40.837197Z",
"url": "https://files.pythonhosted.org/packages/2f/70/7d79ce1987fa4931a1f78fffdd9a83fe1c0dfe962f58346d792b2ef30991/beatrica_embedding-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5eea440218b666d52d41c899ac2bf0241a9b615c495329a12672cf107416b9d9",
"md5": "ae9f064f64d6d2f4cd5ee1ca00c500c5",
"sha256": "d6c84822abb99fa059c34b865cd36e82a4385aa27c72e91b4f6ab4921f714c4f"
},
"downloads": -1,
"filename": "beatrica-embedding-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "ae9f064f64d6d2f4cd5ee1ca00c500c5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 5884,
"upload_time": "2024-04-11T10:19:42",
"upload_time_iso_8601": "2024-04-11T10:19:42.784862Z",
"url": "https://files.pythonhosted.org/packages/5e/ea/440218b666d52d41c899ac2bf0241a9b615c495329a12672cf107416b9d9/beatrica-embedding-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-11 10:19:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "chigwell",
"github_project": "beatrica-embedding",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "beatrica-embedding"
}