Skip to main content

elsai-agent-hub: A multi-agent framework for GenAI

Table of Contents

Introduction

elsai-agent-hub is a Python package designed to facilitate the quick and customized development of agent-driven applications leveraging large language models (LLMs). This library aims to streamline tasks such as content generation, sending emails, and extracting information from various sources, including PDFs and web URLs.

Main Features

Here are some of the key features of elsai-agent-hub:

  • Content Generation: Create high-quality written content tailored to specific needs and contexts using advanced LLMs.
  • Sales Pitch Automation: Automate the creation and sending of personalized sales pitch emails, improving outreach effectiveness and engagement rates
  • PDF Text Extraction: Seamless integration with PyMuPDF to read and extract text from PDF files.
  • Web Scraping: Utilize BeautifulSoup to scrape and extract data from web URLs.
  • Email Automation: Send emails securely using SMTP with best practices incorporated.
  • Document Vectorization: Enable users to effortlessly vectorize documents (PDF, DOCX, TXT) from a given directory using ChromaDB or Pinecone for efficient information retrieval.
  • Flexibility and Customization: Highly customizable to suit specific application requirements and workflows.

Whether you are looking to build a simple application or a complex system leveraging LLMs, elsai-agent-hub provides the fundamental building blocks to get you started quickly and efficiently.

Directory Structure Diagram

plot

Installation

You can install our package simply by running

pip install elsai-agent-hub

License

MIT

Setup

Environment Variables

Depending on whether you are using Azure OpenAI or OpenAI, you need to set specific environment variables.

Azure OpenAI

If you are using Azure OpenAI, set the following environment variables:
```sh
export AZURE_OPENAI_ENDPOINT=<Your_Endpoint>
export AZURE_OPENAI_API_KEY=<Your_API_Key>
export OPENAI_API_VERSION=<OpenAI_Version_Date>
export AZURE_OPENAI_DEPLOYMENT_NAME=<Your_Deployment_Name>
```

OpenAI

If you are using OpenAI, set the following environment variable:
```sh
export OPENAI_API_KEY=<Your_API_Key>
```

Usage

Content Generate

It will analyze the query based on the given prompts

Default prompt

For Azure
```python
from elsai_agent_hub.micro_agent import ContentGenerate
generated_text = ContentGenerate().generate(pdf_file_path='Your Pdf file-path',
                                            domain='Your Domain URL',
                                            text='your text',
                                            ai_service='azure')
```
For openAI
from elsai_agent_hub.micro_agent import ContentGenerate
generated_text = ContentGenerate().generate(pdf_file_path='Your Pdf file-path',
                                           domain='Your Domain URL',
                                           text="your text",
                                           ai_service="openai")

Custom Prompt

from elsai_agent_hub.micro_agent import ContentGenerate

#Parameters
"""
pdf_file_path (str): Path to a PDF file to be analyzed.
ai_service (str): The AI service to use for analysis ('azure' or 'openai').
urls (list, optional): A URL's to be extract and analyze. Defaults to an empty list. Defaults to None.
text (str, optional): Text to be analyzed. Defaults to None.
system_message (str, optional): A system message that may provide additional context for the analysis. Defaults to None.
prompt (str, optional): A custom prompt for the AI service. If not provided, a default prompt will be used. Defaults to None.
ai_config (dict, optional): Additional configuration parameters for the AI service. Defaults to an empty dictionary.
"""
generated_text = ContentGenerate().generate(pdf_file_path='Your Pdf file-path',
                                           domain='Your Domain URL',
                                           text="your text",
                                           system_message="You are expert in data analysis"
                                           prompt="Analyze the document and provide tha valuable business insight"
                                           ai_service="openai") 

Email Sender

from elsai_agent_hub.tools import EmailSender
EmailSender().send_email(username="xxxx@gmail.com", #Login user mail ID
                      password="<Your APP Password>", #Corresponding APP password for login USER mail
                      sender_mail="xxxxx@gmail.com",
                      receiver_mail="yyyyy@gmail.com",
                      subject="Test Mail",
                      content_body="Howdy!")

Sales Pitch Agent

 export LOGIN_MAIL='Your Gmail ID'
 export PASSWORD='Your 16 digit App password'
response = Sales().sales_pitch(pdf_file_path='Your Pdf file-path', #Product Details PDF file path
             csv_file_path='Your prospect CSV file', #Csv file path contains Name, Designation, Mail and Domain, 
             ai_service='azure',
             sender_name="Sender Name",
             sender_designation="Sender Designation",
             attachment='Attachment File path')

Vectorization Using ChromaDB

Using OpenAI

from elsai_agent_hub.micro_agent import ChromaDB
chroma_db = ChromaDB(
  ai_service='openai',
  collection_name='your-collection-name',
  persistent_path='Your Database Storage Path'
)
collection = chroma_db.store_data_into_db(document_directory='Your Document Directory Path')
response = chroma_db.search_documents("Your Query Text", number_of_doc=5)
print(response)

Using AzureOpenAI

 export AZURE_OPENAI_ENDPOINT=<Your_Endpoint>
 export AZURE_OPENAI_API_KEY=<Your_API_Key>
 export OPENAI_API_VERSION=<OpenAI_Version_Date>
 export AZURE_OPENAI_DEPLOYMENT_NAME='text-embedding-3-small'

Note: Note: Make sure you create your deployment name as 'text-embedding-3-small' or any other embedding model pass ypu deployment-name as parameter while initialize.

from elsai_agent_hub.micro_agent import ChromaDB
chroma_db = ChromaDB(
  ai_service='azure',
  collection_name='your-collection-name',
  persistent_path='Your Database Storage Path',
  azure_deployment_name='Deployment name for embedding model'
)
collection = chroma_db.store_data_into_db(document_directory='Your Document Directory Path')
response = chroma_db.search_documents('Your Query Text', number_of_doc=5)
print(response)

Vectorization Using Pinecone

Using OpenAI

from elsai_agent_hub.micro_agent import PineConeDB
pinecone_db = PineConeDB('openai', index_name='Your Index Name')
name_space = 'Your-Name-Space'
index = pinecone_db.store_data_into_db(document_directory='Your Document Directory Path', name_space=name_space)
response = pinecone_db.search_documents('Your Query Text', namespace=name_space)
print(response)

Using AzureOpenAI

  export AZURE_OPENAI_ENDPOINT=<Your_Endpoint>
  export AZURE_OPENAI_API_KEY=<Your_API_Key>
  export OPENAI_API_VERSION=<OpenAI_Version_Date>
  export AZURE_OPENAI_DEPLOYMENT_NAME=<deployment-name>

Note: Make sure you create your deployment name as 'text-embedding-3-small' or any other embedding model pass ypu deployment-name as parameter while initialize.

from elsai_agent_hub.micro_agent import ChromaDB
from elsai_agent_hub.micro_agent import PineConeDB
pinecone_db = PineConeDB('azure', index_name='Your Index Name', azure_deployment_name='Deployment name for embedding model')
name_space = 'Your-Name-Space'
index = pinecone_db.store_data_into_db(document_directory='Your Document Directory Path', name_space=name_space)
response = pinecone_db.search_documents('Your Query Text', namespace=name_space)
print(response)

Metadata

Release files for elsai-agent-hub 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for elsai-agent-hub 0.0.3
File Size Uploaded
elsai-agent-hub-0.0.3.tar.gz 37.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for elsai-agent-hub 0.0.3
File Interpreter ABI Platform
elsai_agent_hub-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 62.7 kB

Release files / elsai-agent-hub-0.0.3.tar.gz

Download URL elsai-agent-hub-0.0.3.tar.gz
Size 37.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3e3b3dae71d113a4d1244be602150e8f3e6bf068c1a5b26a0713877b06ba7758
BLAKE2b-256 checksum
How to use checksums
62efd8582d1548b7ecb8d091291b313289b367c84155e09e06bc8b61afcf2e27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.6

Release files / elsai_agent_hub-0.0.3-py3-none-any.whl

Download URL elsai_agent_hub-0.0.3-py3-none-any.whl
Size 25.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d66b5cab7947fb0df0c4dc638bf8a45442ed43dd8294b00cbac65fcf85ab223
BLAKE2b-256 checksum
How to use checksums
03cb53a8c815e7919e63d43d7325135c3633a453d9c5c9cc9df9d4786cc35321
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

1 release file

0.0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page