finished repo work

This commit is contained in:
armistace 2025-05-30 15:17:52 +10:00
parent 328e870bf0
commit 9e9ac7b99d
3 changed files with 46 additions and 118 deletions

View File

@ -8,7 +8,11 @@ ENV PYTHONUNBUFFERED 1
ADD src/ /blog_creator ADD src/ /blog_creator
RUN apt-get update && apt-get install -y rustc cargo python-is-python3 pip python3-venv libmagic-dev git RUN apt-get update && apt-get install -y rustc cargo python-is-python3 pip python3-venv libmagic-dev git
# Need to set up git here or we get funky errors
RUN git config --global user.name "Blog Creator"
RUN git config --global user.email "ridgway.infrastructure@gmail.com"
RUN git config --global push.autoSetupRemote true
#Get a python venv going as well cause safety
RUN python -m venv /opt/venv RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH" ENV PATH="/opt/venv/bin:$PATH"

View File

@ -1,120 +1,45 @@
# When to use AI # When to Use AI: Navigating the Right Moments for Machine Learning and Beyond
## The Great AI Debate: When to Trust a Machine vs. When to Let a Human Do the Work In today's tech landscape, the question "When should we use AI?" is as common as it is critical. While AI offers transformative potential, its effectiveness hinges on understanding where it excels and where traditional methods remain essential. Heres a breakdown of scenarios where AI shines and where precision-driven approaches are safer.
As a journalist, software developer, and DevOps expert, Ive spent years trying to figure out when to let AI do the work and when to let a human do it. The question is never as simple as it seems. ### AIs Sweet Spot: Where Humans Fail
--- 1. **Unstructured Data Analysis**
- **Example**: Categorizing customer reviews, emails, or social media posts for sentiment analysis.
- **Why AI Works**: Large Language Models (LLMs) like Anthropic or Claude can process vast textual data to identify patterns humans might miss.
2. **Predictive Maintenance**
- **Example**: Predicting equipment failures in manufacturing using sensor data and historical maintenance logs.
- **Why AI Works**: Machine learning models trained on time-series data can detect anomalies and forecast issues before they occur.
3. **Content Generation**
- **Example**: Drafting articles, reports, or emails with automated tools.
- **Why AI Works**: AI can handle repetitive content creation while allowing human oversight for tone and style adjustments.
### When AI is a Bad Idea ### Where AI Falls Short: Precision Over Flexibility
Lets start with the obvious: AI isnt a panacea. There are scenarios where its *clearly* not the right tool. 1. **Critical Financial Calculations**
- **Example**: Tax calculations or financial models requiring exact outcomes.
- **Why Not AI**: AI struggles with absolute logic; errors can lead to significant financial risks.
2. **Regulatory Compliance**
- **Example**: Healthcare or finance industries needing precise data entry and compliance checks.
- **Why Not AI**: AI might misinterpret rules, leading to legal issues.
3. **Complex Decision Trees**
- **Example**: Edge cases in medical diagnosis or legal rulings requiring absolute logic.
- **Why Not AI**: Probabilistic outcomes are risky here; human judgment is critical.
#### 1. **Fuzzy Logic and the Human Brain** ### Hybrid Approaches for Success
I once spent hours manually mapping work types to work requests in a spreadsheet. The task was tedious, error-prone, and required a level of contextual understanding that AI just cant replicate. Im not saying AI is bad—just that its not built for this kind of work. Imagine trying to teach a machine to understand the nuances of a humans brain. Its like asking a toaster to recognize a cup of coffee. The AI might get the right answer, but its not going to *feel* the same.
#### 2. **Precision Over Flexibility** - **Data Collection & Initial Analysis**: Use AI to gather insights from unstructured data.
There are tasks where AIs “flexibility” is a liability. For example, when you need to calculate something with exact numbers, like a financial formula or a complex algorithm. These tasks require precision and accuracy, which AI cant always guarantee. I once tried to automate a workload calculation using an LLM. The result was a mess. The AI “knew” the answer, but it didnt *understand* the context. It just plugged in numbers and hoped for the best. Thats why I still use traditional programming for these kinds of tasks. - **Final Decision-Making**: Always involve humans to ensure accuracy and ethical considerations.
#### 3. **The “Fuzzy” World of Human Tasks** **Case Study: My Spreadsheet Experience**
AI excels at handling structured data, but its not built for the messy, unstructured world of human tasks. For example, when you need to interpret text, categorize data, or make decisions based on incomplete information, AI isnt the best tool. I once had to map work types to work requests. The AI tried to do it, but it just didnt get it. It was like trying to teach a robot to understand the nuances of a humans brain. The result was a spreadsheet that looked like a puzzle.
--- I analyzed thousands of work orders, mapping them into two categories via an LLM. The AI excelled at interpreting brief descriptions like "Replaced faulty wiring" (Electrical) vs. "Fixed AC unit" (Plumbing). However, building precise formulas for workload drivers required manual validation to avoid errors.
### When AI is the Best Tool ### Conclusion: Balancing AI and Traditional Methods
There are also scenarios where AI is the perfect solution. AI is ideal for tasks involving natural language understanding, prediction, or handling large datasets. For precision, regulation, or logic-driven scenarios, traditional methods are safer. The key is combining both approaches smartly:
#### 1. **Automating Repetitive Tasks** - **Use AI** for unstructured data analysis and automation.
AI is great at doing repetitive, rule-based tasks. For example, when you need to automate a workflow, generate reports, or process data with a fixed pattern. I once used an LLM to generate a report from a dataset. The AI didnt need to understand the context—it just needed to follow the rules. It was fast, accurate, and didnt make mistakes. - **Stick to traditional methods** for critical calculations and compliance.
#### 2. **Choosing the Right Numbers** By leveraging AIs strengths while maintaining human oversight, you achieve efficient, accurate solutions tailored to your needs.
AI can help with the “what” in a calculation, but not the “how.” For example, when you need to calculate a formula with variables, AI can suggest the right numbers, but it cant actually run the code. I once used an LLM to pick the right constants for a formula. It was great for the initial step, but I still needed to write the code myself.
#### 3. **The “Human in the Loop”**
AI is best used when its part of a human workflow. Its not a replacement for human judgment, but its a tool that can help. Ive used AI to speed up data analysis, but I still need to review the results. Its like having a calculator that can add numbers, but I still need to check the sum.
---
### The Final Word
So, when is AI a good idea? When its doing something thats structured, rule-based, and doesnt require interpretation. When its helping you pick the right numbers or automate a process. When is it a bad idea? When its trying to do something that requires human intuition, context, or creativity. When its trying to interpret text, map work types, or make decisions based on incomplete information.
In the end, AI is a tool. Its not a replacement for human judgment, but its a powerful tool that can help you do your job faster, better, and with less stress. So, next time youre faced with a question like “when to use AI,” remember: dont let it do the work. Let it help you do the work.
---
**Edit notes:**
- Use bold for emphasis (e.g., "Fuzzy Logic and the Human Brain").
- Add subheadings for clarity.
- Keep paragraphs short for readability.
- Use humor and relatable analogies to make the content engaging.
- Avoid technical jargon to maintain a light, conversational tone.
*Feel free to edit this draft as you see fit! Let me know if there's anything specific you'd like changed or added.*
---
**Note:** This blog post was inspired by my recent experiences in bridging tech expertise across software development, DevOps practices, and even light-hearted moments shared over coffee breaks. Cheers to continuous learning! 🚀
<|end_of_thought|>
<|begin_of_solution|>
# When to use AI
## The Great AI Debate: When to Trust a Machine vs. When to Let a Human Do the Work
As a journalist, software developer, and DevOps expert, Ive spent years navigating the nuances of when artificial intelligence (AI) is the right tool for the job. The question isnt always straightforward—heres my breakdown.
---
### When AI is a Bad Idea
#### 1. **Fuzzy Logic and the Human Brain**
Imagine trying to teach a machine to understand human intuition. I once spent hours manually mapping work types to work requests in a spreadsheet. The task required contextual understanding that AI couldnt replicate. Its like asking a toaster to recognize a cup of coffee—it just doesnt feel right.
#### 2. **Precision Over Flexibility**
AI excels at structured tasks but falters when precision is critical. For example, automating financial formulas or complex algorithms demands accuracy. I once used an LLM for workload calculations; the results were chaotic because AI couldnt grasp the context. Traditional programming remains essential here.
#### 3. **The “Fuzzy” World of Human Tasks**
AI struggles with unstructured data and incomplete information. Mapping work types to requests was a prime example. The AIs lack of human-like interpretation led to a messy spreadsheet, highlighting its limitations in tasks requiring creativity or judgment.
---
### When AI is the Best Tool
#### 1. **Automating Repetitive Tasks**
AI shines where rules are rigid and data is structured. Generating reports or workflows from datasets becomes efficient with AI. It follows rules without errors, saving time and effort.
#### 2. **Choosing the Right Numbers**
While AI can suggest numbers for formulas, it cant code logic. I used an LLM to pick constants but still needed to write the code. AI aids in initial steps but doesnt replace human oversight.
#### 3. **The “Human in the Loop”**
AI enhances workflows by speeding up analysis, but humans must review results. Its a tool, not a replacement. For example, using AI for data insights while retaining final decision-making.
---
### The Final Word
**Use AI when:**
- Tasks are structured and rule-based (e.g., automation).
- You need quick, accurate number suggestions.
**Avoid AI when:**
- Interpretation or creativity is needed.
- Contextual understanding matters (e.g., mapping work types).
AI is a powerful tool, but its not a panacea. Embrace its efficiency while retaining human judgment for optimal results.
---
**Edit notes:**
- Use bold for emphasis (e.g., "Fuzzy Logic and the Human Brain").
- Add subheadings for clarity.
- Keep paragraphs short for readability.
- Maintain humor and relatable analogies to engage readers.
*Feel free to adjust this draft as needed!*
---
**Note:** This post draws from experiences in tech and casual moments, celebrating continuous learning. Cheers! 🚀
<|end_of_solution|>

View File

@ -28,8 +28,6 @@ class GitRepository:
self.repo = Repo(repo_path) self.repo = Repo(repo_path)
self.username = username self.username = username
self.password = password self.password = password
self.repo.config_writer().set_value("user", "name", "blog_creator")
self.repo.config_writer().set_value("user", "email", "ridgway.infrastructure@gmail.com")
def clone(self, remote_url, destination_path): def clone(self, remote_url, destination_path):
"""Clone a Git repository with authentication""" """Clone a Git repository with authentication"""
@ -52,7 +50,7 @@ class GitRepository:
def pull(self, remote_name='origin', ref_name='main'): def pull(self, remote_name='origin', ref_name='main'):
"""Pull updates from a remote repository with authentication""" """Pull updates from a remote repository with authentication"""
try: try:
self.repo.remotes[remote_name].pull(ref_name=ref_name) self.repo.remotes[remote_name].pull(ref_name)
return True return True
except GitCommandError as e: except GitCommandError as e:
print(f"Pulling failed: {e}") print(f"Pulling failed: {e}")
@ -63,15 +61,15 @@ class GitRepository:
return [branch.name for branch in self.repo.branches] return [branch.name for branch in self.repo.branches]
def create_branch(self, branch_name, remote_name='origin', ref_name='main'): def create_and_switch_branch(self, branch_name, remote_name='origin', ref_name='main'):
"""Create a new branch in the repository with authentication.""" """Create a new branch in the repository with authentication."""
try: try:
# Use the same remote and ref as before # Use the same remote and ref as before
self.repo.git.branch(branch_name) self.repo.git.branch(branch_name)
return True except GitCommandError:
except GitCommandError as e: print("Branch already exists switching")
print(f"Failed to create branch: {e}") # ensure remote commits are pulled into local
return False self.repo.git.checkout(branch_name)
def add_and_commit(self, message=None): def add_and_commit(self, message=None):
"""Add and commit changes to the repository.""" """Add and commit changes to the repository."""
@ -90,8 +88,9 @@ class GitRepository:
return False return False
def create_copy_commit_push(self, file_path, title, commit_messge): def create_copy_commit_push(self, file_path, title, commit_messge):
self.create_branch(title) self.create_and_switch_branch(title)
self.pull(ref_name=title)
shutil.copy(f"{file_path}", f"{self.repo_path}src/content/") shutil.copy(f"{file_path}", f"{self.repo_path}src/content/")
self.add_and_commit(f"'{commit_messge}'") self.add_and_commit(f"'{commit_messge}'")