Skip to main content

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 = """
![](https://example.com/sample-image.jpg)

# 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 = """
![](https://example.com/sample-image.jpg)

# 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vbi_evaluate_blogs-0.1.10.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vbi_evaluate_blogs-0.1.10-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

Details for the file vbi_evaluate_blogs-0.1.10.tar.gz.

File metadata

  • Download URL: vbi_evaluate_blogs-0.1.10.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for vbi_evaluate_blogs-0.1.10.tar.gz
Algorithm Hash digest
SHA256 99c66bac2b87308207f153b1023804b291997c3cc54edc1346382596a22277d6
MD5 87d421ef628648b98fc317588174904a
BLAKE2b-256 0e95678556de5ac6c582e4282c1d0dd903278b619222c4bda2d000f8839ae536

See more details on using hashes here.

File details

Details for the file vbi_evaluate_blogs-0.1.10-py3-none-any.whl.

File metadata

File hashes

Hashes for vbi_evaluate_blogs-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 e79ae1e8432e400bcf3325ebff57674f0a78f43da9fea3d528d74e93dc3bb0a3
MD5 06720eaef55ee26e8f02928de35fa20a
BLAKE2b-256 e8d227ff6899972645065798f1aa762acfee8b44c4e0b9f7f494a2b8768982ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page