2 4 months ago

https://github.com/JaxxyJadio/HF-Scrape/blob/main/Keyword-from-topic-agent.zip

Models

View all →

Readme

Keyword From Topic Workflow

Purpose

Generates keywords from topics using a fine-tuned language model with validation and quality control.

Workflow Function

  • Input: Topics from topics.yaml
  • Process: Sends each topic to Ollama model Jadio/keyword_from_topic_granite33_2b
  • Output: 7+ word keywords related to each topic (we ask the model for more, and validate/reject below this level)
  • Format: JSONL records with topic, keyword, and keyword_hash
  • Validation: Ensures minimum word count, unique hashes, and topic repetition in keywords

Quick Start

  1. Modify topics.yaml with your topics if needed
  2. Run: python workflow.py

The workflow automatically calls Ollama’s chat API and loads the model as needed. It runs continuously in loops until stopped with Ctrl+C.

Model Configuration

The model uses temperature 0.3 to force topic repetition in generated keywords. The system prompt ensures 7+ word output related to the input topic.

Base Layers Architecture

  • workflow_base_layer.py: Main orchestration and signal handling
  • processing_base_layer.py: Async, parallel, and sequential processing modes with continuous looping
  • ollama_base_layer.py: Chat API integration with streaming support
  • file_base_layer.py: File operations and data loading
  • display_base_layer.py: Progress bars and terminal output formatting
  • validation_base_layer.py: Record validation, hash generation, and quality control
  • configuration.py: YAML configuration management

Validation Rules

  • Minimum Word Count: 7 words required
  • Unique Hashes: Prevents duplicate keyword generation
  • Topic Repetition: Ensures generated keyword contains topic words
  • Auto-deletion: Removes records failing validation criteria

Template Structure

{"task": "1_generate_keyword", "topic":"", "keyword":"", "keyword_hash":""}

Example

Input Topic: “Python Programming Language” Output: {"task": "1_generate_keyword", "topic":"Python Programming Language", "keyword":"Python Programming Language: Comprehensive Guide", "keyword_hash":"804dafd9..."}

Portability

This workflow is completely self-contained. Copy the entire folder to any machine with Python and Ollama to run independently.