This repository provides tools and services to manage OpenAI Assistants, including creating, listing, and deleting assistants, as well as handling vector stores and retrieval files.
Project description
AI Assistant Manager
This repository provides tools and services to manage OpenAI Assistants, including creating, listing, and deleting assistants, as well as handling vector stores and retrieval files. It includes end-to-end and unit tests, and leverages the Hatch build system for environment management and testing.
Install through PyPI
pip install ai-assistant-manager
For more details, visit the PyPI project page.
Setup
- Clone the repository:
git clone https://github.com/DEV3L/ai-assistant-manager
cd ai-assistant-manager
- Copy the env.local file to a new file named .env and replace
OPENAI_API_KEY
with your actual OpenAI API key:
cp env.local .env
- Setup a virtual environment with dependencies and activate it:
brew install hatch
hatch env create
hatch shell
Environment Variables
The following environment variables can be configured in the .env
file:
OPENAI_MODEL
: The model to use (default:gpt-4o
)ASSISTANT_DESCRIPTION
: Description of the assistant (default:AI Assistant Manager
)ASSISTANT_NAME
: Name of the assistant (default:AI Assistant Manager
)BIN_DIR
: Directory for binaries (default:bin
)DATA_DIR
: Directory for data files (default:data
)DATA_FILE_PREFIX
: Prefix for data files (default:AI Assistant Manager
)
Testing
End to End Test
hatch run e2e
Unit Tests
hatch run test
Coverage Gutters:
Command + Shift + P => Coverage Gutters: Watch
Example
from loguru import logger
from ai_assistant_manager.assistants.assistant_service import (
AssistantService,
)
from ai_assistant_manager.chats.chat import Chat
from ai_assistant_manager.clients.openai_api import OpenAIClient, build_openai_client
from ai_assistant_manager.exporters.files.files_exporter import FilesExporter
def main():
FilesExporter("about.txt").export()
assistant_name = "AI-Assistant-Manager-Test"
logger.info(f"Building {assistant_name}")
client = OpenAIClient(build_openai_client())
service = AssistantService(client, "You are a helpful assistant")
assistant_id = service.get_assistant_id()
logger.info(f"Assistant ID: {assistant_id}")
chat = Chat(client, assistant_id)
chat.start()
message = "What is the AI Assistant Manager?"
print(f"\nMessage:\n{message}")
start_response = chat.send_user_message(message)
print(f"\n{service.assistant_name}:\n{start_response}")
# service.delete_assistant()
if __name__ == "__main__":
try:
main()
except Exception as e:
logger.info(f"Error: {e}")
Contributing
We welcome contributions! To contribute:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Make your changes.
- Ensure all tests pass.
- Submit a pull request with a detailed description of your changes.
Code of Conduct
We expect all contributors to adhere to our Code of Conduct:
- Be respectful and considerate.
- Avoid discriminatory or offensive language.
- Report any unacceptable behavior to the project maintainers.
By participating in this project, you agree to abide by these guidelines.
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
Hashes for ai_assistant_manager-0.0.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9dc62b50eead4300a4fd83ca817730539b9c946106714ccd6a73196e08ebe3a4 |
|
MD5 | 10941e71f1b18581af098381c2e8ae47 |
|
BLAKE2b-256 | aa7a1eddc913c4a945dd83abf5bf09d62dad0767080889c8707a58be9ea64fe4 |
Hashes for ai_assistant_manager-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77a89fd58a691b55d7ef5a8e685fe2a2cbbbf82f83a20fadad4deebf7c4c167d |
|
MD5 | 32c8115a2c811c22eaa09e3ceb38efd4 |
|
BLAKE2b-256 | e54dbcac38a6e6863c093fcbb7a3029de86a1b986475283d9668b08977210917 |