Evaluate blogs
Project description
VBI Evaluate Blogs
vbi_evaluate_blogs is a Python package designed to evaluate the quality of blog content comprehensively. It combines advanced text analysis, image evaluation, and fact-checking capabilities to ensure the quality, relevance, and credibility of the content. The package leverages Azure OpenAI and other state-of-the-art tools to provide accurate and insightful evaluations.
Features
1. Text Content Evaluation
- Analyzes the grammar, structure, and coherence of the text.
- Provides feedback on readability, keyword distribution, and SEO optimization.
- Detects potential issues such as redundancy, lack of clarity, or missing components.
2. Image Relevance Analysis
- Evaluates the quality and relevance of images in the content.
- Ensures that images align with the context and purpose of the document.
- Extracts and describes image content for deeper analysis.
3. Fact-Checking
- Verifies the factual accuracy of the content using external sources.
- Highlights potential inaccuracies or unsupported claims.
- Ensures the credibility of the information presented.
4. Modular Design
- Each feature is implemented as a separate module, allowing for flexible usage.
- Users can choose to run specific evaluations or combine them as needed.
Installation
To install the package, use the following commands:
pip install vbi-evaluate-blogs
playwright install
Usage
1. Initialization
Before using the package, ensure you have set up your Azure OpenAI credentials in a .env file:
AZURE_OPENAI_API_KEY="your_api_key"
AZURE_OPENAI_ENDPOINT="your_endpoint"
2. Importing the Package
The package provides three main modules:
check_text: For text content evaluation.check_image: For image relevance analysis.check_fact: For fact-checking.
You can import these modules as follows:
from vbi_evaluate_blogs import check_text, check_image, check_fact
from langchain_openai import AzureChatOpenAI
from dotenv import load_dotenv
import os
load_dotenv()
3. Setting Up Azure OpenAI Models
Initialize the Azure OpenAI models for text and image processing:
text_llm = AzureChatOpenAI(
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
azure_endpoint=os.getenv("AZURE_OPENAI_ENDPOINT"),
model="o3-mini",
api_version="2024-12-01-preview"
)
image_llm = AzureChatOpenAI(
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
azure_endpoint=os.getenv("AZURE_OPENAI_ENDPOINT"),
model="gpt-4o-mini",
api_version="2024-08-01-preview",
temperature=0.7,
max_tokens=16000
)
4. Text Content Evaluation
Use the check_text module to evaluate the structure, grammar, readability, and SEO of the text content:
content = """
# Sample Blog Content
This is a sample blog content for evaluation.
"""
result = check_text(text_llm, content)
print("Text Evaluation Result:")
print(result)
5. Image Relevance Analysis
Use the check_image module to analyze images in the content:
content_with_images = """

# Sample Blog Content with Images
This is a sample blog content with images for evaluation.
"""
image_result = check_image(text_llm, image_llm, content_with_images)
print("Image Analysis Result:")
print(image_result)
6. Fact-Checking
Use the check_fact module to verify the factual accuracy of the content:
content_with_claims = """
# Sample Blog Content with Claims
The Earth is flat.
"""
fact_result = check_fact(text_llm, content_with_claims)
print("Fact-Checking Result:")
print(fact_result)
7. Comprehensive Evaluation
You can combine all three modules for a comprehensive evaluation:
content = """

# Sample Blog Content
This is a sample blog content with images and claims for evaluation.
"""
text_result = check_text(text_llm, content)
image_result = check_image(text_llm, image_llm, content)
fact_result = check_fact(text_llm, content)
print("Comprehensive Evaluation Result:")
print({
"text": text_result,
"images": image_result,
"facts": fact_result
})
Command-Line Usage
You can also use the package via the command line for quick evaluations:
python -m vbi_evaluate_blogs --file path/to/your/blog.md
Additional Options
--text: Perform only text evaluation.--images: Perform only image analysis.--facts: Perform only fact-checking.
Example:
python -m vbi_evaluate_blogs --file path/to/your/blog.md --text --images
Advanced Usage
Customizing the Model
You can customize the Azure OpenAI model by providing additional parameters during initialization:
model = AzureChatOpenAI(api_key="your_api_key", temperature=0.7, max_tokens=1000)
Combining Modules
You can combine multiple modules to perform a comprehensive evaluation:
from vbi_evaluate_blogs import check_text, check_image, check_fact
content = """
# Sample Blog Content
This is a sample blog content with images and claims for evaluation.
"""
text_result = check_text(text_llm, content)
image_result = check_image(text_llm, image_llm, content)
fact_result = check_fact(text_llm, content)
combined_result = {
"text": text_result,
"images": image_result,
"facts": fact_result
}
print("Combined Evaluation Result:", combined_result)
License
This project is licensed under the MIT License. See the LICENSE file for details.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vbi_evaluate_blogs-0.1.14.tar.gz.
File metadata
- Download URL: vbi_evaluate_blogs-0.1.14.tar.gz
- Upload date:
- Size: 49.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8cf092a766f2b504cf0fdd75145b19974093ce788d2be37a4d73aa19eaa1958
|
|
| MD5 |
e398faa2c1cfbc26eb2e938df94a330e
|
|
| BLAKE2b-256 |
27acb753518466444e34888e2363e112622c674b219e6d0a1385542ac6bd344d
|
File details
Details for the file vbi_evaluate_blogs-0.1.14-py3-none-any.whl.
File metadata
- Download URL: vbi_evaluate_blogs-0.1.14-py3-none-any.whl
- Upload date:
- Size: 49.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
816a78923fac1fdc52c6a19cd4701925d39b37b02032ca26e416180944a7eb22
|
|
| MD5 |
d43c99cb0f1f2d6a8facf926e27dc210
|
|
| BLAKE2b-256 |
cd319c382ad12960ecdb64f8dc324121f44969649bc3e80640560b3df19b0d81
|